Skip to content

P2P prefix-cache sharing

This path is GPU and Intel XPU only in llm-d 1.0: there is no TPU overlay, so on TPU use tiered prefix cache and precise prefix-cache routing instead. This page summarizes what llm-d's Enable P2P Prefix Cache Sharing guide does and what it requires, so you can recognize when a TPU equivalent would help. Chapter 20 covers the KV tiers it builds on.

When to use it (on GPU)

The path is marked experimental. Any vLLM pod pulls cached prefix KV blocks from a peer's CPU offload tier over NIXL, CPU to CPU, instead of recomputing them. It composes three pieces: vLLM's OffloadingConnector with a P2P secondary tier on port 7777 (every pod is both source and puller), the precise KV-event index from precise prefix-cache routing, and the router's p2p-source-producer, which picks a source when it holds at least minCachedTokenDelta (2048 shipped) more prefix tokens than the scheduled pod. It pays for long shared prefixes, many sessions pinned to owner pods, and multi-turn sessions on P/D disaggregation.

Prerequisites

ACCELERATOR_TYPE Model Layout Status
gpu openai/gpt-oss-120b 2 replicas x TP=1, 160 GiB memory per pod, TCP (base) or RDMA (rdma) community
xpu Qwen/Qwen3-0.6B 2 replicas x 1 GPU via DRA, TCP only community

SGLang has no equivalent of the P2P tier, so the path is vLLM only.

Steps

1. Deploy (GPU)

The commands in the llm-d guide follow the same pattern as the other paths, with GUIDE_NAME=p2p-kv-cache-sharing, NAMESPACE=llm-d-p2p-kv-cache-sharing and INFRA_PROVIDER set to base or rdma. Run them from that page; they have no TPU variant. On TPU, deploy the tiered prefix cache instead.

Check: the llm-d guide's P2P pull check shows the consumer pod's external prefix-cache counters growing after it is sent a prefix the source computed.

2. Keep the peers compatible

Every peer must agree, or requests silently recompute:

  • the same --block-size on every pod (the router's blockSizeTokens may differ);
  • the same PYTHONHASHSEED fleet-wide, or no block hash ever matches across pods;
  • --kv-events-config on every serving pod with the routing sidecar's port (8000) in the topic, not the engine's (8200);
  • self_describing_kv_events: true in the offloading connector's extra config;
  • matched tensor parallelism between peers that serve each other;
  • a CPU tier (cpu_bytes_to_use) about 2x the per-pod device KV cache, with /dev/shm above it and the pod memory limit above both.

Check: no EPP log line shows bestCachedTokens:0 for every request, and no rejecting peer connect: block_len mismatch.

Troubleshooting

Symptom Cause Fix
No pulls; EPP logs bestCachedTokens:0 for every request Index empty: block size, missing KV events, topic port or PYTHONHASHSEED mismatch Rerun the render and pull checks
rejecting peer connect: block_len mismatch --block-size differs between pods Align it everywhere
Pulls fire but hit rate near 0 CPU tier too small; prefixes evicted before peers ask Grow cpu_bytes_to_use and /dev/shm
You run on TPU No TPU overlay for this path Use the TPU host or Lustre tier in Tiered prefix cache

References