Development
en-US

KV-Cache-Aware Inference Routing: Reading Kinference and Benchmarking in Go

A walkthrough of Kinference's PredictedTTFT and InferencePolicy, paired with a Go mock benchmark comparing round-robin, prefix-affinity, and combined scoring under hot-prefix workloads.

·42 min read·Lios09
#llm-inference#kv-cache#load-balancing#vllm#go

1. Grounding the Numbers First: What 95% and 7.4× Actually Measure

Kinference was announced by Buoyant on 2026-11-04 on the vLLM blog, with source code at Kinference-AI/kinference (Apache 2.0). The announcement post itself gives just two headline claims: on a certain class of workload, compared to standard Kubernetes load balancing (a Service backed by kube-proxy), median TTFT drops by 95% and median end-to-end latency drops by 45%; in capacity testing, goodput is 7.4× on shared-prefix workloads and about 3.5× on multiturn. The methodology lives in the linked Buoyant benchmark post. Every figure cited here comes directly from those two posts—nothing was eyeballed from charts.

ItemTest Conditions Reported by Buoyant
ClusterAWS; two identical vLLM 0.31.0 pools, 3 pods each, 1× L40S per pod
ModelQwen-3.8-27B-FP8, dense
BaselineOne OpenAI chat-completion endpoint routed through Kinference, the other hitting a Service (ClusterIP) directly; kube-proxy in iptables mode selects a random pod per new connection, and GuideLLM opens a new connection for almost every request
Load genGuideLLM 0.8.1 on a separate node
shared-prefixOne of 24 shared prefixes of 16,000 tokens + 256 unique tokens, 256 output tokens
multiturn8-turn conversations: 8,000 tokens on turn 1, then +400 new tokens plus history per subsequent turn, 200 output tokens
control16,256-token completely independent prompts, 256 output tokens

The two sets of numbers use different measurement setups and should not be conflated:

MetricWhat It Actually Means
Median TTFT −95%Low-load latency test (open-loop Poisson, shared-prefix at 12 req/min): 6.88 s → 0.31 s, ratio 0.045, 95% CI [0.042, 0.596]. Multiturn goes 1.70 s → 0.59 s (about −65%)
Median E2E −45%Same shared-prefix test: 20.5 s → 11.3 s
7.4× goodputCapacity test (closed-loop fixed concurrency 4–32), "peak-to-peak": Kinference's 103.0 req/min at concurrency 32 ÷ Service's 14.0 req/min at concurrency 16. The peaks are at different concurrency levels
≈3.5×Multiturn peak 82.7 (concurrency 24) ÷ 23.8 (concurrency 8)
SLONot an interactive threshold: shared-prefix uses 90% TTFT ≤ 8 s, multiturn uses 90% TTFT ≤ 4 s, derived from idle cold-miss TTFT (6.7 s / 3.3 s) plus headroom

Two additional details are worth keeping in mind: on the control workload, median TTFT is indistinguishable between the two setups (6.92 s vs. 6.83 s), yet p95 drops from 21.46 s to 12.33 s—the author attributes this to the predictor also incorporating vLLM queue depth. Meanwhile, the plain Service side failed to meet SLO at every tested concurrency level.

These are Buoyant's own benchmarks on 3 GPUs and a single model. They illustrate the order of magnitude of cache affinity on long-prefix workloads, not a guarantee for arbitrary clusters; the author explicitly notes that "the raw numbers don't matter; the ratios do."


2. Why Round-Robin Wastes the Prefix Cache

vLLM's prefix caching reuses KV state in fixed-length blocks. Whether a block can be reused depends on whether that block and every token preceding it match what is already cached, so each block is identified by a chained hash:

tokens:  [ system prompt ............................ ][ user ...... ]
blocks:  | B0 | B1 | B2 | ... | B124 |                 | B125 | ... |  partial (not cached)
hash:    h0=H(0,B0)  h1=H(h0,B1)  h2=H(h1,B2) ...  h124=H(h123,B124)  h125=H(h124,B125) ...

As long as h0..h124 are in the worker's cache, prefill only needs to compute from B125 onward.
After the first missing block, everything downstream is invalidated—even if later hashes happen to be cached.

When you round-robin across N workers as if they were stateless replicas, every hot prefix has to be computed once per worker. Worse still, every worker has to make room for the entire set of prefixes, so once the working set exceeds a single GPU's cache, prefixes start evicting one another. The value of prefix-aware routing is steering the same prefix to the same GPU whenever possible, turning cluster cache from N duplicated copies into a partitioned cache with close to N× the effective capacity.

Looking only at prefixes, however, creates the opposite problem: a hot prefix pulls all traffic onto a single GPU. Kinference does not simply pick "whichever worker has the most hits"—instead, it converts both cache hits and worker load into a single common unit: predicted TTFT in milliseconds.


3. Inside a Kinference Pick: From Tokens to PredictedTTFT

Everything below is based on commit be2a7ad from 2026-11-06 03:11 PST (git clone --depth 1). The README states its role up front: Kinference does not proxy traffic itself; it exposes a gRPC interface that takes a request and returns the target endpoint plus a (possibly rewritten) request body, meant to be paired with a gateway such as Buoyant Gateway. KV event handling uses NVIDIA Dynamo's dynamo-kv-router crate.

3.1 Five Stages and State Sources

docs/request-flow.md breaks pick_and_record into five stages: Parse → Resolve model → Score → Select → Commit. The parts that directly determine routing quality are:

