Re: passing resource id's through functions

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: Chadwick Rolfs <cmr(at)shell(dot)gis(dot)net>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: passing resource id's through functions
Date: 2002-01-15 00:59:03
Message-ID: 1011056343.26926.29.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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?

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Francisco Reyes 2002-01-19 16:48:40 Long running queries and timeouts
Previous Message Andrew McMillan 2002-01-15 00:41:41 Re: passing resource id's through functions