Skip to content

CNDB-13565: allow to set memtable shard lock fairness via JMX and a system property #1785

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

Merged
merged 2 commits into from
Jun 2, 2025

Conversation

jakubzytka
Copy link

@jakubzytka jakubzytka commented May 30, 2025

What is the issue

Memtable shard lock (required for put) is non-fair. We suspect this leads to elevated latencies in case of bursty load, as in #13565

What does this PR fix and why was it fixed

This change introduces cassandra.trie.memtable.shard.lock.fairness system property and LockFairness property
of org.apache.cassandra.db:type=TrieMemtableConfig JMX object to configure it persistently or on-line.
The on-line change is effective once a new memtable is created (i.e. after flush). If forcing flush is not desired one can watch BytesFlushed metric for the table

Copy link

github-actions bot commented May 30, 2025

Checklist before you submit for review

  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@jakubzytka jakubzytka requested review from a team and jtgrabowski May 30, 2025 11:53
…ystem

property

Prior to that change memtable shard lock was always non-fair. This change introduces
cassandra.trie.memtable.shard.lock.fairness system property and LockFairness property
of org.apache.cassandra.db:type=TrieMemtableConfig JMX object to configure it
persistently or on-line.
The on-line change is effective once a new memtable is created (i.e.
after flush). If forcing flush is not desired one can watch BytesFlushed
metric for the table
@@ -152,8 +151,10 @@ public class TrieMemtable extends AbstractAllocatorMemtable

@VisibleForTesting
public static final String SHARD_COUNT_PROPERTY = "cassandra.trie.memtable.shard.count";
public static final String SHARD_LOCK_FAIRNESS_PROPERTY = "cassandra.trie.memtable.shard.lock.fairness";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe move both to CassandraRelevantProperties.java ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(SHARD_COUNT_PROPERTY and SHARD_LOCK_FAIRNESS_PROPERTY)

@jakubzytka jakubzytka force-pushed the cndb-13565-fair-locking-of-memtable-shard branch from 347a291 to b1dff71 Compare May 30, 2025 12:02
Copy link

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-1785 rejected by Butler


1 new test failure(s) in 3 builds
See build details here


Found 1 new test failures

Test Explanation Branch history Upstream history
o.a.c.u.b.BinLogTest.testTruncationReleasesLogS... regression 🔴🔴🔵 🔵🔵🔵🔵🔵🔵🔵

Found 4 known test failures

@jakubzytka jakubzytka merged commit ae1c14c into main Jun 2, 2025
480 of 490 checks passed
@jakubzytka jakubzytka deleted the cndb-13565-fair-locking-of-memtable-shard branch June 2, 2025 10:53
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.

3 participants