Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserts on common_token_values can cause contention #1619

Closed
punktilious opened this issue Oct 22, 2020 · 1 comment
Closed

Inserts on common_token_values can cause contention #1619

punktilious opened this issue Oct 22, 2020 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@punktilious
Copy link
Collaborator

punktilious commented Oct 22, 2020

Describe the bug
When testing with 200 ingestion threads processing new resources, congestion was observed on inserts into the new common_token_values table (issue #1366) .

To Reproduce
Generate a new set of synthetic patient data in COS.
Run fhir-bucket to load the new data.
Observe ingestion performance.

Expected behavior
Better throughput scaling as ingestion thread-count increases.

Additional context
Contention occurs when the same new reference value appears in more than one bundle, and those bundles are processed in parallel. It takes a few seconds to process each bundle and this means that the insert into common_token_values may be blocked for a while until the competing transaction commits. The solution is to capture all the required inserts into this table for the whole transaction, then insert them just prior to the transaction commit. This means fewer round-trips to the database, as well as significantly reducing the amount of time the exclusive locks are held.

@punktilious punktilious added the bug Something isn't working label Oct 22, 2020
@punktilious punktilious added this to the Sprint 19 milestone Oct 22, 2020
@punktilious punktilious self-assigned this Oct 22, 2020
punktilious added a commit that referenced this issue Oct 24, 2020
Signed-off-by: Robin Arnold <robin.arnold23@ibm.com>
@prb112
Copy link
Contributor

prb112 commented Oct 27, 2020

Moving to Review Q/A? please move back if not appropriate

@prb112 prb112 closed this as completed Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants