X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C87589FA5DC for ; Sat, 3 Jun 2006 06:57:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 46176-07 for ; Sat, 3 Jun 2006 06:57:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id 1D4509FA3A6 for ; Sat, 3 Jun 2006 06:57:29 -0300 (ADT) Received: (qmail 1308 invoked from network); 3 Jun 2006 11:57:51 +0200 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 3 Jun 2006 11:57:51 +0200 Date: Sat, 03 Jun 2006 11:57:50 +0200 To: fzied@planet.tn, pgsql-performance@postgresql.org Subject: Re: scaling up postgres References: <200606030931.k539V38Y007877@smtp2.planet.net.tn> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <200606030931.k539V38Y007877@smtp2.planet.net.tn> User-Agent: Opera M2/8.54 (Linux, build 1745) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/20 X-Sequence-Number: 19377 > One beast will be apache, and the other will be postgres. > I'm using httperf/autobench for measurments and the best result I can get > is that my system can handle a trafiic of almost 1600 New con/sec. > NB : apache when stressed for a static page, i can handle more 16k new > con/sec That's not the point. Here are a few points of advice. USE LIGHTTPD DAMMIT ! If you want performance, that is. On my server (Crap Celeron) it handles about 100 hits/s on static files and 10 hits/s on PHP pages ; CPU utilization is 1-2%, not counting PHP. lighttpd handles 14K static pages/s on my laptop. That's about as much as your bi-xeon does with apache... You want a web server that uses as little CPU as possible so that more CPU is left for generating dynamic content. Also, you want to have a number of concurrent DB connections which is neither too high, nor too low. Apache + mod_php needs to spawn a lot of processes, thus you need a lot of database connections. This tends not to be optimal. Too few concurrent DB connections -> network latency between DB and webserver will be a bottleneck. Too many connections -> excess context switching, suboptimal use of CPU cache, memory use bloat. So, I advise you to use lighttpd fronting PHP as fastcgi (if you use PHP) ; if you use Java or whatever which has a HTTP interface, use lighttpd as a proxy for your dynamic page generation. Spawn a reasonable number of PHP processes. The number depends on your application, but from 10 to 30 is a good starting point. USE PERSISTENT DATABASE CONNECTIONS ! Postgres will breathe a little better ; now, check if it is still slow. If it is, you need to find the bottleneck... I can help you a bit by private email if you want.