pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
connection pool
4+ messages / 3 participants
[nested] [flat]

* connection pool
@ 2006-07-31 19:48 Peter Hofer <peter.hofer@ics.at>
  2006-08-01 07:29 ` Re: connection pool Hervé Piedvache <herve@elma.fr>
  2006-08-01 13:45 ` Re: connection pool Robert Treat <xzilla@users.sourceforge.net>
  0 siblings, 2 replies; 4+ messages in thread

From: Peter Hofer @ 2006-07-31 19:48 UTC (permalink / raw)
  To: pgsql-php

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

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

How can I build up a Pool of Connections ? 

What about "Pgpool" ? 

Thanks 















^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: connection pool
  2006-07-31 19:48 connection pool Peter Hofer <peter.hofer@ics.at>
@ 2006-08-01 07:29 ` Hervé Piedvache <herve@elma.fr>
  2006-08-01 09:46   ` Re: connection pool Peter Hofer <peter.hofer@ics.at>
  1 sibling, 1 reply; 4+ messages in thread

From: Hervé Piedvache @ 2006-08-01 07:29 UTC (permalink / raw)
  To: pgsql-php; peter.hofer@ics.at

Hi,

I had the same trouble 6 years ago with my beginning of Postgresql ...

4 web and 1 db ...

Just put a limitation in the php.ini

; Maximum number of persistent links.  -1 means no limit.
pgsql.max_persistent = 18

; Maximum number of links (persistent+non persistent).  -1 means no limit.
pgsql.max_links = 18

It'll run perfectly ... for me it's like that since 6 years ... and I have 
thousand of visitor each day on my services :o)

Regards,

Le lundi 31 juillet 2006 21:48, Peter Hofer a écrit :
> 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
>
> - if I run with no persisent connection i got massive forking of postgres
>   (but less problems)
>
> How can I build up a Pool of Connections ?
>
> What about "Pgpool" ?
>
> Thanks
>
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

-- 
Hervé Piedvache

NOUVELLE ADRESSE - NEW ADDRESS :
Elma Ingénierie Informatique
3 rue d'Uzès
F-75002 - Paris - France
Pho. 33-144949901
Fax. 33-144882747



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: connection pool
  2006-07-31 19:48 connection pool Peter Hofer <peter.hofer@ics.at>
  2006-08-01 07:29 ` Re: connection pool Hervé Piedvache <herve@elma.fr>
@ 2006-08-01 09:46   ` Peter Hofer <peter.hofer@ics.at>
  0 siblings, 0 replies; 4+ messages in thread

From: Peter Hofer @ 2006-08-01 09:46 UTC (permalink / raw)
  To: 'Hervé Piedvache' <herve@elma.fr>; pgsql-php

Hy 

Thanks for your answer 

As far as i know " pgsql.max_persistent " limits the no on 
Persistent Connections per apache client - and not for all 
Apaches - so I set it "pgsql.max_persistent = 1" since we 
Connect to the same DB all the time 

Currently we got 2 Servers runnung with persistent Connection, 
and 2 Server with non-persitent connections 

Right now i have 359 progres running, 345 are idle. 

If I set the other servers to persistent connections, too, I will have 
About 700 progres running - 95% on idle 
They all take memory ... 

I will have to expand up to 10 and more WebServers in near future 
Therefore persistent-Connection (because of the memory amount to handle 1500
Connection) nor 
Non-persistent-Connection (because of forking ) is a suitable way 

What I think about, is a maschine getting all the Connections from the
Apache, and 
Forward only those to the DB whitch are not idle 

Any idea ? 

Thanks 

Peter 

> -----Ursprüngliche Nachricht-----
> Von: pgsql-php-owner@postgresql.org 
> [mailto:pgsql-php-owner@postgresql.org] Im Auftrag von Hervé Piedvache
> Gesendet: Dienstag, 01. August 2006 09:29
> An: pgsql-php@postgresql.org; peter.hofer@ics.at
> Betreff: Re: [PHP] connection pool
> 
> Hi,
> 
> I had the same trouble 6 years ago with my beginning of Postgresql ...
> 
> 4 web and 1 db ...
> 
> Just put a limitation in the php.ini
> 
> ; Maximum number of persistent links.  -1 means no limit.
> pgsql.max_persistent = 18
> 
> ; Maximum number of links (persistent+non persistent).  -1 
> means no limit.
> pgsql.max_links = 18
> 
> It'll run perfectly ... for me it's like that since 6 years 
> ... and I have thousand of visitor each day on my services :o)
> 
> Regards,
> 
> Le lundi 31 juillet 2006 21:48, Peter Hofer a écrit :
> > 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
> >
> > - if I run with no persisent connection i got massive 
> forking of postgres
> >   (but less problems)
> >
> > How can I build up a Pool of Connections ?
> >
> > What about "Pgpool" ?
> >
> > Thanks
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------(end of 
> > broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> 
> --
> Hervé Piedvache
> 
> NOUVELLE ADRESSE - NEW ADDRESS :
> Elma Ingénierie Informatique
> 3 rue d'Uzès
> F-75002 - Paris - France
> Pho. 33-144949901
> Fax. 33-144882747
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: connection pool
  2006-07-31 19:48 connection pool Peter Hofer <peter.hofer@ics.at>
@ 2006-08-01 13:45 ` Robert Treat <xzilla@users.sourceforge.net>
  1 sibling, 0 replies; 4+ messages in thread

From: Robert Treat @ 2006-08-01 13:45 UTC (permalink / raw)
  To: pgsql-php; peter.hofer@ics.at

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-08-01 13:45 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-31 19:48 connection pool Peter Hofer <peter.hofer@ics.at>
2006-08-01 07:29 ` Hervé Piedvache <herve@elma.fr>
2006-08-01 09:46   ` Peter Hofer <peter.hofer@ics.at>
2006-08-01 13:45 ` Robert Treat <xzilla@users.sourceforge.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox