liveBook · Manning

Predictive technique

As explained in Latency

A predictive technique performs an operation before its need is confirmed by forecasting future access, demand, or execution behavior.

A predictive technique performs a long-running operation before its need is confirmed, using expected future access, demand, or execution behavior to hide latency. When the prediction is correct, the result is ready when required and perceived latency approaches zero. section 11.0 section 11.1

Apply the technique through a three-step pattern:

  • Identify operations whose latency cannot be reduced. section 11.1
  • Specify predictors that anticipate when their results will be needed. section 11.1
  • Start the operations early enough for their results to be available on demand. section 11.1

Common forms target different sources of latency:

  • Prefetching retrieves data before access, using sequential, spatial, stride-based, semantic, or machine-learning access predictions. section 11.1 section 11.6
  • Optimistic updates apply client-side writes immediately and synchronize them in the background. section 11.1
  • Speculative execution performs possible work early and discards results that prove unnecessary. section 11.1 section 11.6
  • Predictive resource allocation overprovisions or prewarms resources to avoid provisioning delays. section 11.6

Authentication and immediate application response

After a user begins authentication, the application can prefetch user-specific data in parallel. If the data is needed after login, it is already available and the post-authentication experience feels immediate. section 11.1

Prediction is not free. Incorrect guesses waste resources, increase complexity, or add latency. Optimistic writes can conflict with updates on other nodes and require conflict resolution; speculative work can be discarded. Applying these techniques therefore trades resource cost or temporary inconsistency against lower latency. section 11.1 section 11.6

How Latency covers it

How deep it goes
Defines a three-step workflow and surveys four technique families, but does not develop implementation details for each family.
Examples
Uses login-time user-data prefetching, sequential and stride-based access patterns, client-side writes, and prewarmed resources.
What you can do after
Apply it to hide latency through prefetching, optimistic updates, speculative execution, or predictive resource allocation.
How it connects
Connects prefetching, optimistic updates, speculative execution, predictive resource allocation, conflict resolution, and asynchronous processing.

Related concepts

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