13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Handling lock timeouts<br />

<strong>Data</strong> source record locking<br />

The default behavior <strong>for</strong> handling a lock timeout condition in the <strong>OpenEdge</strong><br />

<strong>Data</strong><strong>Server</strong>s is to return control immediately to the <strong>OpenEdge</strong> client. There<strong>for</strong>e, the<br />

lock wait timeout at the data source is set to zero at the beginning of a client session<br />

when using the <strong>OpenEdge</strong> <strong>Data</strong><strong>Server</strong> <strong>for</strong> MS <strong>SQL</strong> <strong>Server</strong>. This is desirable behavior<br />

<strong>for</strong> clients that want immediate control over lock handling. The client application can<br />

choose to handle the lock timeout directly using the NO-WAIT and NO-ERROR keywords.<br />

Then, when a record cannot be accessed because it is locked by another user, the<br />

application can test <strong>for</strong> the server timeout condition by testing <strong>for</strong> TRUE returned from<br />

the LOCKED function. The application consumes the timeout condition in this case and<br />

is free to per<strong>for</strong>m whatever action is deemed necessary.<br />

If the client application does not specify NO-WAIT, then the application automatically<br />

loops back to the server in an internal wait mode and retries record access. It continues<br />

to do so until the Lock Timeout period set on the client (–lkwtmo parameter specified<br />

in seconds) is exceeded. If this wait period is exceeded without being able to<br />

successfully access the server resource, the process times out, the wait is canceled<br />

and the client raises a stop condition.<br />

When NO-WAIT is unspecified, the client consistently returns to the server to retry<br />

access to the locked resource. If NO-ERROR is also unspecified, then during the Lock<br />

Timeout period (-lkwtmo) a resource wait dialog box continues to be displayed to the<br />

user. It allows the user to select cancel from the dialog to end the wait period. If the<br />

user does not cancel and the –lkwtmo period has not been exceeded, the client<br />

per<strong>for</strong>ms constant retries and multiple round trips to the server. This constant<br />

re-cycling, especially during a period of high resource contention, can be normalized<br />

by setting a small timeout period on the server in which to handle lock conditions be<strong>for</strong>e<br />

returning timeouts to the client application. The server wait period is set through the<br />

PRGRS_NATIVE_LOCKWAIT –Dsrv connection parameter. The disadvantage to setting<br />

this parameter to a non-zero value is that the client application is blocked <strong>for</strong> the<br />

timeout period set on the server. This may produce some amount of server-bound<br />

latency that should be considered when setting the number of milliseconds <strong>for</strong> this<br />

option. However, if the server is able to complete the resource request in the server<br />

timeout period, the resource is returned to the client immediately and the application<br />

unblocks. There<strong>for</strong>e, the advantage of setting a non-zero server timeout is that the<br />

server is given the opportunity to resolve record access without further round trips from<br />

the client repeatedly request the same resource. A nonzero value may be especially<br />

useful during periods of high contention and may increase the overall efficiency of the<br />

<strong>Data</strong><strong>Server</strong> application. Progress recommends a nominal but non-zero setting <strong>for</strong> the<br />

number of milliseconds in most cases. Evaluate your average contention <strong>for</strong> resources<br />

in setting this value <strong>for</strong> your own application.<br />

The PRGRS_NATIVE_LOCKWAIT –Dsrv option permits an application to set a maximum<br />

time threshold that the server will block the application waiting to fulfill a resource<br />

request that is locked. When the server waits <strong>for</strong> the resource longer than the<br />

PRGRS_NATIVE_LOCKWAIT number of milliseconds, control is returned to the client<br />

application which then handles the lock condition as described earlier. As the<br />

PRGRS_NATIVE_LOCKWAIT time is increased, the number of retries from the client within<br />

the –lkwtmo period is decreased (assuming NO-WAIT is unspecified).<br />

The PRGRS_NATIVE_LOCKWAIT setting will affect all transactions <strong>for</strong> all connections to<br />

the <strong>for</strong>eign data source <strong>for</strong> a given application session. This includes read-only<br />

connections, stored-procedure connections, and transactions on the sequences<br />

connection.<br />

<strong>OpenEdge</strong> <strong>Data</strong> <strong>Management</strong>: <strong>Data</strong><strong>Server</strong> <strong>for</strong> <strong>Microsoft</strong> <strong>SQL</strong> <strong>Server</strong> 95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!