Thursday, July 8, 2010

Managing Semaphores Limits in Unix

Hello Guys,

We might have seen semaphores, siteminder (LLAWP) process issues while working on apache webserver, some time we will end up in restarting the server number of times but the application wont be working properly, while troubleshooting this issue, if you find out that we are having overloading semaphores and LLAWP process is behaving weird. And as a next process if you wish to clear out the semaphores, you may end up clearing out the semaphores of other webserver instance if any existing on the machine. If none you can safely clear the semaphores with the help of following commands

Give the details of existing semaphores
$ipcs –s

To remove the semaphores pass the semaphore id as an option to following command

$ipcrm

There is one more thing you need to look into if this doesn't work or help is the limit your operating system enforce on creation of semaphores and shared memory segments.

To view the limits of these semaphores creating we have file called sem in the operating system kernal path as below.

#cat /proc/sys/kernel/sem
    250 512000 32 1024

These numbers shows :

SEMMSL - The maximum number of semaphores in a sempahore set
SEMMNS - The maximum number of sempahores in the system
SEMOPM - The maximum number of operations in a single semop call
SEMMNI - The maximum number of sempahore sets

This may happen that because of these limitations we are unable get the semaphores created for the server and the site requests are not serving properly.

so if you would like to increase the values, there may be 2 ways for this.

1. You can directly echo the values to the file.

#echo >/proc/sys/kernel/semmsl

2. Edit the Kernal parameters with sysctl command

#sysctl -w "kernel.sem=250 512000 32 1024"

Verify this with

#cat /proc/sys/kernel/sem


or

#sysctl -A
#grep kernel.sem

Any Comments ?

Thanks
Shailesh Dyade

No comments: