Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 103649FA2F1 for ; Mon, 1 Oct 2007 15:40:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 56154-05 for ; Mon, 1 Oct 2007 15:39:55 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by postgresql.org (Postfix) with ESMTP id C37499FA2D5 for ; Mon, 1 Oct 2007 15:40:07 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id j3so2049023ugf for ; Mon, 01 Oct 2007 11:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=bHA823pfz/XKQ1lrDINFBxJPrTqUcUwEgy+bEezTsp4=; b=PXZL7KAveP+76BPNW1SiyV1kc8PEbkc2l9AN4V4VcaCsbZePaKYn/uiJ17FC1ldZQJ2EqoTzW7gjJOLgk7GbFJPIVCpQog2sF0m+02s4d6Z8LMzX1hqIWRMmgGLQ0+fjShI8ilyk7YVcar9/fshu3fX8wRS//DhjAj16bM7e37U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=LpF01JMPzigFSTX50U7z9nKhN0KQv+NBBMkOso41SnOfI/3xowfvjACBfWp1vAUpmARlGAmSKI52ZVfZGqRPmv+EMzDLaX9OBMhRyQzL55stg7S8mYSVFit2Tf/smBrcGu3j3DbQoEf2ZkOmOFZYagTtAZAsjmQ79btF+Cbm16o= Received: by 10.67.28.2 with SMTP id f2mr78799ugj.1191264003148; Mon, 01 Oct 2007 11:40:03 -0700 (PDT) Received: from ?192.168.1.33? ( [82.26.64.254]) by mx.google.com with ESMTPS id k2sm5640172ugf.2007.10.01.11.39.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 01 Oct 2007 11:40:01 -0700 (PDT) Message-ID: <47013ECA.1060400@enterprisedb.com> Date: Mon, 01 Oct 2007 19:39:06 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.12 (X11/20070730) MIME-Version: 1.0 To: Josh Berkus CC: lindner@inuus.com, Oliver Jowett , pgsql-jdbc@postgresql.org Subject: Re: Prepared Statements vs. pgbouncer References: <20070929002513.GG3140@inuus.com> <46FDA4F2.8080507@opencloud.com> <20070929021522.GH3140@inuus.com> <24584.1191033096@sss.pgh.pa.us> <20070929072159.GI3140@inuus.com> <46FE3B1A.7020603@agliodbs.com> <46FED7FA.6060309@opencloud.com> <46FFC314.5080205@agliodbs.com> <47000C2E.8030409@opencloud.com> <4700B21C.1000008@enterprisedb.com> <47013A0E.6080607@agliodbs.com> In-Reply-To: <47013A0E.6080607@agliodbs.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/16 X-Sequence-Number: 17588 Josh Berkus wrote: >> You might also consider if using pgbouncer or similar really is >> necessary. Perhaps you could get away with a per-client connection pool, >> with "min pool size" small enough, maybe 0, that the number of >> simultaneous connections to the server would stay reasonable. > > It becomes necessary whenever you have a large number of appservers > connecting to the same database server. Setting min pool size downwards > isn't really effective becuase then you're just adding connection time > delays ... exactly what you're trying to prevent by using a connection > pool. Yeah, I know. I was trying to think of workaround for the OP. With hundreds of app servers it's likely that a pool of 1-2 connections would actually be sufficient. Unless there really is thousands of simultaneous users running queries at the same time, at which point Postgres is going to be sweating even if you manage to multiplex the number of connections to a few hundred. > I'm working on a scalable project myself which is why I'm concerned > about this. The reason why we're planning to rely on pgBouncer is that > we'll have both java and non-java applications connecting to the same > database, and we don't want to manage two different connection/failover > pools. So it's important to us that PG-JDBC function with independant > connection pools. > > So where is it going to be easier to fix this ... pgBouncer, or pg-JDBC? It's clearly pgBouncer here that's braking the protocol, so it's pgBouncer that needs fixing. A workaround in JDBC driver would only help JDBC apps. If you're having non-java applications in the mix, you'd have to implement the workaround in *all* the drivers. BTW: I just stumbled across this Greg Sabine Mullane's blog post, which describes a workaround for DBD::Pg perl module, so we're not alone: http://people.planetpostgresql.org/greg/index.php?/archives/110-Using-DBDPg-with-pg_bouncer.html -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com