pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew McMillan <andrew@catalyst.net.nz>
To: Chadwick Rolfs <cmr@shell.gis.net>
Cc: pgsql-php@postgresql.org
Subject: Re: passing resource id's through functions
Date: 15 Jan 2002 13:59:03 +1300
Message-ID: <1011056343.26926.29.camel@kant.mcmillan.net.nz> (raw)
In-Reply-To: <Pine.SOL.3.96.1020114170101.11421C-100000@shell.gis.net>
References: <Pine.SOL.3.96.1020114170101.11421C-100000@shell.gis.net>

On Tue, 2002-01-15 at 11:15, Chadwick Rolfs wrote:
> Yes, that's it.  Using the $GLOBALS array works just fine, and I don't
> have a bunch of pconnections cluttering up the process list, apache, or
> postgresql.  I don't think persistent connections are meant to be _faster_
> as much as they are meant for cutting down on redundant connections.
> Unfortunately, I'm getting a bunch of redundant connections when pconnect
> is used.  Since I don't administer the server, and the ones who do are too
> busy to experement, I'll have to deal with it.  I'd like to know if
> anyone else is having the same problem with pconnect:
> 
> pg_pconnect is in ONE file referred to by all of my other files.  So there
> is only one connect string.  It can't change unless I edit the connection
> file between invocations (let's just say it's STATIC)
> 
> when I go to pg_exec with the pg_pconnect resource, I get a seperate
> connection for each exec!  This is clearly not supposed to be the case
> acoording to http://www.php.net/manual/en/function.pg-pconnect.php
> 
> setting apache to only accept a certain amount of links is a good work
> around, but what about everyone else?  Won't my connections just get
> kicked off if other pconnections take over?  when I look at the postgres
> processes, I should see _ONE_ persistent connection, not nine
> 
> The max conncection set is 64, so that won't be a problem, except that
> each persistent connection takes a little bit of memory (2.5%), and enough
> of them will actually slow the sever down.
> 
> Thanks for the great suggestion on using php's global namespace!

With persistent connections you will (eventually) end up with one
postgresql client process for each apache server process.  If you set
the max connection limit below the max client limit of apache you will
end up with a machine that doesn't spiral out of control, but above that
limit your database driven content simply won't work.

Yes, the reason for using persistent connections definitely _is_
performance, but I don't think it is just connection time performance. 
Longer running connections will have an element of caching which will
give further speed advantages.

Cheers,
					Andrew. 
-- 
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/        PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201    MOB: +64(21)635-694    OFFICE: +64(4)499-2267
       Are you enrolled at http://schoolreunions.co.nz/ yet?




view thread (13+ messages)

Message-ID: <1011056343.26926.29.camel@kant.mcmillan.net.nz>
Permalink:  ../1011056343.26926.29.camel@kant.mcmillan.net.nz/
Also on:    postgresql.org/message-id/1011056343.26926.29.camel@kant.mcmillan.net.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: andrew@catalyst.net.nz, cmr@shell.gis.net
  Subject: Re: passing resource id's through functions
  In-Reply-To: <1011056343.26926.29.camel@kant.mcmillan.net.nz>
  References: <Pine.SOL.3.96.1020114170101.11421C-100000@shell.gis.net> <1011056343.26926.29.camel@kant.mcmillan.net.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox