[dss] Reduce contention on OI creation/mutation endpoint #1004
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a lock at the beginning of the transactions creating or mutating operational intents.
Contention is mainly due to the ability of the transaction to increment the subscription's notification index.
The lock will ensure transactions with contention on subscriptions on the same cells to wait before starting preventing multiple retries.
Compared to the result reported in the issue #1002, we can identify the following overall test durations (single run) and number of transaction retries:
The following diagram shows the result of
scd/test_operation_simple_heavy_traffic_concurrent.py
. Test was run on a GCP deployment (3 core-services, 3 cockroach db nodes):This improvement should address #742.
Note that due to the sensitivity of the change, I tried to keep it as focused as possible. Some opportunities for refactoring will be addressed separately.