-
[2026/06] MemCache enables PrefixCache acceleration for inference. See the deployment examples for the latest examples.
-
[2025/12] MemCache is available as a vllm-ascend backend to accelerate LLM inference. See the vllm-ascend open-source community and the usage example.
-
[2025/11] MemCache was open-sourced in November 2025. The community repository is https://gitcode.com/Ascend/memcache.
See the MemCache roadmap: Roadmap. See the MemCache branch release strategy.
MemCache is a high-performance distributed KVCache storage engine designed for LLM and GR inference. Its main features include:
- Object-based APIs: Supports individual and batch put, get, exist, and remove operations, plus read and write APIs for multilayer KV blocks.
- Tiered cache pools: Uses HBM, DRAM, and SSD as cache tiers and moves hot and cold data between tiers through prefetching and eviction.
- High bandwidth and low latency: Uses MemFabric as the foundation for tiered memory and heterogeneous network transfers.
On Ascend hardware,
device_rdma(A2),device_sdma(A3),host_rdma(A2/A3), anddevice_urma(A5) provide direct OneCopy data access across hosts and memory tiers. Kunpeng hardware supportshost_urma(K5). Thehost_shmprotocol provides shared-memory communication within a node. - Dynamic scaling: LocalService instances can join or leave at runtime.
- High availability: On Kubernetes, MetaService supports multiple active instances and metadata recovery for best-effort high availability.
MemCache consists of two core components: LocalService and MetaService.
-
MetaService
- Allocates and manages memory-pool capacity throughout the cluster and handles LocalService membership changes.
- MetaService runs as a standalone process. Start it through the Python API or launch the binary.
- Supports two deployment modes: 1. Standalone mode: A single MetaService process is easy to deploy, but creates a single point of failure. If the process crashes or becomes unreachable, the system cannot provide service until it recovers. 2. HA mode: Uses Kubernetes ClusterIP Services and Lease resources. This more complex deployment runs multiple MetaService instances for active-active high availability. See how to deploy a MemCache HA cluster.
-
LocalService: Provides the following functions:
- Client: Applications load LocalService as a shared library distributed as a wheel or shared object and invoke its API.
- Memory provider: Provides a contiguous memory region for the memory pool. Other LocalService instances can access it directly by address.
MemCache's core code follows a modular design, with the main implementation under src/memcache/csrc.
src/memcache/csrc/ # C++ core implementation
├── meta_service/ # MetaService: cluster metadata, allocation, and eviction
│ ├── mmc_meta_service.cpp # Main MetaService logic
│ ├── mmc_meta_manager.cpp # Metadata manager (global key-to-blob map)
│ ├── mmc_blob_allocator.cpp # Memory-pool allocator
│ ├── mmc_meta_container_lru.cpp # LRU metadata container (temperature tracking and eviction)
│ └── mmc_meta_net_server.cpp # RPC network server
├── client/ # Local client loaded by inference processes as a wheel/shared library
│ ├── mmc_client_default.cpp # Core client implementation (batch put/get/copy)
│ └── mmc_meta_net_client.cpp # RPC network client
├── local_service/ # LocalService: memory provider
│ ├── mmc_local_service_default.cpp # Main LocalService implementation
│ └── mmc_bm_proxy.cpp # MemFabric BM semantic proxy
└── under_api/ # Foundation integration layer (MemFabric / UBSIO)
├── mf_smem/ # MemFabric shared-library integration (HBM / DRAM tiers)
│ └── smem_bm_api.cpp # Batch memory-copy API
└── ubs_io/ # UBSIO shared-library integration (SSD tier)
├── mmc_ubs_io_proxy.cpp # UBSIO proxy wrapper
└── dl_ubsio_api.cpp # Dynamic loading of UBSIO
MemCache provides a high-capacity memory pool and high-performance H2D, D2H, D2RH, and RH2D transfers. Built on MemFabric, it uses OneCopy for direct transfers across hosts and memory tiers, including RH2D and D2RH. The diagram compares RH2D with paths that use an intermediate copy.
Based on OneCopy direct access across machines and media, the following performance tests were run on A2/A3. The benchmark simulates a DeepSeek-R1 KV block. A block spans 122 discrete addresses and contains 61 × 128 KB + 61 × 16 KB = 8,784 KB (about 8.57 MB).
- Read/write performance using a two-node memory pool with two Ascend A2 nodes (8 cards per node):
- Read/write performance using a two-node memory pool with two Ascend A3 nodes (8 cards and 16 dies per node):
See the following guides to get started:
- Installation and usage: install and use the wheel (Python) or build, install, and use the run package (C++).
- Configuration: Shared MetaService and LocalService configuration.
- Running examples: End-to-end C++ and Python examples.
- Remote development with DevContainer: Set up VS Code Remote-SSH and DevContainer, then run all examples.
- C++ API: C++ API overview and API list.
- Python API: Python API overview and API list.
- RESTful API: Monitoring APIs and API list.
- MemCache depends on MemFabric, so its compatibility requirements follow MemFabric. See the complete software and hardware compatibility guide for supported operating systems, Ascend/Kunpeng hardware, CANN versions, MemFabric versions, huge-page sizes, and other requirements.
See the FAQ for common questions.
This open-source project is not a Huawei product and provides limited support.



