FreeBSD 6.1 Performance Tuning

Just a note for myself to tune FreeBSD OS for better performance.

Every partition of the disk will required different usage. For example webserver needs a lot reading and database needs read and write. Beside that, /var is a place to keep logs/transactions/mail and etc, require a lot of read and write too. It will be better if every disk partition for its own needs. Usually I do;
2G – /swap
2G – /var
5G – /www
10G – /db
5G – /usr
10G – /
the rest of the disk – /home

Size of a disk partition is depend on your own needs.

Syscontrol – sysctl

net.inet.tcp.sendspace/net.inet.tcp.recvspace – Tune this if you are running heavy traffic web server. Its control the send/receive buffer space for any TCP connection.

kern.ipc.somaxconn – Default somaxconn is 128, it’s not suitable running on heavy webserver, increase it to higher value cater your needs. Mine default is always set to 1024.

kern.maxfiles – If you running large database server, increase of kern.maxfiles will enhance your database server performance. Use kern.openfiles to determine current openfiles value on server.