Re: connection pool

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: pgsql-php(at)postgresql(dot)org, peter(dot)hofer(at)ics(dot)at
Subject: Re: connection pool
Date: 2006-08-01 13:45:02
Message-ID: 200608010945.02939.xzilla@users.sourceforge.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-php by date

  From Date Subject
Next Message hunkybill 2006-08-02 16:05:45 Problem with columns of type Text and Drupal/Prado/PHP5
Previous Message Peter Hofer 2006-08-01 09:46:43 Re: connection pool