postgresql on FreeBSD 5.3 and high load

Claus Guttesen cguttesen at
Wed Dec 1 02:51:13 PST 2004


Our postgresql-server hits the wall when we get many
hits on our web. The load-average reaches 70. It
serves 11 webservers.

The server is a Dell PE 2850 with 4 GB RAM, dual
Nocona at 3.2 GHz, HTT is not enabled. It's running
FreeBSD 5.3 stable (amd64-port). Postgresql ver. 7.4.5
from ports. The SCSI-controller is LSILogic MegaRAID
with six disks and three stripes which is mirrored
(RAID 0+1). Only hardware RAID.

Due to problems with 4 GB RAM I added hw.physmem=4G to
/boot/loader.conf, which for some reason reduced
available memory to 3211 MB. Since then it has run

I have this custom-kernel:

options         SHMMAXPGS=262144
options         SEMMNI=160
options         SEMMNS=960
options         SEMUME=160
options         SEMMNU=480
options         PMAP_SHPGPERPROC=1280


max_connections = 768
shared_buffers = 65536
sort_mem = 4096
vacuum_mem = 65536
checkpoint_segments = 4
commit_delay = 100000
commit_siblings = 250
effective_cache_size = 32768

Fsync is *not* enabled. I have increased
shared_buffers and commit_siblings gradually, but it
does not seem to lower the load on the server.


ipcs -M:
 shmmax: 1073741824 (max shared memory segment size)
 shmmin:       1 (min shared memory segment size)
 shmmni:     192 (max number of shared memory
 shmseg:     128 (max shared memory segments per
 shmall:  262144 (max amount of shared memory in

Eventhough load average is high, it's not always 0 %
idle, but between 0 and 2 percent.

netstat -m
18446744073709545011 mbufs in use
4519/25600 mbuf clusters in use (current/max)
0/0/0 sfbufs in use (current/peak/max)
7386 KBytes allocated to network
0 requests for sfbufs denied
0 requests for sfbufs delayed
0 requests for I/O initiated by sendfile
20286 calls to protocol drain routines

I can't find the bottleneck.


More information about the freebsd-performance mailing list