Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 8928C633038 for ; Thu, 17 Jun 2010 08:13:46 -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 45292-07 for ; Thu, 17 Jun 2010 11:13:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 26.mail-out.ovh.net (26.mail-out.ovh.net [91.121.27.225]) by mail.postgresql.org (Postfix) with SMTP id 09619632FD5 for ; Thu, 17 Jun 2010 08:13:38 -0300 (ADT) Received: (qmail 16620 invoked by uid 503); 17 Jun 2010 11:20:11 -0000 Received: from b7.ovh.net (HELO mail407.ha.ovh.net) (213.186.33.57) by 26.mail-out.ovh.net with SMTP; 17 Jun 2010 11:20:10 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 17 Jun 2010 13:13:37 +0200 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13) (lists%peufeu.com@88.161.102.87) by ns0.ovh.net with SMTP; 17 Jun 2010 13:13:36 +0200 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Matthew Wakeling" , "Balkrishna Sharma" Cc: pgsql-performance@postgresql.org Subject: Re: Parallel queries for a web-application |performance testing References: Date: Thu, 17 Jun 2010 13:12:22 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Pierre C" Message-ID: In-Reply-To: User-Agent: Opera Mail/10.10 (Linux) X-Ovh-Tracer-Id: 243194380550866629 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-10 required=5 tests=BAYES_50=0.8 X-Spam-Level: X-Archive-Number: 201006/308 X-Sequence-Number: 39164 > When you set up a server that has high throughput requirements, the last > thing you want to do is use it in a manner that cripples its throughput. > Don't try and have 1000 parallel Postgres backends - it will process > those queries slower than the optimal setup. You should aim to have > approximately ((2 * cpu core count) + effective spindle count) number of > backends, as that is the point at which throughput is the greatest. You > can use pgbouncer to achieve this. The same is true of a web server : 1000 active php interpreters (each eating several megabytes or more) are not ideal for performance ! For php, I like lighttpd with php-fastcgi : the webserver proxies requests to a small pool of php processes, which are only busy while generating the page. Once the page is generated the webserver handles all (slow) IO to the client. An interesting side effect is that the number of database connections is limited to the number of PHP processes in the pool, so you don't even need a postgres connection pooler (unless you have lots of php boxes)...