Re: connection pool - Mailing list pgsql-php

From Robert Treat
Subject Re: connection pool
Date
Msg-id 200608010945.02939.xzilla@users.sourceforge.net
Whole thread Raw
In response to connection pool  ("Peter Hofer" <peter.hofer@ics.at>)
List pgsql-php
On Monday 31 July 2006 15:48, Peter Hofer wrote:
> Hallo
>
> Need your help
>
> 1 got a Site runnig php 4.4.2 and postgresql (8.1.4) and
> Follwing problem
>
> - 4 Server (Apache) up to 300 clients connection to the DB
> - 1 DB machine
>
> So:
>
> - If I run with persisent, i got up to 1200 Connction and I run out
>   of memeory
>

one recommendation would be to set your max # of apache children to something
less than the amount of connections you can handle on postgresql.   for
example, if you can only handle 1000 connections, set the max # of children
per server to say 245 (leave 20 slots for super user connections).

one thing I do wonder about is just how much ram (or how little) you have
available.  istm 1200 connections should not run you out of memory on a
dedicated db machine.

> - if I run with no persisent connection i got massive forking of postgres
>   (but less problems)
>

yeah... I often recommend not using persistent connections in php since they
tend to cause trouble :-)

> How can I build up a Pool of Connections ?
>
> What about "Pgpool" ?
>

RIght... pgpool basically acts as an intermediary, so everything connects to
the pool, which then forwards on requests to the database.  I would think
reducing the number of apache children would work better, but this might be
worth a shot since your mixing pg_connect and pg_pconnect between servers. If
you do please report back your experience to the list :-)

--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

pgsql-php by date:

Previous
From: "Peter Hofer"
Date:
Subject: Re: connection pool
Next
From: hunkybill@gmail.com
Date:
Subject: Problem with columns of type Text and Drupal/Prado/PHP5