jonnify·echd /echd/best-effort-consistency

M3 · Best Effort Consistency

Answer now, reconcile toward correct.

The second strategy on the menu, and the deliberate opposite of the first: guarantee a response always, and provide consistency as best the network allows — the right choice for content served to readers worldwide, where a slightly stale answer is useful and a withheld one is not.

The classic example is a content delivery network caching close to users; echd takes the same stance on its market-data feed and its globally replicated retention — answering from local state and bounding staleness rather than forbidding it, marking a value stale under partition instead of refusing it. Where the consistency-first ledger of M2 blocks rather than diverges, these surfaces diverge within a bound rather than block. The strategy and its examples are settled and external (Gilbert & Lynch, Akamai, Valkey, Tigris); echd's composition is what this course proposes.

The near-cache, made visual · a reader holding a local cache, an owner holding the authoritative value, a coherence broadcast between them — hover a state to walk a fresh read, an invalidation push, a partition, and recovery (the client-side-caching protocol of a Valkey-class store)
reader · near-cache owner · authoritative v1 v1 in sync read served local v2 v2 invalidate flushed · refetched v2 v2* v3 ⚡ partition push lost served marked stale v3 v3 re-synced back to fresh

state · hover to walk the near-cache In the common case the reader serves the most recent value from local memory with no round-trip; when the invalidation channel is cut by a partition, it serves the value marked stale rather than withholding it. Hover a state below to take it one move at a time.

State 1 · a fresh read. The cached value matches the authoritative value the owner holds. The reader serves it from local memory with no round-trip — the common case, and the whole point of caching close to the reader.
State 2 · an invalidation push. The authoritative value changes. The coherence broadcast pushes an invalidation the moment the key changes; the cache flushes the stale entry, and the next read fetches the new value.
State 3 · a partition. The invalidation channel is cut. The reader cannot be sure its cached value is current, so it serves it marked stale rather than withholding it — availability over consistency, with the staleness made visible rather than hidden.
State 4 · recovery. Communication resumes, a fresh push reconciles the cache, and reads return to fresh. The cost is bounded staleness for the duration of the partition, never a withheld answer.

Hover or focus a state to walk it; click to pin. Without scripting, all four read in sequence and the figure shows every marker at once.

§1

The strategy

Gilbert & Lynch 2012

Best-effort consistency makes the opposite commitment to best-effort availability: a response is guaranteed, and consistency is provided as well as it can be without ever blocking. It fits where two conditions hold — a stale answer is tolerable for a while, and a stopped answer is not — which is the case for content served to a wide, geographically spread audience.

Its classic example is a content delivery network: a CDN caches content at edge servers close to end users to avoid middle-mile bottlenecks, serving from the nearest cache and refreshing on a time-to-live, so a reader may see a value bounded in staleness by the TTL. Naming served through caching, where a resolver answers from a cached record until it expires, is the same pattern. The lesson mirrors the first chapter: availability-first is not a refusal to be correct — it is a decision to answer now and reconcile toward correctness, choosing availability over consistency when the two collide.

The commitment

Always answer

A response is guaranteed; consistency is provided as well as the network allows, and never traded for a block. The opposite of the consistency-first surface, which blocks rather than diverges.

silence is the failure · availability over consistency

The bound

Staleness, not refusal

A reader may see a value bounded in staleness by the TTL or by the partition's duration — divergence within a bound rather than a withheld answer. The dial that tunes the bound is M4.

bounded staleness · diverge within a bound

The example

The CDN

Content cached at edge servers close to readers, served from the nearest cache, refreshed on a TTL. Naming served through caching is the same pattern — both Gilbert and Lynch's catalogue entry.

cache close, refresh on TTL · the classic example

§2

Streams and the global edge

Valkey Streams · Tigris

Retention and delivery are the other availability-first surfaces, and echd splits them across two tiers. Each instrument has its own append-only stream — a log with auto-generated, time-ordered IDs, appended with one command and tailed by readers or shared across a consumer group, with old entries trimmed to keep memory bounded. The stream is the ordered, replicated record that readers consume without contending with the writer.

Deep retention runs on Tigris, a globally distributed, S3-compatible object store that keeps an object close to the region where it was written and replicates it close to the readers who request it, giving low-latency global reads and replacing a CDN with no configuration to manage. Both tiers answer from local or nearby state and accept bounded staleness as the price of always answering.

The per-instrument stream. An append-only log with auto-generated, time-ordered entry IDs: producers append with one command, consumers tail it or share work via a consumer group, and trimming bounds the stream's size. The ordered, replicated record readers consume without contending with the writer.
The global edge · Tigris. Deep retention on a globally distributed, S3-compatible object store: an object is kept close to the region where it was written and replicated close to the readers who request it, giving low-latency global reads and replacing a CDN with no configuration to manage.
Both, the same stance. The stream and the global edge each answer from local or nearby state and accept bounded staleness as the price of always answering — the availability-first commitment, applied to retention and delivery rather than to a live read.

Hover or focus a tier to read it; click to pin. Without scripting, all three read in sequence.

The third dive, M3.3, builds the per-instrument streams and the global edge — the retention and delivery surfaces that answer from nearby state and bound their staleness rather than block.

§3

The three dives

M3.1 · M3.2 · M3.3

This landing states the chapter's argument once; each dive takes one movement to the depth a comprehensive treatment needs.

§4

The doors

course-to-course references
§5

References

sources · related

Sources

  • Gilbert & Lynch (2012) — Perspectives on the CAP Theoremnames best-effort consistency — guarantee a response always, provide consistency as best it can — as one of the four coping strategies, with a content delivery cache and naming through caching as its examples
  • Nygren, Sitaraman & Sun (2010) — The Akamai Networka content delivery network caches content at edge servers close to end users to avoid middle-mile bottlenecks, serving from the nearest edge with staleness bounded by time-to-live
  • Redis — Client-side caching (CLIENT TRACKING)when a connection caches a key, the server remembers it and sends an invalidation push when the key changes, so the client flushes the stale entry; a broadcasting mode notifies on key prefixes
  • Valkey — Streamsa stream is an append-only log with auto-generated, time-ordered entry IDs; producers append with XADD, consumers tail with XREAD or share work via consumer groups, and trimming bounds the stream's size
  • Fly.io — Tigris Global Object Storagea globally distributed, S3-compatible object store that stores an object close to the region where it is written and replicates it close to the requesting user, giving low-latency global reads and replacing a CDN with zero configuration

Related