[ic] Maximum CPU usage

Jon Jensen interchange-users@interchange.redhat.com
Sat Nov 17 09:46:01 2001


On Sat, 17 Nov 2001, FCT Maillist wrote:

> I am using IC 4.8.1 on Linux 7.0 with a PostGreSQL database. But on being
> accessed by only 3-4 users , the system becomes slow and the CPU usage
> clocks 99% usage. The catalogs built for each user occupies maximum server
> resources.
>
> How do we overcoemn this isuue? Has anyone experienced similar problems? Any
> way out?

What version of PostgreSQL are you running? (Do 'psql --version'.) If it's
anything earlier than 7.1, you definitely need to upgrade. Major
improvements were made between PostgreSQL 7.0 and 7.1, to say nothing of
the improvements since 6.5.

Anyway, the most generally useful thing to do is to enable query logging
in the PostgreSQL daemon and find out what's taking so much time. To do
that, you pass option "-d 2" to the postmaster and send its stdout to a
file instead of to /dev/null like most postmaster startup scripts do.
Here's how I did it with PostgreSQL 7.1.2 on Red Hat Linux 7.1. Make this
patch to /etc/rc.d/init.d/postgresql:

142c142
<               su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl  -D $PGDATA -p /usr/bin/postmaster start  > /dev/null 2>&1" < /dev/null
---
>               su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl  -D $PGDATA -o '-d 2' -p /usr/bin/postmaster start  > /var/log/pgsql 2>&1" < /dev/null

Then do 'tail -f /var/log/pgsql' and watch the output while you visit
various pages on your site. You should be able to get an idea of what's
taking so much time.

Jon