X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 23C2E3A47D4 for ; Thu, 4 Nov 2004 13:10:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49305-02 for ; Thu, 4 Nov 2004 13:10:42 +0000 (GMT) Received: from fep2.cogeco.net (smtp.cogeco.net [216.221.81.25]) by svr1.postgresql.org (Postfix) with ESMTP id 848423A46D5 for ; Thu, 4 Nov 2004 13:10:44 +0000 (GMT) Received: from [127.0.0.1] (d226-34-9.home.cgocable.net [24.226.34.9]) by fep2.cogeco.net (Postfix) with ESMTP id 50FC326FB; Thu, 4 Nov 2004 08:10:44 -0500 (EST) Message-ID: <418A2A4E.6030409@ethereal-realms.org> Date: Thu, 04 Nov 2004 08:10:38 -0500 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matt Clark Cc: pgsql-performance@postgresql.org Subject: Re: Restricting Postgres References: <009701c4c248$6d5298e0$8300a8c0@solent> In-Reply-To: <009701c4c248$6d5298e0$8300a8c0@solent> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/41 X-Sequence-Number: 8995 Matt Clark wrote: >>I have a dual processor system that can support over 150 concurrent >>connections handling normal traffic and load. Now suppose I setup >>Apache to spawn all of it's children instantly, what will > > ... > >>This will spawn 150 children in a short order of time and as >>this takes > > > "Doctor, it hurts when I do this!" > "Well, don't do that then..." > > Sorry, couldn't resist ;-) > > Our Apache/PG driven website also needs to be able to deal with occasional > large peaks, so what we do is: > > StartServers 15 # Don't create too many children initially > MinSpareServers 10 # Always have at least 10 spares lying around > MaxSpareServers 20 # But no more than 20 > MaxClients 150 # Up to 150 - the default 256 is too much for our > RAM > > > So on server restart 15 Apache children are created, then one new child > every second up to a maximum of 150. > > Apache's 'ListenBackLog' is around 500 by default, so there's plenty of > scope for queuing inbound requests while we wait for sufficient children to > be spawned. > > In addition we (as _every_ high load site should) run Squid as an > accelerator, which dramatically increases the number of client connections > that can be handled. Across 2 webservers at peak times we've had 50,000 > concurrently open http & https client connections to Squid, with 150 Apache > children doing the work that squid can't (i.e. all the dynamic stuff), and > PG (on a separate box of course) whipping through nearly 800 mixed selects, > inserts and updates per second - and then had to restart Apache on one of > the servers for a config change... Not a problem :-) > > One little tip - if you run squid on the same machine as apache, and use a > dual-proc box, then because squid is single-threaded it will _never_ take > more than half the CPU - nicely self balancing in a way. > > M > I've heard of the merits of Squid in the use as a reverse proxy. However, well over 99% of my traffic is dynamic, hence why I may be experiencing behavior that people normally do not expect. As I have said before in previous threads, the scripts are completely database driven and at the time the database averaged 65 queries per second under MySQL before a migration, while the webserver was averaging 2 to 4. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org