distributed-kv-caching
БесплатноБез исполняемых скриптовНе проверенSets up a shared L2 KV cache for self-hosted LLM inference on Amazon ElastiCache for Valkey, so GPU servers load prefill KV state over EFA RDMA instead of…
от aws★ 3 696 звёзд на GitHubОб этом скилле
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.
When this skill does not apply
- Amazon Bedrock managed inference (no self-hosted GPUs): point the builder to Bedrock prompt caching.
- Application caching (session stores, database query caching), LLM response caching, or semantic caching: route to the
amazon-elasticacheskill. - Short or never-repeated prompts (classification, translation, moderation), output-dominated work, or diffusion models.
Architecture
GPU Fleet Caching Layer Shared KV Store
┌─────────────┐ ┌──────────────┐ ┌────────────────────────┐
│ vLLM/SGLang │──ZMQ/gRPC──────▶│ LMCache MP │──EFA RDMA────▶│ ElastiCache │
│ Replica A │ │ Server │ (or TCP) │ cache.i8ge.48xlarge │
├─────────────┤ │ │ │ Valkey 9.1+ large-obj │
│ vLLM/SGLang │──ZMQ/gRPC──────▶│ L1: CPU RAM │ │ DRAM + NVMe tiers │
│ Replica B │ │ L2: Valkey │ │ per shard │
└─────────────┘ └──────────────┘ └────────────────────────┘
Write path: after prefill, KV chunks go to LMCache L1 (CPU RAM), then asynchronously to L2. Read path: LMCache looks up L1, then L2, and loads hits into L1; the engine copies them to GPU memory.
Transports
The transport field of the LMCache Valkey L2 adapter selects the transport. Every reference uses this definition.
| Transport | Data commands | Key type | Uses the NVMe tier | Needs EFA | LMCache build needs | TTL write | Use for |
|---|---|---|---|---|---|---|---|
tcp (default) |
SET, GET, EXISTS, DEL over TLS |
Plain Valkey string | No | No | The Valkey L2 adapter (any build) | In the same SET ... EX |
Functional tests. Works with any ElastiCache Valkey cluster. |
blob-tcp |
BLOB.TCP_SET, BLOB.TCP_GET over TLS |
Module object | Yes | No | blob_tcp_worker_pool.py in lmcache/v1/distributed/l2_adapters/valkey/ |
Separate EXPIRE, not atomic |
Tests of the module path on hosts without EFA |
rdma |
BLOB.RDMA_SET, BLOB.RDMA_GET, zero-copy over EFA. Control commands use TLS. |
Module object | Yes | Yes, with RDMA write on the efa-direct fabric |
rdma_worker_pool.py in the same folder, and valkey-glide-sync with RDMA |
Separate EXPIRE, not atomic |
Production |
blob-tcp and rdma write the same key type and can share a key_prefix. tcp MUST NOT share a key_prefix with either: a plain GET cannot read a module key, and the module cannot read a plain string.
Reference loading
Load only the references for the current step: the Typical workflow names them. Do not preload all references. Before you run a command block from any reference, run "Shell setup and helpers" in references/elasticache-setup.md: every reference uses its variables and helpers.
| Reference | Load when |
|---|---|
| references/cost-assessment.md | Is L2 worth it? Measure recompute, run KVTrace, build the business case |
| references/elasticache-setup.md | Create, check, or delete the cluster, users, ACLs, eviction; b |
Установить distributed-kv-caching в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл distributed-kv-caching?
Sets up a shared L2 KV cache for self-hosted LLM inference on Amazon ElastiCache for Valkey, so GPU servers load prefill KV state over EFA RDMA instead of recomputing it. Checks fit, estimates savings with KVTrace, builds a business case, creates the cache, connects vLLM or SGLang (also as NVIDIA Dynamo or llm-d workers) through an LMCache server, tunes for cost or latency, and troubleshoots. Use when a builder serves open-weight models on GPUs (for example H100 or B200, on Amazon EC2 or Amazon EKS) for multi-turn chat, agents, RAG, or long contexts and asks about KV cache offloading, prefix cache sharing, prompt caching for self-hosted models, LMCache with Valkey, or lower TTFT or GPU cost. Not for Bedrock prompt caching, LLM response or semantic caching, or general application caching.
Как установить скилл distributed-kv-caching?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл distributed-kv-caching запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic