Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id CFFF1632B89 for ; Sat, 24 Jul 2010 02:14:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 23555-08 for ; Sat, 24 Jul 2010 05:14:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.anarazel.de (mail.anarazel.de [217.115.131.40]) by mail.postgresql.org (Postfix) with ESMTP id A2B8C632868 for ; Sat, 24 Jul 2010 02:14:00 -0300 (ADT) Received: by mail.anarazel.de (Postfix, from userid 108) id 940D1448005; Sat, 24 Jul 2010 07:13:57 +0200 (CEST) Received: from anarazel.de (e178195171.adsl.alicedsl.de [85.178.195.171]) by mail.anarazel.de (Postfix) with ESMTPSA id 41EC7448007; Sat, 24 Jul 2010 07:13:50 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id 50C601C00A0; Sat, 24 Jul 2010 07:13:50 +0200 (CEST) Date: Sat, 24 Jul 2010 07:13:50 +0200 From: Andres Freund To: Robert Haas Cc: Hannu Krosing , Craig Ringer , Matthew Wakeling , pgsql-performance@postgresql.org Subject: Re: Pooling in Core WAS: Need help in performance tuning. Message-ID: <20100724051350.GA22197@anarazel.de> References: <4C38BF03.6060503@agliodbs.com> <19244.1278787866@sss.pgh.pa.us> <4C3AF564.5030204@postnewspapers.com.au> <1279826144.14271.5.camel@hvost> <1279900707.26952.4.camel@hvost> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/344 X-Sequence-Number: 39733 On Fri, Jul 23, 2010 at 01:28:53PM -0400, Robert Haas wrote: > On Fri, Jul 23, 2010 at 11:58 AM, Hannu Krosing wrote: > > On Thu, 2010-07-22 at 20:57 -0400, Robert Haas wrote: > >> On Thu, Jul 22, 2010 at 3:15 PM, Hannu Krosing wrote: > >> > On Thu, 2010-07-22 at 14:36 -0400, Robert Haas wrote: > >> >> On Mon, Jul 12, 2010 at 6:58 AM, Craig Ringer > >> >> wrote: > >> >> > So rather than asking "should core have a connection pool" perhaps > >> >> > what's needed is to ask "what can an in-core pool do that an external > >> >> > pool cannot do?" > >> >> > >> >> Avoid sending every connection through an extra hop. > >> > > >> > not really. in-core != magically-in-right-backend-process > >> > >> Well, how about if we arrange it so it IS in the right backend > >> process?  I don't believe magic is required. > > > > Do you have any design in mind, how you can make it so ? > > Well, if we could change the backends so that they could fully > reinitialize themselves (disconnect from a database to which they are > bound, etc.), I don't see why we couldn't use the Apache approach. > There's a danger of memory leaks but that's why Apache has > MaxRequestsPerChild, and it works pretty darn well. Of course, > passing file descriptors would be even nicer (you could pass the > connection off to a child that was already bound to the correct > database, perhaps) but has pointed out more than once, that's not > portable. Its not *that bad* though. To my knowledge its 2 or 3 implementations that one would need to implement to support most if not all platforms. - sendmsg/cmsg/SCM_RIGHTS based implementation (most if not all *nixes including solaris, linux, (free|open|net)bsd, OSX, AIX, HPUX, others) - WSADuplicateSocket (windows) - if needed: STREAMS based stuff (I_SENDFD) (at least solaris, hpux, aix, tru64, irix, unixware allow this) Note that I am still not convinced that its a good idea... Andres