Re: pg_pconnect - Really persistent ?

From: Hervé Piedvache <herve(at)elma(dot)fr>
To: Alexey Borzov <borz_off(at)rdw(dot)ru>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: pg_pconnect - Really persistent ?
Date: 2000-12-11 09:46:08
Message-ID: 3A34A260.BB0E1490@elma.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Hi Alexey,

Alexey Borzov a écrit :
>
> Well, there are some problems, indeed.
> 1) PHP counts connections on a per-process basis. So, when you have,
> say, 10 httpd processes, and a limit of 10 connections is set in
> php.ini, you can have total of 100 postgres backends, with a default
> limit of 32.
> 2) PHP does not reuse persistent connections when it can open a new
> one. So set a limit of pconnections to 1 or 2 in php.ini, and
> everything will work as intended.

OK .. I would like more precision of your configuration please, or to
configure my system ...

I do what you said ... but still have trouble with postgresql ... I have
a message like too many files opened in same time ... on the postgresql
server my max limit is 8192 files ... !! So to save my trouble for the
moment the only way I found is to cron a apache graceful each minute !
:(((
Each time the graceful is done it kill all the backends of postgresql
not needed ... then I'm saved !

But I think it's not the good solution so what do I have to limit ?
Apache ? Postgresql ? my limit of pconnection and connection (pconnect
and normal) is now set to 2 in my php.ini file.

For the moment on apache :
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 10
#
StartServers 20
MinSpareServers 64
MaxSpareServers 128
MaxClients 256
MaxRequestsPerChild 0
ThreadsPerChild 256
LimitRequestBody 50240
LimitRequestFields 50
#

I run postgresql with those options :
-B 1024 -S -i -N 256 -o '-F -E -S 1000 -d 1 -s -o
/usr/local/pgsql/data/postgres.log'

I have 2 servers, one for Apache, the other for postgresql the two
servers are identical configuration with 2xPIII 800 SMP, 1Gb of RAM.
My web server have many connections ... and each connection need to
access to the postgresql !

Hope you could give me some help to solve this stupid trouble !! ;)

Regards,

> At 06.12.2000, 14:43, you wrote:
> HP> I have some troubles with the pg_pconnect function ...
>
> HP> All my PHP scripts are using pg_pconnect but apache seems to not using
> HP> the persistent connection ... ?
> HP> I mean that when I make a small script usign a pg_pconnect, and a simple
> HP> select ... I open 2 browsers and call many time my scrip, I look for the
> HP> backends of postgresql and I see many backends opened !
>
> HP> If I try for example to limit the backend to 35, and run an ab (apache
> HP> bench) to call the page ... after the 35 connections opened postgresql
> HP> say there is no more connection possible ... ok ! but why the
> HP> persistents connexions are not re-used ?
>
> --
> Yours, Alexey V. Borzov, Webmaster of RDW

--
Hervé

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Adam Lang 2000-12-11 13:57:33 Re: How to verify PHP has PostgreSQL support?
Previous Message Doug Semig 2000-12-10 03:16:25 Re: How to verify PHP has PostgreSQL support?