Performance Advantages of Optimistic Concurrency Control over Pessimistic Concurrency Control

Advantages of Optimistic Concurrency Control

Question

You are Dynamics 365 Finance developer.

You need to explain the performance advantages of the different concurrency models.

What are three performance advantages of optimistic concurrency control over pessimistic concurrency control? Each correct answer presents a complete solution.

NOTE: Each correct selection is worth one point.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

BCD.

Optimistic Concurrency only locks records from the time when the actual update is performed.

Following are the advantages of using OCC: Records remain available for other processes to update if they have been selected from the database but haven't yet been updated.

Records are locked for a shorter length of time.

Fewer resources are used to hold the locks during the update process.

Incorrect Answers: A: Pessimistic Concurrency Control locks records as soon as they are fetched from the database for an update.

E: One record can be selected for update by two different processes at the same time when using OCC.

https://docs.microsoft.com/en-us/dynamicsax-2012/developer/optimistic-concurrency-control

Concurrency control is a technique used to ensure the consistency of data when multiple users or processes attempt to access the same data simultaneously. Two common approaches to concurrency control are optimistic and pessimistic concurrency models.

In optimistic concurrency control, a process allows multiple users to access and modify data simultaneously without locking the data. Instead, the system checks for conflicts after the data is modified, and if conflicts are detected, the system resolves them based on a predefined resolution strategy.

Here are three performance advantages of optimistic concurrency control over pessimistic concurrency control:

  1. Records remain available for other processes while they are selected from the database: One of the significant advantages of optimistic concurrency control is that it allows multiple users to access and modify data simultaneously without locking the data. This approach minimizes the time that data is locked and unavailable to other processes. This advantage results in better performance and user experience, as users do not need to wait for long periods to access the data they need.

  2. Records are locked for a shorter length of time: In optimistic concurrency control, records are only locked when conflicts are detected after the data has been modified. This means that records are locked for a shorter period, reducing the overall lock time and allowing other processes to access and modify the data more quickly.

  3. Fewer resources are used to lock records during updates: Pessimistic concurrency control requires the system to lock records as soon as they are retrieved from the database, which can result in a significant overhead cost in terms of processing time and resources. On the other hand, optimistic concurrency control avoids this cost by allowing records to remain unlocked until conflicts are detected after the data has been modified. As a result, fewer resources are used to lock records during updates, leading to better performance and reduced system overhead.

In summary, optimistic concurrency control provides better performance advantages over pessimistic concurrency control in terms of the availability of records for other processes, reduced lock time, and reduced resource usage during updates.