StageImplementation in the Repo
TokenizationPer profile, chooses render (calls vLLM's /v1/chat/completions/render, default), local (in-process tokenizers + minijinja), or compare (authoritative render, runs local in parallel and counts divergences)
Prefix matchingChunks tokens by the worker set's kvBlockSize, hashes each block, and looks up matched block counts per worker in a per-pool radix tree
Index sourceOne ZMQ SUB socket per worker receiving vLLM KV events, plus a DEALER socket to request replay when a sequence gap is detected
Load metricsPeriodically scrapes vLLM /metrics (queue depth, running count, KV cache utilization, completion rate)
In-flight creditAt Commit, records the request's prefix as dispatched "so the next pick credits this worker before the engine event arrives"
Feedback loopGateway reports first token and final token; reports release in-flight state and log predicted vs. observed values for calibration
DegradationIf tokenization fails completely, falls back to load-only selection; prefix index errors also degrade to load-only

Two other invariants matter for debugging: worker identity is a hash of the pod UID, so a pod restart looks like a brand-new worker with an empty cache; and if a worker reports a kvBlockSize that disagrees with its pool, the ingest task requests that the worker be evicted.

3.2 The Prediction Formula: Actual Code

Scoring lives in crates/kinference-router/src/picker.rs, with a comment stating "Pure arithmetic, no I/O." The total prediction is the sum of six terms:

impl WaitPrediction {
    pub fn total_ms(&self) -> f32 {
        self.base_ms
            + self.q_ms
            + self.prefill_ms
            + self.cache_ms
            + self.q_running_ms
            + self.decode_contention_ms
    }
}

Prefill is not linear—it is quadratic with an attention cross-term:

/// prefill_ms = a × n_uncached + c × n_uncached × n_total
pub fn prefill_ms_for(predictor: &PredictorConfig, uncached: u32, total: u32) -> f32 {
    let u = uncached as f32;
    let t = total as f32;
    predictor.attention_uncached_block_ms * u
        + predictor.attention_uncached_per_every_block_ms * u * t
}

Here u and t are measured in blocks, not tokens. predicted_wait_ms passes total_blocks - matched_blocks as the uncached block count:

    let uncached_blocks = w.total_blocks.saturating_sub(w.matched_blocks);
    let prefill_ms = prefill_ms_for(predictor, uncached_blocks, w.total_blocks);

    let cache_ms = predictor.cache_pressure_penalty_ms * w.kv_cache_usage;

    // Picks on this worker not yet visible in scraped metrics; see
    // `q_running_penalty_ms`.
    let q_inflight = inflight_summaries.len() as u32;
    let q_running_ms = q_running_penalty_ms(w.queue_running, q_inflight, predictor);

    // Includes just-dispatched requests, like the U-shape penalty.
    let effective_qr = w.queue_running.saturating_add(q_inflight) as f32;
    let decode_contention_ms = effective_qr * predictor.forward_pass_ms;

The queue term q_ms is more nuanced than queue_len × constant. For each request that the router itself dispatched and has not yet seen a first token for, compute_queue_cost estimates progress as elapsed_ms / estimated_prefill_ms and counts only the remaining portion. Requests beyond inflight_concurrent_capacity, or any request when the worker already reports a non-empty waiting queue, are counted at full prefill cost. On top of that, any queued requests reported by the engine that the router did not dispatch itself (unknown_q_count) are charged a fixed millisecond cost per entry:

    let unknown_q_count = w.queue_waiting.saturating_sub(inflight_count);

    // A nonzero queue means the batch is at capacity, so treat every
    // inflight as not yet admitted.
    let capacity = if w.queue_waiting > 0 {
        0
    } else {
        predictor.inflight_concurrent_capacity
    };
    ...
        let (_progress, discount) =
            inflight_discount(position, capacity, elapsed_ms, estimated_prefill_ms);
        position_cost_ms += discount * estimated_prefill_ms;
    ...
    let unknown_cost_ms = unknown_q_count as f32 * q_rate_ms_per_entry;

q_running_ms is a "tent-shaped" penalty: 0 when zero requests are running, rising to a peak at peak_qr, and falling back to 0 by falloff_qr. The code comment explains the intuition: when only one or two requests are running, a new prefill contends for the GPU without batching efficiently alongside them, whereas with five or more running, it "piggybacks almost for free." This is an empirical curve fitted on the author's own hardware—the comment describes it as "calibrated against the observed slow-mode mean-TTFT delta."

3.3 Code Defaults Differ from Helm Defaults

The same parameters carry different defaults in profile.rs's serde definitions versus the default profile in charts/kinference/values.yaml. In deployment, the chart wins:

Parameterprofile.rs DefaultHelm values.yamlRole
base_ms400400Per-request constant intercept
queue_ms_per_entry10000.2Cost per unknown queued entry
attention_uncached_block_ms (a)2.32.3Linear term per uncached block
attention_uncached_per_every_block_ms (c)0.0090.03Quadratic attention term
q_running_penalty_peak_ms7000 (off)Tent-shaped running penalty
forward_pass_ms0 (off)5Cost per concurrent decode
top_k_min / top_k_fraction2 / 0.21 / 0.0Pure argmin under the chart
tie_tolerance_ms500Tolerance for treating scores as tied
replication_threshold_pct0 (off)10Hot-prefix replication, see below

The comment in values.yaml reads "Starting points; refit from this profile's observation events"—meaning these coefficients are meant to be refitted against observation logs from your own cluster.

3.4 Selection: Top-K, In-Flight Tie-Breaking, and Hot-Prefix Replication

pick_endpoint sorts workers by predicted TTFT, keeps the top max(top_k_min, ceil(n × top_k_fraction)) plus any worker within max(k-th score, best + tie_tolerance_ms), filters that set down to those with the fewest in-flight requests, and breaks remaining ties uniformly at random. The comment explains this avoids sending every request to the first worker during cold start when all predictions are identical.

Hotspots are addressed even more directly by cache_replication_override. It overrides the chosen worker with a cold worker only when all of the following hold: the feature is enabled; the originally chosen worker is already "warm" (radix tree matches at least replication_warm_threshold_fraction of blocks, default 0.5); fewer than replication_warm_target workers (default 2) are warm; there exists a candidate that is neither warm nor currently warming; and that candidate's predicted TTFT is within 1 + replication_threshold_pct/100 of the best score. The Helm chart enables this by default at 10%:

    let extra_cost = cand_ms - best_ms;
    // `replication_threshold_pct` is in percentage points.
    let max_extra = best_ms.max(0.0) * (picker.replication_threshold_pct / 100.0);
    if extra_cost > max_extra {
        return chosen_idx;
    }

In other words, even when raw predicted TTFT still favors the hot GPU, as long as the extra latency penalty is no more than 10%, Kinference proactively seeds the prefix onto a second GPU. The hot-prefix workload in Section 7 below reproduces the exact failure mode this mechanism is meant to prevent.

A separate helper, compute_layered_overlap, handles prefixes that are in flight but not yet committed to the KV cache: it treats each in-flight request as a layer, decays older layers by a factor α, and only credits the portion of each layer that extends past newer layers. At α = 1 (the default), this reduces to the longest match across all sources.


4. InferencePolicy: consider / exclude / select / onEmpty

4.1 Semantics in the CRD

The schema lives in charts/kinference-crds/templates/kinference.buoyant.io_inferencepolicies.yaml. At the rule level, "The first rule to match wins," and within matches, fields inside one entry are ANDed while entries are ORed; a rule with no matches matches everything and must come last. The verbatim schema descriptions for the four fields under route (excerpted):

consider:
  description: |-
    The full set of endpoints to consider. Leave blank
    to simply use all known endpoints that provide the
    model named in the request (including via aliases).

    This field can be used to add models not named in
    the request, including as a weighted choice.
exclude:
  description: |-
    Endpoints to exclude from consideration.
    Order-independent. Two exclusions express OR, one
    exclusion with two fields expresses AND.
select:
  description: |-
    Which endpoint to choose, after consideration and
    exclusion. This is in ordered tiers; the first with
    a surviving candidate wins outright.  If an
    objective is specified, it must defined for every
    candidate in its tier. For example, PredictedTTFT is
    Local-only, so a tier spanning both Local and
    Provider types cannot use it.
onEmpty:
  type: string
  enum: [Reject, FallThrough]
  default: Reject

spec.unmatched is enum: [ServeLocal, Reject] (default ServeLocal), controlling what happens when no rule matches at all. exclude[].drop can filter candidates by contextWindow, predictedTTFT, prefixCacheHitRatio, queuedPrompts, kvCacheUsage, model.name, as well as backend.type/name/readyEndpoints/observedTTFTP95/budgetExhausted. Every select tier must use either minimize (PredictedTTFT or EstimatedTTFT) or order, and the CRD enforces via CEL rules that "PredictedTTFT is Local-only."

4.2 How the Engine Evaluates a Policy

evaluate in crates/kinference-policy/src/engine.rs runs four steps in order: built-in context-window fitting (dropping any endpoint whose window cannot hold prompt + max_tokens), user-defined exclusions, ordered select tiers, and tieBreak. exclude is straightforward set subtraction—if an if guard does not match, the entire exclusion is skipped:

    for ex in &route.exclude {
        // A guard that doesn't match skips the whole exclusion.
        if let Some(guard) = &ex.if_
            && !guard.matches(attrs)
        {
            continue;
        }
        ...
    }
    if survivors.is_empty() {
        return Outcome::Empty { trace };
    }

    // --- select: ordered tiers, first with a survivor wins outright ------

Outcome::Empty is handled by the caller: onEmpty: Reject rejects immediately, while FallThrough continues to the next matching rule (as shown in the pseudocode in the module doc). The policy compiler also emits static warnings: a catch-all rule without onEmpty: FallThrough makes subsequent rules unreachable; a select tier without a backends subset always has survivors, making later tiers unreachable; and using order on local endpoints without tieBreak: [Random] warns that "the same endpoint wins every time, so one pod takes all of this tier's traffic."

4.3 What the Three Official YAML Examples Express

Downgrading to a cheaper model on low complexity while still comparing cache (verbatim from the blog):

rules:
  - name: low-complexity-consider-qwen
    matches:
      - model: glm-5.3
        tag: complexity-low
    route:
      consider:
        - models: { names: [qwen-3.6-27b, glm-5.3] }
      select: [{ minimize: PredictedTTFT }]

consider brings in qwen-3.6-27b even though the client didn't ask for it, putting all local workers for both models into the same PredictedTTFT comparison. The insight is that if a glm-5.3 GPU already has the entire conversation cached, "downgrading" to a cold model that has to recompute everything from scratch may actually be slower.

Burst-to-cloud (verbatim from the blog):

exclude:
  - name: drop-overloaded-workers
    drop:
      backend: { type: Local }
      queuedPrompts: { greaterThan: 2 }

select:
  - { type: Local, minimize: PredictedTTFT }
  - { type: Provider, order: [bedrock, databricks] }

First, drop any local worker with more than 2 queued prompts; tier 1 picks among the remaining local workers by predicted TTFT; only when all local workers are excluded does tier 1 come up empty and fall through to tier 2, picking external providers in bedrock → databricks order.

PII fail-closed (verbatim from the blog):

exclude:
  - name: pii-never-leaves-cluster
    if: { tag: pii-detected }
    drop: { backend: { type: Provider } }
select:
  - { type: Provider, order: [databricks] }
  - { type: Local, minimize: PredictedTTFT }
onEmpty: Reject # fail closed

Requests tagged pii-detected immediately lose all Provider candidates; if no local candidate is available either, onEmpty: Reject rejects the request rather than spilling outside the cluster—hence "fail closed."

4.4 Gaps Spotted While Reading the Code

  1. Request tags have no producer yet. The CRD's own description of tag states verbatim: "Nothing sets tags on requests yet: the router sends an empty set, so a scalar, array or containsAll never matches and {not: ...} always matches." When lifecycle.rs builds request attributes, it literally has // Nothing produces tags yet. and tag: Vec::new(). The README's Known limitations list Semantic classifiers, Rate limiting, /v1/messages, and multi-replica as not yet implemented. On this commit, therefore, the parts of examples 1 and 3 that rely on complexity-low and pii-detected do nothing: the PII example's if guard never matches, so the exclusion is skipped. The examples illustrate the intended design rather than working features today.
  2. Tier ordering in the PII example. The blog prose describes this as "bursting requests to a third party when the GPU pool saturates." Yet under evaluate's "first with a survivor wins outright" rule, the YAML literally puts Provider in tier 1: without a PII tag, as long as databricks isn't excluded, traffic goes straight to databricks without checking whether local GPUs are saturated. I did not deploy or run this policy, nor did I see any mechanism besides provider health that would remove it from tier 1; this is simply a literal reading of the YAML against the engine code, and could be a simplified snippet rather than verified production behavior.
  3. The first example may fail CRD validation. The CRD has a CEL rule requiring that any tier with minimize: PredictedTTFT either constrain itself to type: Local or have every consider entry constrained to Local, with the error message "PredictedTTFT is Local-only: constrain the tier or the candidate set to Local, or use EstimatedTTFT". The blog's smart-semantic-routing snippet omits type in both places. Reading the rule literally, the API server should reject it on apply. I didn't have a cluster and couldn't compile kinfctl to confirm (the repo's rust-toolchain.toml pins Rust 1.95.0, while my machine had 1.85.1), so this is strictly from reading the schema.
  4. Token rate limiting mentioned in the blog is currently listed under missing features in the README.

