[
https://issues.apache.org/jira/browse/CASSANDRA-20804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitry Konstantinov updated CASSANDRA-20804:
--------------------------------------------
Attachment: results_details_trunk_20804.tar.xz
ci_summary_trunk_20804.htm
> 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
> Fix For: 5.x
>
> Attachments: 5.1_change2_cpu.png, 5.1_repl_cpu.html,
> ci_summary_trunk_20804.htm, image-2025-07-30-18-39-40-063.png,
> image-2025-08-02-17-47-11-156.png, repl2_cpu.html,
> results_details_trunk_20804.tar.xz
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> When we execute a plain write to identify replicas we do several lookups from
> ClusterMetadata.placements map using ReplicationParams as a map key.
> 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 of the same DataPlacement in
> forNonLocalStrategyTokenRead and forNonLocalStrategyTokenWrite methods
> # 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]