Wait time for LockFile attempt fixed at 200 ms
We have been investigating a performance issue on our production server when under high load.
Due to high volume of read/write operations in production environment, a read from a shared key file becomes a bottleneck in performance which causes critical time bound processes to time out.
We have a key file REPLAY_LOCK.DDF which is a text file.
The code for reading the file looks like below.
OPEN (REPLAY_LOCK_CHANNEL,O,'MEM:REPLAY_LOCK.DDF'+RX_HOST)
READ (REPLAY_LOCK_CHANNEL,REPLAY_LOCK,1,WAIT=Q_WAIT) ; Read and lock control record
INCR REPLAY_LOCK_SEQ
STORE (REPLAY_CHANNEL,REPLAY_INFO) [LOCK=STORE_IT,DUP=DUP_ERROR]
We have run Process Monitor (procmon) on the windows server and captured data about the dbr.exe behaviour.
The captured data indicates that a LockFile action when ‘NOT GRANTED’ is retried immediately for the first three attempts.
The fourth and subsequent attempts have a 200ms delay before being attempted.
08:44:53.807 | LockFile | NOT GRANTED |
08:44:53.807 | LockFile | NOT GRANTED |
08:44:53.807 | LockFile | NOT GRANTED |
08:44:54.007 | LockFile | NOT GRANTED |
08:44:54.208 | LockFile | SUCCESS |
According to the reply from Synergex support ,there is currently no way to change this behavior of 200ms wait from 4 attempt onwards.
So I wanted to suggest a enhancement to be able to remove the delay by using a NO_WAIT in the code within a loop, such as:
OPEN (REPLAY_LOCK_CHANNEL,O,'MEM:REPLAY_LOCK.DDF'+RX_HOST)
locked,
READ (REPLAY_LOCK_CHANNEL,REPLAY_LOCK,1,WAIT=NO_WAIT) [LOCK=locked]; Read and lock control record
INCR REPLAY_LOCK_SEQ
STORE (REPLAY_CHANNEL,REPLAY_INFO) [LOCK=STORE_IT,DUP=DUP_ERROR]