None of this diminishes the KV-aware load balancer itself—that part of the codebase is complete and thoroughly commented. Still, if you plan to use the policy layer for compliance isolation today, you cannot rely on tag (the router passes an empty set); you have to use existing request attributes like tenant, model, or qos, or wait until a tag producer lands.


5. The Go Experiment: Putting Every Mock Assumption on the Table

This is a minimal self-written implementation, not Kinference. No Kinference code, no GPU, and no vLLM are involved. All three components run in a single Go process, communicating over real localhost HTTP and SSE streaming responses; TTFT is measured on the client from request send to receipt of the first content chunk. It uses only the Go standard library; full source and raw data live in labs/kv-router/.

  load generator (closed loop, C clients)
        |  POST /v1/chat/completions  stream=true
        v
  +-------------------- router (reverse proxy) --------------------+
  | render messages -> token-ish words -> 16-token blocks          |
  | chained FNV-64 hashes -> per-worker table -> policy -> forward  |
  | headers: X-Router-Backend, X-Router-Predicted-Cached           |
  +------------+---------------+---------------+-------------------+
               |               |               |      (events mode:
               v               v               v       worker -> router
          mock worker 0   mock worker 1  ... worker N-1   KV stored/removed)
          [LRU 2500 blk]  [LRU 2500 blk]
          4 slots + FIFO queue (64), serial prefill, parallel decode
          final SSE chunk: usage.prompt_tokens_details.cached_tokens

