Re: PostgreSQL 9.0 x64 bit pgbench TPC very low question? - Mailing list pgsql-performance

From Kenneth Marshall
Subject Re: PostgreSQL 9.0 x64 bit pgbench TPC very low question?
Date
Msg-id 20101223144628.GL10252@aart.is.rice.edu
Whole thread Raw
In response to Re: PostgreSQL 9.0 x64 bit pgbench TPC very low question?  (tuanhoanganh <hatuan05@gmail.com>)
List pgsql-performance
On Thu, Dec 23, 2010 at 09:20:59PM +0700, tuanhoanganh wrote:
> Could you show me what parameter of pgbouncer.ini can do that. I read
> pgbouncer and can not make pgbouncer open and keep 200 connect to postgres
> (Sorry for my English)
>
> Thanks you very much.
>
> Tuan Hoang ANh
>

You need to use session pooling for that to work. From the man page:

       In order not to compromise transaction semantics for connection
       pooling, pgbouncer supports several types of pooling when
       rotating connections:

       Session pooling
           Most polite method. When client connects, a server connection
           will be assigned to it for the whole duration the client
           stays connected. When the client disconnects, the server
           connection will be put back into the pool. This is the
           default method.

       Transaction pooling
           A server connection is assigned to client only during a
           transaction. When PgBouncer notices that transaction is over,
           the server connection will be put back into the pool.

       Statement pooling
           Most aggressive method. The server connection will be put back
           into pool immediately after a query completes. Multi-statement
           transactions are disallowed in this mode as they would break.


The fact that pgbouncer will not keep 200 connections open to
the database means that you do not have enough work to actually
keep 200 permanent connections busy. It is much more efficient
to use transaction pooling. You typically want the number of
persistent database connections to be a small multiple of the
number of CPUs (cores) on your system. Then set pgbouncer to
allow as many client connections as you need. This will give
you the best throughput and pgbouncer can setup and tear down
the connections to your clients much, much faster than making
a full connection to the PostgreSQL database.

Regards,
Ken

pgsql-performance by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: PostgreSQL 9.0 x64 bit pgbench TPC very low question?
Next
From: tuanhoanganh
Date:
Subject: Re: PostgreSQL 9.0 x64 bit pgbench TPC very low question?