![]() SPINLOCKS |
![]() Virtual Machine |
![]() |
Spinlocks are an alternative to the traditional Unix semaphores which are used by PROISAM to synchronise access to the PROISAM shared memory segments and file control blocks. Empirical evidence suggests that on large multiprocessor system, Spinlocks can yield better performance. However, when Unix is running on virtual hardware this may or may not be true depending on the virtualisation method employed.
![]() |
Note: It is not advisable to use Spinlocks on a single processor system. |
For Unix platforms that can support large terminal populations, an alternate, and more efficient, locking mechanism (Spinlocks) for PROISAM can be enabled. Spinlocks can improve overall throughput of a PROIV Function. PROIV is capable of Spinlocks if an ‘S’ is appended to the PROISAM version identifier. You may check the PROISAM version by typing isview -v
To use Spinlocks, all 'pro' processes and iscollect should be killed. Check that the semaphore and shared memory segment for PROIV has been removed, and tune the Spinlocks settings. Spinlocks is then used the next time PROIV is started.
The best settings vary depending on speed of machine, the application in use, number of users and load. As systems get faster, a higher number for SL_SPIN and a lower number for SL_NAP are recommended.
Tuning
To tune, add the parameters SL_SPIN=x, SL_NAP=y, and SL_UNAP=z (where x specifies a spin count, y and z specify nap times) to the etc/isamdef file.
Settings
The best way to set these values is to try different values until the best throughput is achieved. If the machine is very fast, an SL_SPIN value as high as 5000 (or even higher) may be suitable.
In the following, a ‘nap’ is a period of process execution suspension generally less than one second in duration, implemented using a system call that allows millisecond or better granularity.
A ‘sleep’ is a period of process execution suspension implemented using a system call that allows a granularity no better than one second.
Item |
Description |
||
SL_SPIN |
Sets the number of times a PROIV application spins (loops) before napping, while waiting to obtain a lock. |
||
SL_NAP |
Sets the minimum number of milliseconds a PROIV application naps while waiting to obtain a lock. |
||
SL_UNAP |
Sets the number of microseconds a PROIV application naps while waiting to obtain a lock. The SL_UNAP setting was introduced in PROIV Version 6 and higher, for fast machines where a nap time of less than one millisecond is desirable. SL_NAP must set to 0 if using SL_UNAP, as the actual length of each nap is the sum of these two values. The value of SL_UNAP must not be greater than 999 as 1000 would be equivalent to a one in SL_NAP It is not feasible to use SL_UNAP to implement a nap time of less than 1 millisecond on machines that are running both PROIV Version 5.5 and PROIV Version 6. This is because Version 5.5 only uses SL_NAP, but Version 6 aggregates SL_NAP and SL_UNAP. Setting a time of less than one millisecond on Version 6 (i.e. SL_NAP = 0) would cause a nap time of zero on Version 5.
|
||
SL_TIMEOUT
|
Sets the number of times to nap before going to sleep. This should be set to ensure that most file accesses get the required lock before the count expires. As the sleep is measured in seconds, any system that starts to sleep is probably overloaded. |
||
SL_SLEEP |
Sets the number of seconds for the session to sleep before another attempt at getting the file lock is made. This should only happen when the system is heavily overloaded and allows for other sessions to complete their use of the file, or when dead sessions are holding file locks, which are then tidied up by the iscollect utility. |
The suggested values for the settings are as follows:
-
SL_SPIN = 2000
-
SL_NAP = 0
-
SL_UNAP = 500
-
SL_TIMEOUT = 50
-
SL_SLEEP = 1
These values may change with new versions of PROIV, please check with PROIV Support for the latest values.
The File Table section from isview may show file entries with a large TimedOut value at the end of the second line of the file entry. This could indicate that a large number of processes have entered the sleep phase while waiting for a lock on the file. This is indicative of a certain amount of contention for the file, increasing the values of SL_SPIN and SL_NAP/SL_UNAP may improve performance.
![]() |
Note: Any PROISAM shared memory problems are automatically logged in /etc/isamlog assuming that the file already exists and has world-writable privileges |
Topic ID: 720227