Locking mechanism in MS CRM

When CRM is interacting with SQL server what exactly happening in terms of locking at database?..., Here I am trying to articulate the locking mechanism at my best.

When CRM trying to interface with SQL server, SQL server determines which locks it should be apply against a record or table.




  1. If CRM is trying to read a record, SQL server applies Read lock on that record.
  2. If CRM is trying to read multiple of records, SQL server decides whether it should apply Read lock on entire table or respective records
  3. If CRM is creating a record, SQL server applies Write lock on that record.
  4. If CRM is updating a record, CRM will applies write lock on that record.
  5. There may be scenarios SQL server does not apply any locks.
CRM executes all the request under a single transaction each time it is hitting database, SQL server holds the lock until transaction completed. Once the transaction is completed SQL server will release the lock on that record or transaction.

Below scenario explains how the system reacts when multiple of users updating the same record at same time.

























When first transaction gets lock and started it execution, second transaction will be blocked until it gets lock on that record i.e. blocked until first transaction complete.


Sometimes blocking may cause timeout issue when the multiple request executes parallel. The first request can easily lock the record and complete it requests, but the second request should wait until the first request release its lock. Similarly, thirst request should also wait until first and second requests to complete. The more requests there are, the longer blocking will occur. If there are enough requests, and each request takes long enough, this can push the later requests to the point that they time out, even though individually they may complete correctly.




You may like below posts

Improving MS CRM Performance

Performance Center in MS CRM 2013

date and time field behavior in MS CRM

Upsert in MSCRM

Ticker Symbol Field in MS CRM

Themes in MS CRM

Enable Tracing in MS CRM

Calculated Field in Dynamics CRM 2015


IME Mode in MS CRM

No comments:

Post a Comment

Featured Post

Improving MS CRM Performance

Performance on MS CRM is always a crucial thing and we may follow different ways to achieve the performance thing. Below is the one more a...