5.1 Full Mock Worker Parameters

ParameterValueNotes
Token1 whitespace-separated word = 1 tokenNot BPE; router and workers share the same rendering and splitting by default
Block size16 tokensOnly full blocks are cached; any trailing partial block is not cached
Cache capacity2,500 blocks / worker (40,000 tokens)Block-level LRU; inserted tail-to-head so prefix heads stay most recent and tails are evicted first
Prefix matchLeading contiguous matching blocks from idx 0Stops at the first missing block
Prefill2 ms + 25 µs × uncached tokensEach worker runs only one prefill at a time (mutex)
Decode1.5 ms per output token (after first tok)32 output tokens ≈ 46.5 ms; decodes do not interfere with one another
Concurrency4 running slots; held from admit to decode endTime waiting for a slot counts toward TTFT
QueueMax 64 waiting, else HTTP 429Never triggered in any run here (err=0)

Measured at idle (calibration.txt, single worker, 20 serial requests): a 2,066-token cold miss has a median TTFT of 54.99 ms (p99 56.62 ms); with 2,000 tokens cached, median TTFT is 5.04 ms (p99 5.36 ms). Based on this, I set the TTFT SLO to 100 ms—idle cold-miss TTFT plus ~80% headroom—following the same logic as Buoyant's "idle miss TTFT + padding," though the absolute values are obviously incomparable. The SLO was fixed in the defaults before running the main benchmark.

These numbers exist solely to compare routing policies relative to one another; they do not represent real GPU TTFT. Real vLLM has chunked prefill, mixed prefill/decode batching, VRAM eviction, and scheduler priorities, and real prefill cost is nonlinear (Kinference itself uses a quadratic term).

5.2 Four Routing Policies

PolicySelection Rule
rrGlobal counter round-robin
leastFewest in-flight requests; random tie-break
prefixLongest matched prefix in the routing table; ignores load completely; ties broken by fewest in-flight, then random
kvMinimizes uncached_tokens × 0.025 ms + inflight × 12.5 ms; within 0.5 ms treated as tied, broken by fewest in-flight, then random

kv's 0.025 ms/token matches the mock's exact prefill slope—effectively a "perfectly calibrated" router. The 12.5 ms per in-flight request comes from ~50 ms decode ÷ 4 slots, approximating the wait added by each extra in-flight request. This is far simpler than Kinference's predictor: no base intercept, no quadratic term, no progress-discounted in-flight prefill, and no top-K or replication override.

The routing table defaults to shadow mode: on dispatch, the router immediately records the full prefix under the chosen worker (an LRU with the same capacity as the worker), analogous to Kinference's dispatched-prefix credit but without KV events. The events mode in Section 7.4 switches to updating strictly from stored/removed events sent back by workers.

5.3 Three Workloads and Measurement Definitions

WorkloadShapeOutput / Req
sharedUniformly picks 1 of 32 system prompts (2,000 tokens each) + 64 unique tokens32
multiturnEach client runs 8-turn conversations: 1,000 unique tokens on turn 1, appending the prior reply + 100 new tokens each turn; resets after turn 832
hotSame 32 prefixes as shared, but 60% of requests use prefix 0, 20% use prefix 1, and the remaining 20% are split uniformly across the other 3032

The 32 prefixes occupy ~4,000 blocks—more than a single worker's 2,500-block capacity, yet smaller than the aggregate capacity of 2 or 4 workers. That sizing is deliberate: replicating everything onto every GPU does not fit, whereas partitioning does.

Each run is closed-loop with 8 clients per worker (16 clients for 2 workers, 32 for 4 workers), 4 s warmup + 15 s measurement. Only requests that start inside the measurement window are counted. Every configuration is repeated 3 times, reversing policy order on even repetitions.

MetricDefinition
req/sSuccessful requests started inside the measurement window / 15 s
goodput/sRequests started inside the measurement window with HTTP 200 and TTFT ≤ 100 ms / fixed 15 s wall clock (not summed request duration, nor windowed by completion time). Failed requests are excluded from the numerator; every run here had err=0, so this matches the success subset
SLO %Same numerator / all samples started in the measurement window (including non-200); with zero errors here, this equals the share of successful requests meeting SLO
p50 / p99Nearest-rank TTFT percentiles across all successful requests in the run
hit %Σ worker-reported cached_tokens / Σ prompt_tokens (token-weighted)
overpredict %Share of requests where the router's predicted cached tokens exceeded what the worker actually reported
max share / avg q / peak qShare = successful requests on that worker / total successes in the run (200s only); max share is the maximum across workers. avg q / peak q are the max across workers of their time-averaged and peak waiting queues

Each column in the summary tables takes the median across 3 repetitions independently, so cells on the same row do not necessarily come from the same single run.


6. Key Code

6.1 Chained Block Hashing and LRU (tokens.go)

// BlockHashes returns one hash per FULL block. Each hash chains the previous
// one, so equal hash at position i implies the whole prefix [0, i] is equal.
func BlockHashes(tokens []string, blockSize int) []uint64 {
	n := len(tokens) / blockSize
	out := make([]uint64, 0, n)
	var prev uint64
	var buf [8]byte
	for i := 0; i < n; i++ {
		h := fnv.New64a()
		binary.LittleEndian.PutUint64(buf[:], prev)
		h.Write(buf[:])
		for _, t := range tokens[i*blockSize : (i+1)*blockSize] {
			h.Write([]byte(t))
			h.Write([]byte{0})
		}
		prev = h.Sum64()
		out = append(out, prev)
	}
	return out
}

