How does speculative execution improve tail latency in Cassandra reads?
Last updated
Speculative retry sends a redundant read to another replica when the first is slow (GC pause, disk load), and the coordinator uses whichever responds first.
Configured per table via
speculative_retry(e.g.99PERCENTILE,50ms,ALWAYS,NONE). Percentile thresholds adapt to the table's own latency.Trims p99/p999 latency but not the median, and aggressive settings add extra load on replicas.
- https://cassandra.apache.org/doc/4.0/cassandra/cql/ddl.html
- https://apache.github.io/cassandra-java-driver/4.19.0/core/speculative_execution/
- https://www.scylladb.com/glossary/cassandra-latency/
- https://axonops.com/blog/cassandra-monitoring-how-to-diagnose-high-latency/
- https://docs.datastax.com/en/hyper-converged-database/2.0/drivers/speculative-execution.html
- https://github.com/Azure-Samples/azure-cassandra-mi-java-v4-speculative-execution
- https://medium.com/glassdoor-engineering/cassandra-driver-configuration-for-improved-performance-and-load-balancing-1b0106ce12bb