Slow Postgresql server

From: Jason Lustig <lustig(at)brandeis(dot)edu>
To: pgsql-performance(at)postgresql(dot)org
Subject: Slow Postgresql server
Date: 2007-04-11 22:02:48
Message-ID: 57271CC2-BCB1-4ACA-A177-4FF64F1BC33F@brandeis.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches pgsql-performance

Hello all,

My website has been having issues with our new Linux/PostgreSQL
server being somewhat slow. I have done tests using Apache Benchmark
and for pages that do not connect to Postgres, the speeds are much
faster (334 requests/second v. 1-2 requests/second), so it seems that
Postgres is what's causing the problem and not Apache. I did some
reserach, and it seems that the bottleneck is in fact the hard
drives! Here's an excerpt from vmstat:

procs -----------memory---------- ---swap-- -----io---- --system--
-----cpu------
r b swpd free buff cache si so bi bo in cs us
sy id wa st
1 1 140 24780 166636 575144 0 0 0 3900 1462 3299 1
4 49 48 0
0 1 140 24780 166636 575144 0 0 0 3828 1455 3391 0
4 48 48 0
1 1 140 24780 166636 575144 0 0 0 2440 960 2033 0
3 48 48 0
0 1 140 24780 166636 575144 0 0 0 2552 1001 2131 0
2 50 49 0
0 1 140 24780 166636 575144 0 0 0 3188 1233 2755 0
3 49 48 0
0 1 140 24780 166636 575144 0 0 0 2048 868 1812 0
2 49 49 0
0 1 140 24780 166636 575144 0 0 0 2720 1094 2386 0
3 49 49 0

As you can see, almost 50% of the CPU is waiting on I/O. This doesn't
seem like it should be happening, however, since we are using a RAID
1 setup (160+160). We have 1GB ram, and have upped shared_buffers to
13000 and work_mem to 8096. What would cause the computer to only use
such a small percentage of the CPU, with more than half of it waiting
on I/O requests?

Thanks a lot
Jason

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2007-04-11 22:07:19 Re: Eliminating unnecessary left joins
Previous Message Jim Nasby 2007-04-11 21:38:59 Re: [PATCHES] Fix for large file support

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-04-11 22:48:23 Re: [HACKERS] Full page writes improvement, code update
Previous Message Jim Nasby 2007-04-11 21:38:59 Re: [PATCHES] Fix for large file support

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-04-12 04:31:28 Re: Question about memory allocations
Previous Message Michael Dengler 2007-04-11 21:47:41 Re: Do I need to rebuild php-pgsql for 8.2.3