From owner-freebsd-isp Fri Oct 12 13:52:28 2001 Delivered-To: freebsd-isp@freebsd.org Received: from indigo.quadrant.net (indigo.quadrant.net [207.195.92.9]) by hub.freebsd.org (Postfix) with ESMTP id 8EAC037B40A for ; Fri, 12 Oct 2001 13:52:24 -0700 (PDT) Received: from git2000 (h24-71-180-125.ss.shawcable.net [24.71.180.125]) by indigo.quadrant.net (8.9.1/8.9.1) with SMTP id OAA20369; Fri, 12 Oct 2001 14:51:40 -0600 (CST) From: "Scott Gerhardt" To: "Marcel Prisi" Cc: Subject: RE: PostgreSQL & shared memory Date: Fri, 12 Oct 2001 15:02:05 -0600 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 In-Reply-To: <20011012130959.C97952@rand.tgd.net> Importance: Normal Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org > > We just published a new website running on FreeBSD 4.4 > prerelease 10 august > > / apache 1.3.20 / php 4.0.6 / PostgreSQL 7.1.2 . > > > > In fact we moved the site from a Win2k/iis/sqlserver to BSD, > and we have a > > HUGE amount of hits, and the machine is already getting overloaded. > > PostgreSQL seems like a ressource hog. The machine is a > bi-PIII 866Mhz, > > 380Mb RAM, Adaptec 2100s. > > > > I had to stop using both keepalive in apache and persistent > connections in > > php in order to keep the machine from swapping and not > responding anymore. > > The load is extremely high as some SQL queries are really hard ... > > > > The first thing we'll do is install some more memory, and > then a separate > > machine for PostgreSQL. > > Whew, I was going to bing you with a clue bat if you didn't suggest > getting more RAM: 380MB of RAM isn't much. All this aside, what you > want to do is setup a reverse proxy server. You have these HUGE Apache > and postgresql processes sitting around in RAM spending most of their > time doing what? Writing their data out over the wire. The best thing > you can do to speed up your webapp is to increase your kernel output > buffers and/or use a reverse proxy (mod_backhand, mod_proxy, or even > squid). Would you like to have a large 12-20MB process > sending data out > over the wire, or a small 400KB process that's mostly shared > memory? -sc > You didn't give details of how your system is overloaded i.e. disk IO, memory, slow response times etc. Here are a few suggestions I can think of: 1.) Yes, add much more RAM, as Sean mentioned. RAM is cheap so max it out if you can, that will make a huge difference. 2.) Make sure that your PostgreSQL tables are indexed and your queries are optimized. Poor querys and non indexed tables design can make things crawl. 3.) See about tweaking Apache's logging to minimize open file handles and disk IO. 4.) Enable soft updates if you are comforable with soft updates. _________________________________ Scott Gerhardt, P.Geo. Gerhardt Information Technologies _________________________________ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message