// MatchPrefix counts leading blocks present. Because hashes are chained,
// the first miss ends the usable prefix even if later blocks are present.
func (c *BlockLRU) MatchPrefix(hs []uint64) int {
	n := 0
	for _, h := range hs {
		if _, ok := c.items[h]; !ok {
			break
		}
		n++
	}
	return n
}

// Insert walks the prompt tail-first so the head blocks end up
// most-recently-used: under pressure the tail is evicted before the shared head.
func (c *BlockLRU) Insert(hs []uint64) (evicted []uint64) {
	for i := len(hs) - 1; i >= 0; i-- {
		h := hs[i]
		if e, ok := c.items[h]; ok {
			c.ll.MoveToFront(e)
			continue
		}
		c.items[h] = c.ll.PushFront(h)
		for c.ll.Len() > c.cap {
			back := c.ll.Back()
			old := back.Value.(uint64)
			c.ll.Remove(back)
			delete(c.items, old)
			evicted = append(evicted, old)
		}
	}
	return evicted
}

LRU insertion direction was the first bug I hit: if you touch blocks head-to-tail, the very first block of the prefix ends up the oldest and gets evicted first—and once block 0 is gone, every chained hash behind it becomes useless.

6.2 Mock Worker Prefill (backend.go)

	// Admission: bounded waiting queue, then a running slot.
	if b.waiting.Load() >= int64(b.cfg.MaxWaiting) {
		...
		http.Error(w, "queue full", http.StatusTooManyRequests)
		return
	}
	b.addWaiting(1)
	b.slot <- struct{}{}
	b.addWaiting(-1)
	defer func() { <-b.slot }()

	// Prefill: serial on this worker; cost ∝ uncached tokens.
	b.prefillMu.Lock()
	b.cacheMu.Lock()
	matched := b.cache.MatchPrefix(hs)
	b.cacheMu.Unlock()
	cached := matched * b.cfg.BlockSize
	uncached := len(toks) - cached
	sleepMs(b.cfg.PrefillBaseMs + float64(uncached)*b.cfg.PrefillUsPerTok/1000)
	b.cacheMu.Lock()
	evicted := b.cache.Insert(hs)
	b.cacheMu.Unlock()
	b.prefillMu.Unlock()
	if b.OnEvent != nil {
		b.OnEvent(KVEvent{Stored: hs, Removed: evicted})
	}

After prefill, the worker streams SSE chunks token by token with Flush, attaches usage.prompt_tokens_details.cached_tokens to the final chunk, and ends with data: [DONE]. Cache hits are evaluated when prefill actually begins, not on request arrival—while a request waits in the queue, other requests may populate or evict cache blocks.

6.3 Router Scoring (router.go)

func (r *Router) pick(nTok int, hs []uint64) (int, int) {
	n := len(r.targets)
	match := make([]int, n)
	for i := range n {
		match[i] = r.matched(i, hs)
	}
	switch r.cfg.Policy {
	case "rr":
		i := r.rr % n
		r.rr++
		return i, match[i] * r.cfg.BlockSize
	case "least":
		return r.argmin(func(i int) float64 { return float64(r.inflight[i]) }, 0), 0
	case "prefix": // longest cached prefix wins; load is ignored entirely
		i := r.argmin(func(i int) float64 { return -float64(match[i]) }, 0)
		return i, match[i] * r.cfg.BlockSize
	case "kv":
		i := r.argmin(func(i int) float64 {
			uncached := nTok - match[i]*r.cfg.BlockSize
			return float64(uncached)*r.cfg.PrefillMsTok + float64(r.inflight[i])*r.cfg.QueueCostMs
		}, r.cfg.TieToleranceMs)
		return i, match[i] * r.cfg.BlockSize
	}
	panic("unknown policy " + r.cfg.Policy)
}

Under a single mutex, ServeHTTP runs pick, increments inflight[i], and updates the shadow table; it then forwards the request, flushes each streamed chunk, and decrements inflight[i] on completion. In-flight count is held until the full request finishes (whereas Kinference releases it at first token) because the mock holds a concurrency slot through the end of decode.

Take a 2,066-token shared request as an example: on a worker with 2,000 tokens cached, the score is roughly 66 × 0.025 + inflight × 12.5; on a cold worker, it is 51.65 + inflight × 12.5. In other words, once the hot worker has about 4 more in-flight requests than a cold worker, kv spills the prefix over; after that spill, the cold worker also records the prefix, giving the hot prefix a second warm copy.

6.4 Tests and Running the Suite

lab_test.go verifies: shared prefixes produce identical block hashes and diverge after branching; identical content at different positions hashes differently; LRU does not evict head blocks first; prefix matching stops at the first missing block; prefix sticks to a hot worker even at 100 in-flight, kv stays at 1 in-flight and spills at 3, and rr alternates; and different chat templates produce completely different block hashes from block 0.

cd labs/kv-router
go test -v ./... && go test -race ./... && go vet ./...
./run.sh   # calibrate -> main (72 runs) -> pitfalls (30 runs)
python3 summarize.py

All 5 tests pass, along with go test -race and go vet (see verification.txt). The full suite takes about half an hour.


7. Benchmark Results

7.1 Environment

Executed 2026-11-08 21:19–21:51 PST (America/Los_Angeles) on a shared VM whose background load can fluctuate—not dedicated hardware.

ItemActual Environment
OS / CPULinux 6.12.94+ x86_64, 8 logical CPUs, Intel(R) Xeon(R) Processor
Memory15 GiB, ~2.6 GiB available when recorded
Gogo1.27.3 linux/amd64, GOMAXPROCS=8
ScaleMain: 3 workloads × (2 & 4 workers) × 4 policies × 3 reps = 72 runs; Pitfalls: 2 workloads × 5 variants × 3 reps = 30 runs
Errorserr=0 across all runs, zero HTTP 429s

Before the formal run, I did one 6 s smoke test (4 workers) to verify the harness worked; it was not saved and is excluded from all numbers.

7.2 Main Benchmark Summary (Median of 3 Reps)

