Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Oct 2001 15:02:05 -0600
From:      "Scott Gerhardt" <scott@gerhardt-it.com>
To:        "Marcel Prisi" <marcel-lists@virtua.ch>
Cc:        <freebsd-isp@FreeBSD.ORG>
Subject:   RE: PostgreSQL & shared memory
Message-ID:  <KPEMLBLEMPMHGLJOCDEGAEMNCJAA.scott@gerhardt-it.com>
In-Reply-To: <20011012130959.C97952@rand.tgd.net>

next in thread | previous in thread | raw e-mail | index | archive | help

   > > 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?KPEMLBLEMPMHGLJOCDEGAEMNCJAA.scott>