[
https://issues.apache.org/jira/browse/CASSANDRA-20804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitry Konstantinov updated CASSANDRA-20804:
--------------------------------------------
Change Category: Performance
Complexity: Low Hanging Fruit
> Optimize DataPlacement lookup by ReplicationParams
> --------------------------------------------------
>
> Key: CASSANDRA-20804
> URL: https://issues.apache.org/jira/browse/CASSANDRA-20804
> Project: Apache Cassandra
> Issue Type: Improvement
> Components: Consistency/Coordination, Transactional Cluster Metadata
> Reporter: Dmitry Konstantinov
> Assignee: Dmitry Konstantinov
> Priority: Normal
> Attachments: image-2025-07-30-18-39-40-063.png
>
>
> When we execute a plain write to identify replicas we do several lookups from
> ClusterMetadata.placements map using ReplicationParams.
> Equals and hashcode for ReplicationParams objects are not very cheap, so
> there is a noticible overhead for this logic in CPU profile (0.77% of overall
> CPU usage for a plain write Cassandra stress test):
> !image-2025-07-30-18-39-40-063.png|width=700!
> To reduce it the following optimisations can be applied:
> # Avoid double lookup in of the same DataPlacement in
> forNonLocalStrategyTokenRead and forNonLocalStrategyTokenWrite
> # Memorize hashCode value
> # Deduplicate ReplicationParams to use the same objects in DataPlacements
> and KeyspaceMetadata to use the fast == path in the equals
> The last two optimizations are safe because ReplicationParams is immutable.
> Note: it is related to TCM logic, so it is trunk only issue.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]