• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Change Kernel Semaphore Limits in CentOS/RHEL

By admin

The post explains how kernel semaphore limits can be changed in a CentOS/RHEL server.

Kernel Parameters to set semaphore limits

The kernel parameters to set the semaphore limits are:

kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
SEMMSL - max semaphores per array
SEMMNS - max semaphores system wide
SEMOPM - max ops per semop call
SEMMNI - max number of arrays

Changing Semaphore Limits

If a limit needs to be changed there should be taken in to account that (max number of arrays)*(max semaphores per array) >= (max semaphores system-wide). No need to have more semaphores system-wide if limited by the amount of a possible number of arrays with max semaphores per it.

For example:

# sysctl -a| grep kernel.sem
kernel.sem = 250 32000 32 128

For this example, we need to increase max semaphores per array limit from 128 to 192. The max semaphores system-wide can be also increased to 48000 ( 250*192 = 48000 >= 32000) or kept as 32000. In this scenario, it is kept at 32000.

To set kernel parameter dynamically i.e. without the need for server reboot.

# sysctl -w kernel.sem="250 32000 32 192"
kernel.sem = 250 32000 32 192

If all is fine with the system as expected, modify kernel parameter by adding it to the /etc/sysctl.conf file to ensure the value persist after server reboot.

# cat /etc/sysctl.conf | grep kernel.sem
kernel.sem = 250 32000 32 192

If you choose to set it directly in the file without using the sysctl -w, you’ll need to reload the file:

# sysctl -p

You can verify limits currently set by:

# ipcs -ls
------ Semaphore Limits --------
max number of arrays = 192
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

A semaphore is like a counter used to control access to shared resources by multiple processes. It is often used as a locking mechanism to prevent processes from accessing a particular resource while another process is performing operations on it. Semaphore value can be incremented or decremented until maximum set by variable SEMVMX, “semaphore max value”.

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to find free space in a Volume Group in LVM
  2. “530 Non-anonymous sessions must use encryption” – while using curl
  3. “-bash: firewall: command not found” – How to resolve in CentOS/RHEL 7
  4. CentOS / RHEL 5 : How to disable device mapper multipath (dm-multipath)
  5. How to Reset Root Password in CentOS/RHEL 8
  6. How to Delete the Files Which are Older Than n Days WITHOUT Using find Command
  7. What is HBA Queue Depth and How to Check the Current Queue Depth Value and how to Change it
  8. Running repairs on XFS Filesystems
  9. Configuring sudo to Enable Commands for Non-Root Users in Linux
  10. Installing CentOS / RHEL 7 (step by step with screen shots)

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ACPI in CentOS/RHEL 7
  • How to Use real-time query to access data on a physical standby database
  • CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  • How to Create a Physical Standby Database by Using SQL and RMAN Commands
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary