Re: What is the Best Postgresql Load Balancing Solution - Mailing list pgsql-general

From Scott Marlowe
Subject Re: What is the Best Postgresql Load Balancing Solution
Date
Msg-id 1159384012.26848.114.camel@state.g2switchworks.com
Whole thread Raw
In response to Re: What is the Best Postgresql Load Balancing Solution available ?  (Najib Abi Fadel <nabifadel@yahoo.com>)
List pgsql-general
On Wed, 2006-09-27 at 00:22, Najib Abi Fadel wrote:
> What is the problem with pg_pconnect and is pgpool easy to use with an
> already running application ?
> Should i expect a major performance boost ?

pg_pconnect isn't "pooling" per se.  In pooling, a large number of
processes share a small number of connections.  I.e. 200 php processes
would access the database by sharing 20 or 30 connections per database
accessed.  So, if you had 3 databases, each would have 20 or so
connections to it, and the 200 odd php processes would have to wait for
a free connection or would error out depending on how pooling was set
up.  Note that php doesn't directly support this type of pooling, like
jdbc does.

pg_pconnect creates a persistent connection for each database accessed
by each process.  So, if you had the same three databases and 200 php
processes that all, at one time or another, hit each of those databases,
your database would need to manage 600 connections.

This makes it very easy to DOS your database server with too many
connections.

Pgpool is VERY easy to use, and gets rid of most of the overhead of
starting a connection (backend process creation) by holding open x
number of connections for you all the time.  Therefore, the real cost of
pg_connect over pg_pconnect goes away, and you can simply use pg_connect
to the pgpool process.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Strange query results with invalid multibyte
Next
From: Tom Lane
Date:
Subject: Re: cannt setup postgresql database for my opennms