Setting the Kernel Parameters

You need to modify the Linux kernel if the Relay Server controls more than the default number of 256 concurrent users. You must increase the ServerLimit and MaxClient values in the Apache conf/httpd.conf file before you set the kernel parameters. You can also modify other kernel values.

Modify kernel:

  1. To display the current values of the semaphore kernel parameters, use:
    cat /proc/sys/kernel/sem
    250 32000 32 4096
    The four values displayed are:
    • SEMMSL – maximum number of semaphores per set or array.

    • SEMMNS – maximum number of semaphores system–wide. This values is determined by Maximum Number of Arrays * Maximum Semaphores/array.

    • SEMOPM – maximum number of operations allowed for one semop call.

    • SEMMNI – maximum number of semaphore identifiers (sets).

  2. Open the /etc/sysctl.conf file to edit.
  3. Update the /etc/sysctl.conf file:
    1. You can modify the semaphore value, based on your system configuration, for example: kernel.sem = 250 160000 32 640.
      Examples for increasing the number of "semaphore sets" (semmni) in the system:
      • Example 1 – Increasing semaphore sets to 10 times the current number of existing sets in the system. Note that the second number in the group should ALWAYS be equal to the multiplication of the first number by the last number (max semaphores per array) * ((max number of arrays) * 10 times), for example, 250*1280 = 320000. You would enter this semaphore value in the sysctl.conf file:
        kernel.sem = 250 320000 32 1280
      • Example 2 – Assume the Apache Web server is configured with 500 worker processes and the Relay Server has 3 backend servers configured. The total number of semaphore sets needed is 500 + (4*3) = 512. Assume that 128 was the default number of semaphore sets in the system, then the new total number of semaphore sets is 128 + 512 = 640. Assume that 250 was the default number of semaphores per array, then new total number of semaphores system wide is 250 * 640 = 160000. You would enter this semaphore value in the sysctl.conf file:
        kernel.sem = 250 160000 32 640
    2. You may also want to configure additional kernel values on the Linux machine. Following are sample maximum limits:
      ------ Shared Memory Limits --------
      max number of segments = 4096
      max seg size (kbytes) = 4194303
      max total shared memory (kbytes) = 1073741824
      min seg size (bytes) = 1
      
      ------ Semaphore Limits --------
      max number of arrays = 640
      max semaphores per array = 250
      max semaphores system wide = 160000
      max ops per semop call = 32
      semaphore max value = 32767
      
      ------ Messages: Limits --------
      max queues system wide = 16
      max size of message (bytes) = 65536
      default max size of queue (bytes) = 65536
      
  4. Save the file and reboot the machine.
  5. Run sysctl with -p parameter to load in sysctl settings from the default file /etc/sysctl.conf.
    sysctl -p

    The entries from the sysctl.conf file are read during startup by the network initialization script. On some distributions you may be required to add sysctl -p in one of the system initialization files (for example, rc.local) so that kernel parameters are set after each reboot.