liveBook · Manning

Speculative execution policy

As explained in ScyllaDB in Action

A speculative execution policy defines when and how a database driver launches additional attempts for an unfinished request.

A speculative execution policy tells a database driver when to launch another attempt for a request that has not returned. The first successful response wins, so a late original request does not make the application wait for its retry. section 10.5.3

The available policies and settings are:

  • NoSpeculativeExecutionPolicy disables speculative retries. section 10.5.3
  • ConstantSpeculativeExecutionPolicy waits for a fixed interval, then retries up to a configured number of attempts. section 10.5.3
  • Choose the interval from query-performance data; the 99.9th-percentile latency is suggested as a starting point. section 10.5.3
  • Use speculative retries selectively: overly aggressive settings create unnecessary duplicate work on cluster nodes. section 10.5.3

Reviews application configuration

A small reviews application can start a speculative retry after 0.1 seconds and allow two attempts. The execution profile applies ConstantSpeculativeExecutionPolicy, while selected idempotent queries are marked individually for speculative retry. section 10.5.3

Figure 10.7 Speculatively retrying queries helps the application mitigate the effects of a query not returning.
figure

A timing diagram shows how a later speculative attempt can return before the original request. section 10.5.3

How ScyllaDB in Action covers it

How deep it goes
Defines policy types, timing, attempt limits, idempotency, and workload trade-offs without detailing driver internals.
Examples
Uses a reviews application, a 100-millisecond interval, two attempts, and selected author and article queries.
What it assumes
Assumes the ability to identify idempotent queries and examine query-performance metrics.
What you can do after
Configure speculative execution through an execution profile and apply it selectively to idempotent queries.
How it connects
Connects execution profiles, load balancing policies, idempotent queries, query latency, and retry policies.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.