distributed-kv-caching
Distributed KV Caching
Overview
During prefill, an inference engine computes attention key-value (KV) tensors for every prompt token. A shared L2 KV cache on Amazon ElastiCache keeps these tensors, so any GPU server in the fleet can load a returning prefix instead of computing it again. This decreases time-to-first-token (TTFT) and frees GPU time. The cache runs on cache.i8ge.48xlarge nodes with the valkey-large-object module; an LMCache server on each GPU server connects it to vLLM or SGLang over RDMA on Elastic Fabric Adapter (EFA).
The AWS MCP server is recommended for sandboxed execution and audit logging. Every step also works with the AWS CLI directly. Secret steps MUST NOT go through an AWS API tool (Security considerations).
When this skill applies
- Self-hosted open-weight LLMs on GPUs (EC2, EKS, or similar) with vLLM or SGLang, directly or as vLLM workers under NVIDIA Dynamo or llm-d
- Long shared prompt prefixes (system prompts, RAG context, tool definitions, multi-turn history)
- Several GPU servers, changing routing, or GPU and host memory that evict prefixes before reuse
- A goal of lower TTFT, more requests per GPU, or lower cost per request
TensorRT-LLM: No final TensorRT-LLM release includes the LMCache MP connector; pre-release builds do, and they work with this setup. This skill gives no TensorRT-LLM engine steps; the LMCache server and ElastiCache steps are the same for every engine. For the engine side, follow the TensorRT-LLM release notes and the LMCache docs. KVTrace records only vLLM and SGLang.