[
https://issues.apache.org/jira/browse/CASSANDRA-16072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17184629#comment-17184629
]
Michael Semb Wever commented on CASSANDRA-16072:
------------------------------------------------
Benedict is busy atm. [~blerer], all yours.
The question came up whether these should be protected from overflow.
The regions (CASSANDRA-15922) are limited to 1MB.
The CommitLogSegment is limited by {{commitlog_segment_size_in_mb < 2048}}.
And the HintsBuffer by being {{commitlog_segment_size_in_mb / 2}}.
The use of {{.getAndAdd(..)}} could still let multiple calls happen close to
{{Integer.MAX_VALUE}}. Unless these can add up to wrap-around close to zero the
{{allocate(..)}} methods will still return a negative value which is handled as
"not enough space".
For CommitLogSegment, the only one possible to be close to wrapping around,
this
[block|https://github.com/thelastpickle/cassandra/blob/e8513923de7edba9265ca50f0dbd1000539bf394/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L276-L279]
is protected by the OpOrder and cas loop, and {{close()}} is synchronized (wrt
to the nullable buffer).
> Reduce thread contention in CommitLogSegment and HintsBuffer by rewriting CAS
> loops to atomic adds
> --------------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-16072
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16072
> Project: Cassandra
> Issue Type: Improvement
> Components: Consistency/Hints, Local/Commit Log
> Reporter: Michael Semb Wever
> Assignee: Michael Semb Wever
> Priority: Normal
> Fix For: 3.11.x, 4.0-beta
>
>
> Follow up to CASSANDRA-15922
> Both CommitLogSegment and HintsBuffer use AtomicIntegers for the current
> offset when allocating. Like in CASSANDRA\-15922 the loops on
> {{.compareAndSet(..)}} can be replaced with atomic adds using the {{.
> getAndAdd(..)}} method.
> In highly contended environments the CAS failures can be high, starving
> writes in a running Cassandra node. On the same cluster CASSANDRA\-15922 was
> found, after CASSANDRA\-15922's fix was deployed, there was still problems
> around commit log flushing and hints. No flamegraph was collected that
> demonstrated the thread contention as clearly as was found in
> CASSANDRA\-15922, but the performance fix proposed here hopefully is obvious
> enough.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]