Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 4C735633034 for ; Wed, 28 Jul 2010 19:14:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 84466-04 for ; Wed, 28 Jul 2010 22:14:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vw0-f46.google.com (mail-vw0-f46.google.com [209.85.212.46]) by mail.postgresql.org (Postfix) with ESMTP id 990CC632F02 for ; Wed, 28 Jul 2010 19:14:02 -0300 (ADT) Received: by vws3 with SMTP id 3so4733708vws.19 for ; Wed, 28 Jul 2010 15:14:01 -0700 (PDT) Received: by 10.220.125.4 with SMTP id w4mr6619265vcr.31.1280355240893; Wed, 28 Jul 2010 15:14:00 -0700 (PDT) Received: from Craig-Jamess-MacBook-Pro.local (wsip-70-167-124-126.sd.sd.cox.net [70.167.124.126]) by mx.google.com with ESMTPS id h41sm97091qcz.25.2010.07.28.15.13.59 (version=SSLv3 cipher=RC4-MD5); Wed, 28 Jul 2010 15:14:00 -0700 (PDT) Message-ID: <4C50ABA5.5010408@emolecules.com> Date: Wed, 28 Jul 2010 15:13:57 -0700 From: Craig James User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Connection pooling for a mixture of lightweight and heavyweight jobs? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/211 X-Sequence-Number: 35230 I have a question that may be related to connection pooling. We create a bunch of high-performance lightweight Postgres clients that serve up images (via mod_perl and Apache::DBI). We have roughly ten web sites, with ten mod_perl instances each, so we always have around 100 Postgres backends sitting around all the time waiting. When a lightweight request comes in, it's a single query on an primary key with no joins, so it's very fast. We also have a very heavyweight process (our primary search technology) that can take many seconds, even minutes, to do a search and generate a web page. The lightweight backends are mostly idle, but when a heavyweight search finishes, it causes a burst on the lightweight backends, which must be very fast. (They provide all of the images in the results page.) This mixture seems to make it hard to configure Postgres with the right amount of memory and such. The primary query needs some elbow room to do its work, but the lightweight queries all get the same resources. I figured that having these lightweight Postgres backends sitting around was harmless -- they allocate shared memory and other resources, but they never use them, so what's the harm? But recent discussions about connection pooling seem to suggest otherwise, that merely having 100 backends sitting around might be a problem. Craig