WorkloadNPolicyreq/sgoodput/sSLO %p50 msp99 mshit %max share %max avg qmax peak q
shared2rr66.3314.6022.01165.65370.3659.0050.055.0610
shared2least66.275.077.63172.97296.7258.5750.103.934
shared2prefix103.4058.2056.2982.53209.5096.7252.346.4912
shared2kv98.2762.0763.1683.69183.4390.0550.484.006
shared4rr129.1344.8734.76152.77516.5358.0825.019.8916
shared4least132.9310.137.62172.66315.8457.9625.363.934
shared4prefix201.33130.2765.4768.10352.8896.8128.1810.8522
shared4kv223.27195.7388.1274.86131.3196.0425.214.017
multiturn2rr89.3340.1344.99110.07211.2268.6050.005.899
multiturn2least94.6057.4060.4283.97188.3377.1250.043.944
multiturn2prefix100.8783.0782.4181.57159.4083.5350.033.944
multiturn2kv100.6783.1382.5881.67159.0383.5650.003.944
multiturn4rr149.6054.6736.66140.59357.2346.3425.007.2614
multiturn4least183.8079.8743.45103.71188.4471.8325.373.954
multiturn4prefix205.93166.7381.5279.96159.4783.0125.043.965
multiturn4kv206.93168.6782.1279.82157.6383.0425.133.965
hot2rr93.9347.8050.5396.74254.2987.3250.045.8610
hot2least93.4754.8758.7079.32222.3787.0450.403.954
hot2prefix86.5333.4737.89144.77224.1491.8663.108.6912
hot2kv105.9391.4786.6777.25131.3294.4650.093.976
hot4rr188.27113.8760.8067.66355.7487.1025.036.6417
hot4least192.13111.7358.1577.49199.7486.4725.283.944
hot4prefix91.7336.8740.19441.53517.9296.7459.8124.7528
hot4kv225.60217.6096.4574.74117.0696.6625.064.057

Key comparisons (all using medians from the table above):

  • shared, 4 workers: kv achieves 195.73 goodput/s—4.36× rr (44.87) and 1.50× prefix (130.27), while least sits at just 10.13. kv and prefix have nearly identical hit rates (96.04% vs. 96.81%); the gap is in p99: 131.31 ms vs. 352.88 ms. Remember these are comparisons under the same closed-loop concurrency (8 clients per worker) and the same mock parameters—not open-loop arrivals, and not extrapolatable to real vLLM / Kinference.
  • multiturn, 4 workers: kv (168.67/s) and prefix (166.73/s) are within run-to-run noise, while rr is 54.67/s. The hit-rate ceiling is ~83% because each conversation's initial 1,000 tokens and every turn's new tokens are unavoidable misses.
  • hot, 4 workers: prefix posts one of the highest hit rates (96.74%) yet performs worst overall: 36.87 goodput/s and 517.92 ms p99—less than 1/5 of kv (217.60/s, 117.06 ms p99) and well below rr (113.87/s).
  • 2 workers: gaps narrow across the board. On shared, kv gets 62.07 vs. prefix's 58.20; kv actually has a lower hit rate (90.05% vs. 96.72%), trading some cache hits for better balance and cutting p99 from 209.50 ms down to 183.43 ms.

7.3 Hot Workload: Per-Worker Breakdown of How prefix Crushes One GPU

For hot / 4 workers / repetition 1, here is each worker's request share, time-averaged waiting queue, peak waiting queue, and per-worker p99 TTFT:

Policyw0w1w2w3
rr25.0%, q̄ 10.60, peak 18, p99 433.825.0%, 2.94, 10, 214.625.0%, 1.53, 7, 172.025.0%, 1.07, 7, 145.4
prefix8.2%, 0.00, 1, 6.024.5%, 0.06, 4, 66.658.4%, 24.53, 28, 520.78.9%, 0.00, 1, 32.9
kv24.9%, 3.88, 7, 119.525.1%, 3.82, 6, 92.725.1%, 4.19, 6, 123.725.0%, 3.87, 6, 114.5

prefix pins the 60%-traffic hot prefix onto w2: its waiting queue hovers around 24.5 and peaks at 28, while the other three workers sit nearly idle (w0 has a 6.0 ms p99). Across the 3 repetitions, the hot worker's traffic share is 58.4%, 59.8%, and 61.6%—matching the hot prefix's own traffic share. Because this is a closed loop of 32 clients, the queue is capped by client count; under open-loop arrivals it would grow without bound, so 517.92 ms is actually optimistic.

Under kv, all four workers stay within 25% ± 0.2% share with an average queue of ~4: once the in-flight delta exceeds 4 requests, the hot prefix spills onto another worker, stays warm on two or more GPUs from then on, and keeps a 96.66% hit rate. Under rr, shares are equal, yet average queues range from 1.07 to 10.60: equal request share is not equal work, because cache misses consume an extra ~50 ms of serial prefill.

All 9 raw output lines (policy,rep,req_s,goodput_s,p99_ms,hit_pct | per-backend):

