← Blog

Self-hosted LLM sessions need distributed KV caching, not cold prefill

AWS’s Agent Toolkit skill for distributed KV caching with Amazon ElastiCache guides coding agents through fit checks, KVTrace savings estimates, and LMCache setup on vLLM/SGLang — targeting up to 40% lower inference cost and 80% faster TTFT when long agent contexts would otherwise recompute on every turn.

LLM OpsAgentic AIEnterprise

Long agent and chat threads pay twice: once to build context, again when the next GPU has none of that KV state and runs full prefill before the first token. Local per-server caches do not survive routing shifts or lunch breaks.

AWS published on November 21, 2026 a walkthrough of the distributed KV caching skill in the Agent Toolkit for AWS. Distributed KV caching with Amazon ElastiCache extends GPU-local caches with a shared tier so any server can reuse key-value attention state across sessions, routing changes, and failures — AWS cites up to 40% lower self-hosted inference cost and up to 80% faster time to first token. The skill works with Kiro, Claude Code, OpenAI Codex, and other Agent Skills–compatible coding agents: it runs a fit check (read-only fleet/`EFA` discovery, engine/model/TP/KV type, repeat rate), estimates savings with KVTrace before spend, stops when cache cost would not pay back, and configures LMCache on existing vLLM or SGLang stacks (including llm-d and Ray Serve) with a shared KV ID hash/seed and explicit KV data type so servers do not write keys others cannot read. Prerequisites called out include EFA-capable GPUs (e.g. p5), recent LMCache/vLLM or SGLang, and ElastiCache for Valkey 9.1+ on the stated node class for setup flows.

What inference platform owners should require before buying more GPUs for “slow resume”:

  • Measure cold-prefill TTFT on returning long sessions; treat shared KV as the fix when prefix cache alone is insufficient
  • Run KVTrace (or equivalent) on real traffic before provisioning cache — short prompts can make load slower than recompute
  • Standardize KV ID and data type across the fleet so hit rates reflect reuse, not key mismatch

Self-hosted agents get expensive when every turn rebuilds history. Distributed KV caching — and a skill that evaluates it before spend — is how that cost becomes optional.