Module cdrs_tokio::speculative_execution

source ·
Expand description

Pre-emptively query another node if the current one takes too long to respond.

Sometimes a Cassandra node might be experiencing difficulties (ex: long GC pause) and take longer than usual to reply. Queries sent to that node will experience bad latency.

One thing we can do to improve that is pre-emptively start a second execution of the query against another node, before the first node has replied or errored out. If that second node replies faster, we can send the response back to the client. We also cancel the first execution.

Turning on speculative executions doesn’t change the driver’s retry behavior. Each parallel execution will trigger retries independently.

Structs§

Traits§

  • The policy that decides if the driver will send speculative queries to the next nodes when the current node takes too long to respond. If a query is not idempotent, the driver will never schedule speculative executions for it, because there is no way to guarantee that only one node will apply the mutation.