rr,1,187.27,113.87,388.68,87.10 | b0:share=25.0%,avgq=10.60,peakq=18,p99=433.8 b1:share=25.0%,avgq=2.94,peakq=10,p99=214.6 b2:share=25.0%,avgq=1.53,peakq=7,p99=172.0 b3:share=25.0%,avgq=1.07,peakq=7,p99=145.4
prefix,1,93.60,38.93,517.92,96.74 | b0:share=8.2%,avgq=0.00,peakq=1,p99=6.0 b1:share=24.5%,avgq=0.06,peakq=4,p99=66.6 b2:share=58.4%,avgq=24.53,peakq=28,p99=520.7 b3:share=8.9%,avgq=0.00,peakq=1,p99=32.9
kv,1,224.80,215.00,118.24,96.69 | b0:share=24.9%,avgq=3.88,peakq=7,p99=119.5 b1:share=25.1%,avgq=3.82,peakq=6,p99=92.7 b2:share=25.1%,avgq=4.19,peakq=6,p99=123.7 b3:share=25.0%,avgq=3.87,peakq=6,p99=114.5
kv,2,225.60,217.60,114.99,96.66 | b0:share=25.0%,avgq=4.00,peakq=6,p99=120.3 b1:share=25.0%,avgq=3.82,peakq=6,p99=118.6 b2:share=24.9%,avgq=3.88,peakq=5,p99=112.1 b3:share=25.1%,avgq=4.05,peakq=7,p99=110.9
prefix,2,91.73,36.87,516.48,96.74 | b0:share=8.6%,avgq=0.00,peakq=1,p99=36.2 b1:share=59.8%,avgq=24.75,peakq=28,p99=519.4 b2:share=8.4%,avgq=0.00,peakq=1,p99=9.0 b3:share=23.2%,avgq=0.01,peakq=2,p99=16.2
rr,2,188.27,114.73,355.74,86.44 | b0:share=25.0%,avgq=6.08,peakq=17,p99=376.2 b1:share=25.0%,avgq=1.78,peakq=8,p99=191.1 b2:share=25.0%,avgq=1.48,peakq=9,p99=177.0 b3:share=25.0%,avgq=6.64,peakq=14,p99=306.8
rr,3,192.60,98.13,248.22,87.31 | b0:share=25.0%,avgq=4.20,peakq=11,p99=234.7 b1:share=25.0%,avgq=2.96,peakq=11,p99=193.9 b2:share=25.0%,avgq=6.32,peakq=12,p99=289.2 b3:share=25.0%,avgq=2.42,peakq=9,p99=177.5
prefix,3,89.13,34.27,518.49,96.52 | b0:share=22.8%,avgq=0.01,peakq=2,p99=21.3 b1:share=7.6%,avgq=0.00,peakq=1,p99=51.5 b2:share=61.6%,avgq=24.94,peakq=28,p99=519.4 b3:share=8.0%,avgq=0.00,peakq=1,p99=54.3
kv,3,226.07,218.27,117.06,96.63 | b0:share=25.1%,avgq=3.95,peakq=6,p99=107.6 b1:share=24.8%,avgq=3.81,peakq=7,p99=128.8 b2:share=25.0%,avgq=4.03,peakq=7,p99=117.4 b3:share=25.1%,avgq=3.95,peakq=7,p99=107.9

7.4 Pitfall Experiments: Stale Tables, Event Delay, and Tokenization Mismatch

All runs use 4 workers, the kv policy, and the median of 3 repetitions:

WorkloadVariantreq/sgoodput/sSLO %p50 msp99 mshit %overpredict %
sharedkv-shadow223.67200.3389.5474.82128.2596.170.00
sharedkv-events224.20203.0090.7074.79128.6296.110.36
sharedkv-events-delay200ms225.40202.7389.4174.39130.0495.850.92
sharedkv-events-tokmismatch130.8010.678.21173.62317.1756.370.00
sharedkv-shadow-table4x216.93178.7382.3975.73156.7794.532.70
hotkv-shadow227.13216.3395.3174.19118.4296.690.00
hotkv-events225.67218.2096.6974.76115.9596.750.00
hotkv-events-delay200ms228.87221.1397.0573.84111.6996.730.09
hotkv-events-tokmismatch192.53111.6758.0077.75178.7887.070.00
hotkv-shadow-table4x225.33213.8094.8874.65124.0196.570.21

What each variant does:

VariantHow the Routing Table Updates
kv-shadowSame as the main benchmark: records on dispatch (re-run separately as the control for this suite)
kv-eventsUpdates strictly from stored/removed events emitted by workers, with no speculative recording at dispatch
kv-events-delay200msSame as above, but every event takes effect 200 ms late
kv-events-tokmismatchEvents mode, but the router renders with a different chat template (<s> [role] instead of <|role|>) while workers keep the default template. Token streams differ from block 0, so hashes in the event table never match router lookup hashes—simulating tokenizer/template drift between router and engine, not random hash corruption
kv-shadow-table4xShadow mode, but the routing table capacity is set to 4× actual worker capacity: the router believes evicted blocks are still cached

Tokenization/template mismatch is the most lethal failure mode. On shared, goodput collapses from 200.33/s to 10.67/s and hit rate drops to 56.37%—virtually identical to prefix-blind least in the main benchmark (10.13/s, 57.96%). The reason is straightforward: block 0 hashes differently, which breaks the entire hash chain, so the router never finds a single match in the event table. Every worker gets the same uncached-token count, leaving only the in-flight term, and routing quietly degrades to least-in-flight. There are no errors and zero overpredictions (predicted hits are always 0)—hit rate just silently falls off a cliff. Notice that in shadow mode (where the router indexes its own hashes), the exact same template mismatch would remain invisible because the router agrees with itself; only when the index comes from engine events—which is how Kinference works—must tokenization match token-for-token. That is why Kinference defaults to vLLM's /render endpoint, and why TokenizeMode docs tell you to run compare first and verify kinference_tokenize_compare_total{result="divergence"} stays at zero before switching to local, warning bluntly: "otherwise prefix-cache routing is silently wrong."

An overly optimistic routing table hurts, though modestly. At 4× table capacity, shared goodput falls from 200.33 to 178.73/s (−10.8%), p99 climbs from 128.25 to 156.77 ms, and 2.70% of requests are predicted as hits that turn out to miss. hot is barely affected (213.80 vs. 216.33) because hot prefixes are touched constantly and never get evicted. The structural flaw of shadow mode is that it never observes real evictions; Kinference subscribes to KV events and replays on sequence gaps specifically to prevent this drift.

Event delay and missing dispatch credit barely register in this workload (at 200 ms delay, goodput is 202.73 vs. 203.00, with 0.92% overpredict). That does not mean they don't matter—it means our 32 prefixes are fixed and already warmed up during the 4 s warmup, so the measurement window contains no sudden arrival of brand-new prefixes. What actually exposes that gap is cold start or bursts of new prefixes: before the first KV event arrives, a volley of requests sharing a new prefix looks like a miss on every worker and gets sprayed across multiple GPUs, recomputing the same prefix everywhere. Kinference's dispatched-prefix tracking and compute_layered_overlap target that exact window. I did not construct a bursty new-prefix workload, so I have no data quantifying its magnitude.


8. How to Interpret These Results Without Turning a Mock into Marketing

8.1 Hit Rate Is Not the Objective Function

The hot workload makes this crystal clear: prefix achieves a 96.74% hit rate—essentially tied with kv's 96.66%—yet delivers only 1/5.9 of kv's goodput. Cache affinity saves prefill time, but TTFT also includes queuing; only by putting both into a common unit (predicted milliseconds in Kinference) can a router weigh "wait in line on a warm GPU" against "recompute on a cold GPU." Conversely, on 2-worker shared, kv willingly gives up ~7 percentage points of hit rate to buy better balance and a lower p99.

8.2 Why least Performs Even Worse Than rr on shared

