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

[Bugfix] [Tiered Caching] Add segmented locks to TieredSpilloverCache #13901

Closed

Conversation

peteralfonsi
Copy link
Contributor

Description

In performance benchmarking of tiered caching we found the TSC spends a lot of its time waiting on a single global read-write lock, which blocks access to the underlying cache. This lock is meant to prevent keys from entering both the on-heap and disk tier simultaneously; the underlying tiers themselves are threadsafe.

To resolve this, we effectively segment the TSC with 256 locks. To do a cache operation with a key, you must acquire the corresponding lock, which is determined by key.hashCode(). This way most pairs of keys can access the cache concurrently.

Related Issues

Part of tiered caching.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
      - [N/A] API changes companion pull request created.
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
    - [N/A] Commit changes are listed out in CHANGELOG.md file (See: Changelog)
    - [N/A] Public documentation issue/PR created

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Peter Alfonsi <[email protected]>
@peteralfonsi peteralfonsi force-pushed the tsc-segmented-locks branch from 0373056 to 4dea454 Compare May 30, 2024 20:03
Copy link
Contributor

❌ Gradle check result for 0373056: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 4dea454: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@peteralfonsi
Copy link
Contributor Author

Flaky test:
#13600
and timeout in same suite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant