research29 min studyLesson 744 in Engineering

Cache handoff: separate copy completion from ownership commitment

Design an explicit acknowledged handoff state machine with source lifetimes, receiver validation, fenced ownership, and scoped durability assumptions.

On this page

What you’ll understand

  • Name the meaning of each acknowledgment in a proposed handoff.
  • State a single-active-owner invariant without requiring only one physical cache copy.
  • Distinguish connector buffer-lifetime hooks from a durable ownership protocol.

A sender returning from an asynchronous operation does not prove that a decoder can safely serve the request, and a receiver saying “ready” does not necessarily transfer output authority. Define a handoff state machine rather than attach every meaning to one acknowledgment. The protocol here is an illustrative design requirement, not a guarantee supplied by vLLM’s experimental connector. Its pinned v0.10.2 interfaces distinguish load, per-layer readiness, save completion, and asynchronous request completion, providing useful lifetime boundaries while leaving deployment-specific ownership and durability to the actual implementation.

Give each state transition a specific obligation

A possible sequence is producing, prepared, copying, receiver-ready, ownership-committed, and source-released. Prepared identifies an immutable cache manifest and handoff attempt. Copying retains every source allocation still read by transfer. Receiver-ready means the required destination blocks and metadata have been validated and are usable under the stated completion contract. Ownership-committed changes which attempt may advance the request or emit output. Source-released happens only when its local readers are finished and the handoff protocol permits reclamation. These are different events even if a fast path combines their messages.

Specify whether readiness means device-visible data, a volatile process buffer, replicated memory, or durable recoverable state. An acknowledgment must name the model and cache identity, request generation, position frontier, destination, and handoff epoch it confirms. A lost acknowledgment makes state uncertain; it does not prove copying failed or succeeded. Query or retry the same idempotent protocol step against authoritative state rather than immediately create an unrelated active owner. Include every required worker shard before declaring the logical request ready.

#{attempts authorized to advance output for (q,g)}≤1\#\{\text{attempts authorized to advance output for }(q,g)\}\le1
This proposed safety invariant applies to request identity q and generation g. It permits multiple physical cache copies but at most one authorized output-advancing attempt. Enforcing it needs a specified ownership authority and fencing at the actual mutation/output points.↔ Scroll wide equations horizontally.

Physical copy lifetime and logical authority are different

During handoff, both source and destination may retain the same logical cache. Duplicate bytes are necessary in many safe copy protocols and do not imply duplicate output authority. Conversely, retaining only one copy does not prove that two workers cannot both emit from stale metadata. A proposed ownership ledger can commit a new monotonic epoch through a correctly coordinated operation, while consumers and the output gateway reject stale epochs. Merely attaching a larger number to a packet is insufficient if the resource or output path never checks it.

The source must not free or reuse memory while a transfer still reads it. vLLM v0.10.2’s save-completion interface explicitly addresses avoiding overwrite before saving finishes, while its other hooks expose asynchronous lifecycle decisions. Those local hooks do not establish a cross-process durable transaction or client-visible exactly-once delivery. If crash recovery is claimed, define which ownership and readiness records survive each failure. A volatile receiver-ready acknowledgment followed by a receiver crash cannot be treated as durable state without additional storage or recomputation assumptions.

Mcopied payload=Vsource+VdestinationM_{\rm copied\ payload}=V_{\rm source}+V_{\rm destination}
This aggregate bytes inventory counts two distinct live payload copies during the illustrative copy phase. Per-device budgets, staging buffers, aliases, model weights, and durability replicas require separate accounting; the sum is not automatically one GPU’s memory usage.↔ Scroll wide equations horizontally.

Test uncertain outcomes rather than only successful copies