Like rr, least ignores prefixes and lands at ~58% hit rate: every worker is trying to cram all 32 prefixes (~4,000 blocks) into 2,500 blocks. Yet least gets only ~1/4 of rr's goodput at 4 workers (10.13 vs. 44.87) and ~1/3 at 2 workers (5.07 vs. 14.60). Looking at the queue stats, least holds every worker tightly around 3.93 waiting requests (8 closed-loop clients competing for 4 slots), pushing median TTFT to ~172 ms—almost every request misses the 100 ms SLO. Under rr, queues are more uneven across workers, so a slice of requests still lands on shorter queues and clears the SLO. This is my hypothesis from aggregate queue metrics; I did not do per-request attribution.

8.3 A ~75 ms p50 Is an Artifact of Closed-Loop Concurrency

Even at 96% hit rate, kv's p50 hovers near 75 ms—far above the 5 ms idle cache-hit TTFT. With 8 clients per worker and 4 slots, ~4 requests are always waiting for a slot in steady state, and each slot is held for ~46.5 ms of decode. I only tested this single concurrency level instead of sweeping concurrency as Buoyant did; at a different concurrency, both the gaps and the ranking between policies could shift.

8.4 Why None of These Numbers Compare to Kinference's 95% / 7.4×

DimensionBuoyant BenchmarkThis Mock
EnginevLLM 0.31.0, Qwen-3.8-27B-FP8, L40SGo time.Sleep, no model
Prefill costReal GPU, ~6.7 s for a 16k-token miss2 ms + 25 µs/token, linear, serial per worker
DecodeShares GPU and interferes with prefill1.5 ms/token, mutually independent
Baselinekube-proxy random per connectionIn-process round-robin / least-in-flight / prefix-only
RouterFull predictor + in-flight model + KV events + replication overrideTwo-term linear score + shadow table
Workload16k / 8k tokens, open-loop and closed-loop sweeps2k / 1k tokens, single closed-loop concurrency
Statistics3 trials, paired stratified bootstrap CIsMedian of 3 reps, no confidence intervals

All this experiment establishes is the relative behavior of four policies inside the same mock, plus the direction of several failure modes. Whether any ratio looks close to—or far from—the official numbers proves nothing either way.

8.5 What Was Left Out

  • No heterogeneous workers (different GPUs, models, or block sizes)—which is precisely why Kinference groups by pool and calibrates per profile.
  • None of Kinference's quadratic prefill term, progress-discounted in-flight prefill, tent-shaped running penalty, top-K selection, or cache_replication_override; kv's hot-prefix "replication" is purely a side effect of score spillover.
  • No worker failures, restarts (which look like fresh empty-cache workers in Kinference), or autoscaling.
  • No implementation of InferencePolicy, and no deployment of Kinference itself.

9. My Take

  1. The real abstraction of KV-aware routing is converting cache hits into time, not finding the longest prefix. Kinference's predicted_wait_ms folds uncached blocks, remaining in-flight prefill, engine queues, and decode contention into a single millisecond figure. Even my bare-bones two-term linear score opened a ~6× goodput lead on the hot workload. A prefix-only router looks great under uniform traffic, then crushes a single GPU the moment a hot system prompt shows up—and hot system prompts are the norm in production.

  2. The most dangerous failures are silent. Tokenization or chat-template drift throws no errors; it simply drops hit rate back to random. An optimistic routing table quietly erodes p99. Kinference's observability design—defaulting to the engine's /render, offering a compare mode to count divergences, and logging predicted vs. observed latency on every request—is more worth copying than the scoring formula itself.

  3. Coefficients have to be fitted to your own data. Even inside the same repository, code defaults and Helm defaults differ by orders of magnitude (queue_ms_per_entry is 1000 vs. 0.2). Part of why my kv policy won so cleanly is that its prefill slope exactly matched the mock. In a real cluster, predictor miscalibration turns straight into bad routing decisions.

  4. The policy layer is designed in the right direction, but evaluate it against the code rather than the blog examples. consider / exclude / select / onEmpty cleanly separate hard constraints, optimization, and fail-closed defaults—far cleaner than scattering special cases inside a router. On be2a7ad, however, nothing produces request tags yet and semantic classifiers aren't implemented, so compliance rules like PII isolation cannot rely on tag guards today.

  5. This mock is good for building intuition, not for drawing production conclusions. If I were to push it further, the priorities would be: add bursty new-prefix arrivals to actually measure event delay and dispatch credit; sweep concurrency; and replace linear prefill / independent decode with a quadratic model and prefill-decode interference to check whether the policy ranking holds.


References

Related Posts

Repurposing GC Reachability to Catch Partial Deadlocks: Inside Go 1.27's goroutineleak Profiler

Go 1.27 ships the goroutineleak profiler in runtime/pprof and net/http/pprof. Rather than sampling stacks or guessing from goroutine counts, it adapts Go's tri-color mark-and-sweep GC to compute an inductive liveness fixpoint LIVE+(g)—pinpointing permanently blocked goroutines in production with near-zero false positives, while carrying sharp boundaries around memory overreach, O(n²) daisy-chains, and non-channel blocking.

Splitting encoding/json Into Two Layers and Putting It Back Together: Layering and Compatibility in Go's json/v2

Go 1.27 runs the old encoding/json package on top of v2: syntax (jsontext) and semantics (v2) are split apart, every behavioral difference is an option, and old and new code coexist in the same dependency graph without a flag day.

GitHub Rubicon: Coordinating Only Ref Updates—Benchmarking Repo-Wide Locks vs. Per-Ref CAS in Go

GitHub's new Git storage architecture, Rubicon, stores immutable objects in Azure Blob Storage, delegates reference and pack manifest transactions to Ref-CAS, and uses disposable virtual replicas and dedicated compaction nodes for reads, writes, and maintenance. Based on the full official post, this article explains the publication boundary and the workload assumptions behind per-ref parallelism, accompanied by a runnable minimal Go implementation: SHA-256 immutable objects, file and directory fsync before CAS, an ordered in-memory per-ref log, and a repo-wide mutex baseline. Across 36 runs, all 216,000 acknowledged pushes passed in-process verification. At N=32, median throughput on distinct refs was 15,216 push/s vs. 4,397 for the repo-wide lock; on the same ref, it dropped to 858 vs. 3,937 with a 93.6% attempt conflict rate. The ref log is not durable, so this proves neither crash recovery nor distributed consensus, and the numbers cannot be compared against GitHub's internal 7,200 push/s figure.