Skip to content
Discussion options

You must be logged in to vote

The decision usually comes down to contention patterns and failure cost.

I lean toward optimistic locking when:

Conflicts are rare and short-lived.

Retries are cheap and safe.

The system favors throughput over strict latency guarantees.

Pessimistic locking tends to make more sense when:

Contention is high and predictable.

The cost of retries is significant (e.g., complex transactions or external side effects).

Latency variance is more problematic than raw throughput.

In practice, optimistic locking often works well at smaller scales but degrades sharply once contention increases. At that point, pessimistic locking can produce more stable behavior, even if peak throughput is lower.

The key…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by iaversao7-sketch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants