Re: What is the Best Postgresql Load Balancing Solution

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: Najib Abi Fadel <nabifadel(at)yahoo(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, nikolay(at)samokhvalov(dot)com, pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: What is the Best Postgresql Load Balancing Solution
Date: 2006-09-27 19:06:52
Message-ID: 1159384012.26848.114.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-09-27 19:11:09 Re: cannt setup postgresql database for my opennms
Previous Message Tom Lane 2006-09-27 18:58:02 Re: Strange query results with invalid multibyte