semaphores_used
OS: Linux
This alert presents the percentage of allocated System V IPC semaphores
.
If you receive this alert, it means that your system is experiencing high IPC semaphore
utilization and a lack of available semaphores
can affect application performance.
What is an "IPC Semaphore"
IPC
stands for Interprocess Communication
. IPC messages are a counterpart to UNIX pipes for IPC operations.
The fastest way to communicate through processes is with shared memory. semaphores
, help synchronise shared memory access across processes. 1
As illustrated by E. W. Dijkstra, semaphores can be better understood using his railroad model 2 .
-
Imagine a railroad, where only a single train at a time is allowed to pass. Responsible for the traffic is a
semaphore
. Each train that wants to enter the single track must wait for thesemaphore
to be in a state that allows access to the railroad. When a train enters the track, thesemaphore
changes the state to prevent all other traffic in the track. When the train leaves the railroad, it must change the state of thesemaphore
to allow another train to enter. -
In the computer world, a
semaphore
is an integer and the train is a process (or a thread). For a process to proceed, it has to wait for the semaphore’s value to become 0. If it proceeds, it increments this value by 1. Upon finishing the task, the process decrements the same value by 1.
semaphores
let processes query or alter status information. They are often used to monitor and control the availability of system resources such as shared memory segments. 2
References and Sources
Troubleshooting Section
Adjust the semaphore limit on your system
You can check current semaphore
limit on your machine, by running:
root@netdata~ # ipcs -ls
The output will be similar to this:
------ Semaphore Limits --------
max number of arrays = 32000
max semaphores per array = 32000
max semaphores system wide = 1024000000
max ops per semop call = 500
semaphore max value = 32767
To adjust the limit of the max semaphores,you can go to the /proc/sys/kernel/sem
file and adjust the second field accordingly.