community.borland.com

Article #25642: Semaphore utilization on classic versions of InterBase for SCO

Problem:
This applies to all "Classic" - InterBase 4.0 Unix versions and InterBase 5.X for SCO and Linux.

Most classic (one server per connection) versions of InterBase, 
use semaphores to communicate between server processes.  

Listed below is information on which tunable
parameters should be adjusted to properly setup semaphores.

The tunable parameter names are taken from a SCO Unix machine.  Other unix variants
will have different names for the same parameters.

Solution:
Semaphore tuning suggestions for SCO Unix to support 256
concurrent users.

Basic premise:
A. Semaphores are assigned in blocks.

B. Each connection requires 1 semaphore in order to do event notification.  

   Other operations and the lock manager may also consume a small number of
   semaphores. This number varies depending on the requests made by users.

   As a general rule the kernel must be configured for a number
   of semaphores equal to the number of users + an overhead of 32 (as a start).

   For 256 users this creates a requirement for 288 semaphores as a starting figure.
   
   The request for total semaphore count should be made as a multiple number of 
   semaphore blocks.  Assuming that SEMMSL = 32, 288 is already a multiple of 32.


C. Semaphore undo structures are requested whenever a semaphore value changes for
   the duration of the change.  Therefore it is not necessary to assign an undo
   structure for each semaphore.  A conservative number of undo stuructures is
   1/2 of the number of semaphores requested (144 in this case).


Suggested tuning for 256 concurrent users requires:

#pg /usr/interbase/isc_config
#V4_LOCK_MEM_SIZE       8388608
#ANY_LOCK_MEM_SIZE      8388608
#V4_LOCK_SEM_COUNT      224      <---  Change to 288 (Note: must remove "#" )
#ANY_LOCK_SEM_COUNT     224
#V4_LOCK_SIGNAL         16
#ANY_LOCK_SIGNAL        16
#V4_EVENT_MEM_SIZE      32768
#ANY_EVENT_MEM_SIZE     32768

Unix Tunable Semaphore Parameters (an example)
----------------------------------------------------------------------
SEMMAP = 257      <--- This should be changed to 257 (One control map entry per semaphore user)
SEMMNI  = 288      <--- This should be changed to 288 (max number of semaphore sets)
SEMMNU = 144     <--- This should be changed to  144 (max number of simultaneous lock changes)
SEMMSL = 32        <--- This should be changed to 32 (number of semaphores per structure)
SEMOPM = 10       <---  The default value is OK  (the number of semaphore operations per semop)
SEMUME = 10       <---  The default value is OK  (number of undo structures per proscess)
SEMVMX = 32767 <---  The default value is OK  (maximum value stored in a semaphore)
SEMAEM = 16384 <---  The default value is OK  (the maximum adjusted value of a semaphore)
SEMMNS = 288     <---  This can be set  to 288 for InterBase  (total number of semaphores)
XSEMMAX = 60      <---  The default value is OK (maximum number of Xenix semaphores)
-------------------

Last Modified: 27-OCT-00