Re: [Phplib-users] pgsql - too many clients?
Brought to you by:
nhruby,
richardarcher
From: Frank B. <fb...@sy...> - 2001-11-21 17:23:25
|
I've looked into these suggestions and I find I have more to better understand about apache-php-pgsql interaction. I am running several virtual hosts, each with their own database. I determined that my 32 connections was the pgsql "max_connections". But perhaps the 'real' problem is somewhere else. When I run 'ps -ax', I find that there are up-to 10 entries for each database. In the past, I have noticed that this number climbs even if I am the only person accessing a database via a single web-browser instance. Why isn't the existing connection re-used? It must reuse these when I reach 10, because I don't go over that number of connections. Also, is there a way to restrict this number by either database or virtual host basis? The MaxRequestsPerChild option mentioned is currently set to 30, so it doesn't appear to be the controlling option here? Perhaps I will also run some tests to gauge the impact of switching from pconnect to connect. Also, I wouldn't mind if some of the virtual hosts (one database each) were restricted to a very few number of connections. But for some other hosts/databases I am more concerned about performance. Frank At 05:46 PM 11/21/01 +0100, Matthias Mohr wrote: >hello, > >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. > >AFAIR it defaults to 0 which means unlimited requests per child. if so apache >would *never* free you pgsql-handles. if you put it to a value greater 0 every >apache child-process dies after an finite number of requests and frees you >psql-connections (sucking up a bit performance you gained using pconnect, >since the webserver-child-process has to be restarted). > >also: if you keep using pconnect(), you maybe have to raise the number of >max-backends of your pgsql-postmaster. keep in mind that you can get >number-of-apache-childs times number-of-databases times >number-of-database-logins as the total number of simultanous pgsql-connection. > >regards >messju mohr > >On Wed, 21 Nov 2001, Stephen Woodbridge wrote: > >> I had a similar problem with mysql and apache. >> >> Apache does something weird when you pconnect where it never releases or >> reuses your connections. >> >> I fixed this on my sysem by changing pconnect to connect. Find your call >> to pg_pconnect and change it to pg_connect in phplib and see if it fixes >> your problem. You may also need to restart pgsql to purge all the open >> pconnections >> >> -Steve >> >> Frank Bax wrote: >> > >> > pgsql 7.1 - phplib 7.2d - OpenBSD 2.9 >> > >> > How do I fix this? >> > >> > Warning: Unable to connect to PostgreSQL server: Sorry, too many clients >> > already in /var/www/php/class/phplib-7.2d/db_pgsql.inc on line 48 >> > Database error: Link-ID == false, pconnect failed >> > PostgreSQL Error: 0 () >> > Session halted. >> > >> > _______________________________________________ >> > Phplib-users mailing list >> > Php...@li... >> > https://lists.sourceforge.net/lists/listinfo/phplib-users >> >> _______________________________________________ >> Phplib-users mailing list >> Php...@li... >> https://lists.sourceforge.net/lists/listinfo/phplib-users >> >> > >-- > 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 > > >_______________________________________________ >Phplib-users mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phplib-users > |