Dynamic Locking

Overview of SPD Server Locking

SPD Server uses member-level locking to protect data integrity. Member-level locking obtains an exclusive lock on a table on behalf of the user who is updating the table. When a member-level lock is held, only the owner of the lock can access the table. Attempts by others to open the table for Write access fail with a member lock failure error. The server supports the LOCKING= SPD Server LIBNAME statement option to enable users to override the default locking behavior for a domain. The LOCKING= LIBNAME statement option invokes record-level locking. For more information about SPD Server record-level locking, see LOCKING= LIBNAME Statement Option in SAS Scalable Performance Data Server: User’s Guide.
Dynamic locking is an alternative to both member-level locking and record-level locking. Dynamic locking is an SPD Server feature that gives multiple users concurrent Read and Write access to tables. It provides concurrent access by queueing requests. That is, a Write request waits on getting a lock on the table. The lock will be granted when there are no other Read or Write locks on the table. Instead of getting a member lock failure when a table is already locked, any subsequent Write requests wait until any existing locks are released.
Dynamic locking is different from SPD Server record-level locking. In record-level locking, all clients share the same record-level locking proxy process. Clients that use dynamic locking connect to a separate SPD user proxy process for each connection in the domain.
Dynamic locking is enabled or disabled at the domain level in the libnames.parm parameter file. All tables that are stored within the domain are subject to the setting of the dynamic locking feature.

Benefits of Using Dynamic Locking

SPD Server uses the dynamic locking feature to alleviate some of the problems and limitations that occur with record-level locking. The dynamic locking method of using separate proxy processes instead of a single, record-level proxy distributes resource allocations. This process decreases the probability of a single-proxy process reaching resource limits. Dynamic locking also removes a single, record-level locking point of failure for the record-level proxy. If there is a failure in an SPD Server user proxy when dynamic locking is being used, only the client that is connected to that proxy is affected. If there is a failure in an SPD Server record-level proxy, then all client connections are affected.

How Dynamic Locking Works

When SPD Server proxy processes receive concurrent Update, Append, Insert, and Delete commands, the commands are sequentially queued and then executed in order of arrival. Only one Update operation is performed on a table at any one time. Read requests can be executed at any point during an Update operation. Read requests get the most recent information that is available in the table, based on the last physical update to disk.
Dynamic locking is not a replacement for using record-level locking when the user requires SAS record-level integrity across multiple clients. Reading a record using dynamic locking does not guarantee that the record will not change before a subsequent read or update is executed. If a client needs a true record-level lock, then the record-level locking protocol should be used.
Note: A domain that has dynamic locking enabled cannot also use record-level locking.

Comparison of Dynamic Locking and Record-Level Locking

The following lists summarize the highlights of the two locking features for easy comparison:
Dynamic locking:
  • Locks the table being updated.
  • Queues subsequent write requests, instead of failing the requests.
  • Each server connection gets its own user proxy.
  • A failure in one user proxy does not affect requests in the other user proxies.
  • It’s possible that two users proxies will update the same table record at the same time, and overwrite each other’s updates.
  • Metadata updates will get an error because they require an exclusive table lock.
  • The feature must be enabled and disabled in the libnames.parm parameter file.
Record-level locking:
  • Locks the record being updated while concurrently allowing access to other parts of a table.
  • Requests to update a locked record fail.
  • All user access to all domains that use record-level locking go through one user proxy: the locking proxy.
  • Integrity of record updates is guaranteed.
  • If there is a failure in the user proxy, all users are affected.
  • Metadata updates will get an error because they require an exclusive table lock.
  • The feature can be enabled or disabled in the SASSPDS LIBNAME statement.
Last updated: February 3, 2017