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

Optimize cassandra routing runtime #1413

Closed
rukai opened this issue Jan 9, 2024 · 1 comment
Closed

Optimize cassandra routing runtime #1413

rukai opened this issue Jan 9, 2024 · 1 comment

Comments

@rukai
Copy link
Member

rukai commented Jan 9, 2024

Cassandra routing in CassandraSinkCluster has shown up as a hotspot in profiling.

NodePool::get_replica_node_in_dc shows up in the samply profiler as taking up 2.6% of execution time in the cassandra,compression=none,connection_count=100,driver=scylla,operation=read_i64,protocol=v4,shotover=standard,topology=cluster3 windsock bench.

Here are some areas to explore for improving it:

  • Use Arc to avoid cloning PreparedMetadata #1409
  • cassandra optimize murmur hashing #1406
  • Avoid allocating vec in iter_replica_nodes
    • maybe we can store the vec in self and clear + reuse it?
  • Explore ways to implement iter_replica_nodes without a BTreeMap, our current BTreeMap approach seems to be quite expensive, lets check how scylla driver implements it
  • Avoid allocating vec in get_replica_node_in_dc
    • My first thought is to keep things as iterator instead of collecting into a vec but that seems to hit borrow check issues.
    • Lets try refactoring get_replica_node_in_dc so that a closure is passed that makes use of a single a connection and returns Err on failure to use connection. This should let us use simple iteration to avoid having to create collections.
@rukai
Copy link
Member Author

rukai commented May 30, 2024

Closing this. We made some of the wins described here, but probably best to start a performance analysis from scratch if we need to improve cassandra performance further, since so much has changed since then.

@rukai rukai closed this as completed May 30, 2024
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

No branches or pull requests

1 participant