Re: [Phplib-users] pgsql - too many clients?
Brought to you by:
nhruby,
richardarcher
From: Matthias M. <m....@in...> - 2001-12-13 17:41:43
|
On Wed, 12 Dec 2001, Roberto Mello wrote: > On Wed, Nov 21, 2001 at 05:46:00PM +0100, Matthias Mohr wrote: > > > > if you really need the performance you gain using pconnect instead of connect > > (especially when your database is running on another host, than you webserver) > > another approach could be setting the apache-config-value for > > MaxRequestsPerChild. > > But the PHP documentation says that using pconnect PHP "reuses" the > connection. If this is solely an Apache issue, then I don't see how PHP > can make that claim. yes, this could be considered a documentation issue, since the same apache child is able to reuse connection, but the thing breaks if a following request is handled by another child (which is *very* likely). the problem is, that you cannot pass sockets and filehandles from one forked process to another. so if you use the cgi-sapi instead of the apache-sapi you will *never* get a reused connection. i didnt try the new (mulitthreaded) apach2-sapi, maybe that one is able to really reuse all the pconnect and pfsockopen thingies. did anyone test this on apache 2 ? > This pconnect issue is very significant for the overhead of connecting to > a DB can be significant. In PostgreSQL, besides the savings in connection > time, you save time when you are using stored functions because they are > compiled and cached (including execution plans for queries within the > functions) on each backend. So if the backends didn't die (e.g. the > connections were _in fact_ pooled and reused) you have a performance gain. > > AOLserver got polled reusable connections to databases right in 1995. No > wonder I see so much better results under it than Apache. > > -Roberto > -- Matthias Mohr <m....@in...> (Software-Entwicklung) Internet Factory AG, Niederlassung Industriestr. 11, 26121 Oldenburg Tel: (+49) (0)441 - 77 92 10 Fax: (+49) (0)441 - 77 92 177 http://www.internet-factory.de |