pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Paul Lindner <lindner@inuus.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Prepared Statements vs. pgbouncer
Date: Sat, 29 Sep 2007 20:43:33 +1200
Message-ID: <46FE1035.8050801@opencloud.com> (raw)
In-Reply-To: <20070929072159.GI3140@inuus.com>
References: <20070929002513.GG3140@inuus.com>
	<46FDA4F2.8080507@opencloud.com>
	<20070929021522.GH3140@inuus.com>
	<24584.1191033096@sss.pgh.pa.us>
	<20070929072159.GI3140@inuus.com>

Paul Lindner wrote:

>  * 100s of application servers using Torque and DBCP
>  * Dozens of databases.
>  * All app servers can connect to all databases.
>  * Each application server may need many connections to an individual
>    database.
>  * App code as written will spawn multiple concurrent SELECTs to
>    a single database to speed up queries on partitioned tables.

I'm assuming there is some reason why you can't run the same apps on 
fewer appservers and share the pools. The basic problem here is that you 
can't get a good global view of which connections are idle because you 
have a lot of separate appservers each doing their own thing.

>   3. Use pgbouncer to allow 6k connections while actually
>      lowering the number of DB backends, plus giving us some very cool
>      maintenance features like redirecting connections to other hosts
>      and more.
> 
> So we we're trying to implement #3.

That is a reasonable approach to take, that's essentially giving you a 
global connection pool. However..

> The only thing holding us back from deploying the pgbouncer solution
> is this issue with the server-side prepared statements.  

This is a really an issue with pgbouncer's incomplete implementation of 
the protocol.

If you were going to change the driver the best place to do it is in the 
V3 protocol code itself -- tell it not to use named statements at all. 
The higher layers in the driver are working to a different API that 
doesn't know anything about named statements at all, it just provides 
hints about whether a query is likely to be re-used or not. So trying to 
repair particular instances of that so they don't used named statements 
is going to be fairly error-prone.

I don't see that sort of change going into the official driver though .. 
as Tom says, why would we deliberately cripple use of the protocol 
because a 3rd party piece of software can't handle the full protocol? So 
I think you are going to be stuck with either deploying a customized 
JDBC driver for your particular environment, or fixing pgbouncer so that 
it properly implements the protocol.

-O



view thread (48+ messages)  latest in thread

Message-ID: <46FE1035.8050801@opencloud.com>
Permalink:  ../46FE1035.8050801@opencloud.com/
Also on:    postgresql.org/message-id/46FE1035.8050801@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, lindner@inuus.com, tgl@sss.pgh.pa.us
  Subject: Re: Prepared Statements vs. pgbouncer
  In-Reply-To: <46FE1035.8050801@opencloud.com>
  References: <20070929002513.GG3140@inuus.com> <46FDA4F2.8080507@opencloud.com> <20070929021522.GH3140@inuus.com> <24584.1191033096@sss.pgh.pa.us> <20070929072159.GI3140@inuus.com> <46FE1035.8050801@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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