Inject failure before receiver-ready, after receiver-ready but before ownership commitment, after commitment but before acknowledgment delivery, and during source release. Check that the authoritative owner is unambiguous and that stale attempts cannot emit or reclaim another attempt’s blocks. Retrying a status query should not create another generation. Cleanup must wait for actual transfer completion and respect retained references. A trace should reconstruct which identity and epoch each acknowledgment covered, including delayed messages from a previous destination incarnation.

The reliability lab illustrates only majority availability. Reset, explicitly set replicas five and unavailable one, predict four available and threshold three, then Play or Step. Compare a fresh Reset with replicas five and unavailable three explicitly set, yielding two available. The model implements no ownership ledger, cache copies, acknowledgment durability, fencing, or reclamation. A majority indicator cannot establish this handoff invariant; the actual state-machine and failure trace must do that work.

Two cache copies can coexist under one owner

An illustrative handoff copies a 96-MiB payload between two devices. Each device additionally holds an independent eight-MiB staging buffer during transfer. The source remains the only output-authorized attempt until a correctly fenced ownership commitment selects the receiver.

  1. During copying, source-side payload plus staging is 104 MiB, and destination-side payload plus staging is also 104 MiB. The aggregate listed transfer-state inventory is 208 MiB across two devices, not 208 MiB on each device.

  2. After validated receiver readiness and the specified ownership commitment, the receiver may become the sole authorized output owner. The two physical payload copies can still exist temporarily while the old source waits for all transfer readers to finish.

  3. Once release is permitted and staging is no longer needed, cleanup can leave the receiver’s 96-MiB payload. A lost commitment acknowledgment requires resolving the same epoch’s authoritative status, not allowing both attempts to emit because both possess valid cache bytes.

The result

The copy phase uses 208 MiB of listed aggregate state while preserving one authorized owner. Memory duplication and authority duplication are different properties.

Explore the model

Interactive lab

Interactive lab · reliability

Majority availability does not commit a cache handoff

Use independent Reset → explicitly set BOTH n and k → predict → Play/Step runs for (5,1) and (5,3): four versus two available, threshold three. The instrument has no ownership state, durable record, cache copy, fence, or output gateway.

Majority availability does not commit a cache handoffA replica count and a majority threshold, without a consensus protocol. Playback highlights fixed replica states. Having a majority alone does not establish linearizability, durability or failure independence. Current readings: Available replicas: 4 of 5; Majority needed: 3; Majority available?: Yes. All parameters are adjustable with the labeled controls below.Majority available · need 3 of 5Playback highlights fixed statesR1 · upR2 · upR3 · upR4 · upR5 · downCyan mark: majority threshold
AvailableUnavailableMajority threshold
Available replicas
4 of 5
Majority needed
3
Majority available?
Yes
t = 0 s

A replica count and a majority threshold, without a consensus protocol. Playback highlights fixed replica states. Having a majority alone does not establish linearizability, durability or failure independence. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forAvailability counts are insufficient evidence for handoff authority or recoverable receiver readiness.

Check your understanding

A receiver has copied every cache byte into volatile device memory and acknowledges readiness. What additional claim is still unproved?

Try it yourself

A source and destination each retain a 64-MiB payload plus four-MiB independent staging during copying. Compute the listed aggregate and per-device transfer-state inventory. Does a source-local save completion prove the receiver owns a durable request?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Count distinct physical storage, then separate the local lifetime event from receiver and ownership claims.

Compare with the solution

Each device has 68 MiB and the aggregate is 136 MiB, excluding all other allocations. Source-local completion can establish the documented local buffer-lifetime condition, but it does not by itself establish validated receiver usability, durable ownership commitment, or exactly-once visible output. Those claims need the specified acknowledgment, authoritative state, fencing, and recovery protocol. Preserve source storage until both its readers and the handoff release conditions permit cleanup.

Take it with you

  • Name copy, receiver-ready, ownership, durability, and release acknowledgments separately.
  • Enforce one active authority while allowing safe temporary copies.
  • Validate uncertain handoff outcomes against actual lifecycle and recovery contracts.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.