October 30, 2005

Optimization guide for linux web/db servers

Anonymous Reader writes "This article should help a Linux system administrator with optimizing a server for Web/Database usage. This article will be usefull for any type of server as it has some general tweaks listed, however the article is geared towards MySQL and Apache 2.*

Kernel tweaking

/etc/sysctl.conf is used to modify kernel parameters at runtime. The parameters
available are those listed under /proc/sys/

The lines below are some nice tweaks you can use for a heavy loaded server. To add them edit your /etc/sysctl.conf file

kernel.sem = 100 32000 100 100
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.shmmax = 2147483648
fs.file-max = 65536

To see your current values type the following:

sysctl -a |egrep "shmmax|shmall|shmmni|sem|file-max"

Semaphores (kernel.sem)

defines the Semaphores values. Semaphores are counters which are used to provide synchronization between processes or between threads within a process for shared resources like shared memories. System V semaphores support semaphore sets where each one is a counting semaphore. So when an application requests semaphores, the kernel releases them in "sets". kernel.sem as you can see above has 4 values. The four values represent: SEMMSL, SEMMNI, SEMMNS and SEMOPM.
defines the maximum number of semaphores per semaphore set

SEMMNI defines the maximum number of semaphore sets in the entire Linux system.

SEMMNS defines the total number of semaphores (not semaphore set) in the entire Linux system. A semaphore set can have more than one semaphore, and according to the semget(2) man page, values greater than SEMMSL * SEMMNI makes it irrelevant.

defines the maximum number of semaphore operations that can be performed per semop(2) system call.

Full article can be read at http://linuxgangster.org/modules.php?name=Content& file=viewarticle&id=8"

Link: linuxgangster.org

Click Here!