--- title: "vLLM & Mooncake Store (NVIDIA)" slug: "vllm-mooncake-store-nvidia" description: "Configure vLLM with Mooncake Store and VAST Data to spill KV cache from GPU to DRAM and NFS, improving warm TTFT for long-context LLMs." tags: ["vLLM", "NVIDIA"] updated: 2026-11-09T20:14:34Z published: 2026-11-09T20:14:34Z canonical: "docs.vastdata.com/vllm-mooncake-store-nvidia" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.vastdata.com/llms.txt > Use this file to discover all available pages before exploring further. # vLLM & Mooncake Store (NVIDIA) ## Mooncake Store As long-context LLM inference scales, GPU High Bandwidth Memory (HBM) rapidly becomes the primary bottleneck due to linear Key-Value (KV) cache expansion. Integrating **Mooncake Store**, host DRAM, and VAST Data creates a path that spills KV from GPU → DRAM → NFS, bypassing GPU memory bounds and cutting warm Time-To-First-Token (TTFT) when prefixes hit the DRAM and storage tiers. Mooncake Store replaces vLLM’s own DRAM pool and is controlled in a separate process, so the pool survives an inference engine crash. vLLM connects to that pool and does not hold it. This guide details how to configure vLLM with Mooncake Store against high-performance VAST storage volumes over RDMA-enabled fabrics for production inference. ## Prerequisites Please make sure you have completed the File Prerequisites before starting this guide, as it can drastically impact performance. ## Motivation **GPUs**: The testing environment utilizes 2x NVIDIA RTX PRO 6000 Blackwell - **Network**: - The host is equipped with 2x Mellanox CX-7 200GbE Single-Port NICs - The network configuration for VAST storage is [NFSv3 over RDMA](https://www.vastdata.com/blog/meet-your-need-for-speed-with-nfs) - **Storage**: The team tested two primary configurations for KV cache offloading: - Local host: Mooncake DRAM pool, offload disabled - Remote VAST Data storage: the same pool, write-through onto a VAST partition via NFSv3 over RDMA, with NFS multipath - **Software**: - **vLLM:** Version **0.32.0** - **Mooncake:** Version **0.3.14** - **NVIDIA CUDA:** proprietary accelerated computing platform with programming models, compilers, libraries, runtimes, and deployment tools - **Model:** Llama-4-Scout-17B-16E-Instruct-FP8, TP-2 We evaluated a tp=2 configuration across concurrency levels, tuning the system according to the File Prerequisites guidelines to maximize performance: - nconnect: Set to 32 - Mooncake Store configuration, detailed below ## Results We measured warm TTFT and token throughput with a VAST storage backend and without, at concurrency 50, 100, 150, and 200. Both setups use the same DRAM pool. Without offload, the warm pass matches the cold pass. | Concurrency | Warm mean TTFT, no offload | Warm mean TTFT, NFS offload | Warm tok/s, no offload | Warm tok/s, NFS offload | | --- | --- | --- | --- | --- | | 50 | 366 s | 5.8 s | 8,000 | 592,315 | | 100 | 723 s | 10.9 s | 8,010 | 628,012 | | 150 | 1,084 s | 15.8 s | 7,999 | 610,809 | | 200 | 1,442 s | 20.4 s | 7,998 | 626,320 | ~74–78× warm tok/s ![warm-throughput-lines.png](https://cdn.us.document360.io/89b91113-5dc6-49db-86ec-57b16dc8ce56/Images/Documentation/warm-throughput-lines.png?sv=2026-02-06&spr=https&st=2026-11-24T03%3A23%3A30Z&se=2026-11-24T04%3A23%3A30Z&sr=b&sp=r&sig=gGeqojpmQFFiEIx6fwlfG%2BlK4LVmqz3hmbmsP7NNKck%3D) Warm NFS read, Concurrency 200. Mean receive 335 Gbit/s (~83% line-rate) while the read is on the wire, peak 376(~94% line-rate) - Line rate is 400 Gbit/s ![warm-nic-c200.png](https://cdn.us.document360.io/89b91113-5dc6-49db-86ec-57b16dc8ce56/Images/Documentation/warm-nic-c200.png?sv=2026-02-06&spr=https&st=2026-11-24T03%3A23%3A30Z&se=2026-11-24T04%3A23%3A30Z&sr=b&sp=r&sig=hZSvb9LlNau6pGcEPdQxchgrhiqZjBtRZoo1bE0txFs%3D) ~63–71× warm mean TTFT ![warm-ttft-lines.png](https://cdn.us.document360.io/89b91113-5dc6-49db-86ec-57b16dc8ce56/Images/Documentation/warm-ttft-lines.png?sv=2026-02-06&spr=https&st=2026-11-24T03%3A23%3A30Z&se=2026-11-24T04%3A23%3A30Z&sr=b&sp=r&sig=Sq0fsUqKMX%2FjyFd%2FAl0WgZ9bBUcw8EHeQetAtLcicrg%3D) ## Software Stack We’ll be using the following NVIDIA Stack: 1. vLLM(*) - version **0.32.0**, CUDA 12.9. Mooncake 0.3.14 is installed by the Dockerfile below. 2. Model - `nvidia/Llama-4-Scout-17B-16E-Instruct-FP8` ## Installation - NVIDIA We’ll be working in the working directory `/root/vastdata`, and have `cfg` and `models` underneath it. We’ll also be using the `/mnt/kvcache-2ports` from earlier, so be sure you have this tree ready ```bash BASE_DIR="/root/vastdata" MODEL_DIR="${BASE_DIR}/models/llama-4-scout" CACHE_DIR="/mnt/kvcache-2ports" CFG="${BASE_DIR}/cfg"   # start.sh, mooncake.json, vllm_kv_transfer.json mkdir -p ${BASE_DIR} ${MODEL_DIR} ${CFG} ${CACHE_DIR}/mooncake ``` Copy this package into `${BASE_DIR}` (Dockerfile, `cfg/start.sh`, `cfg/mooncake.json`, `cfg/vllm_kv_transfer.json`, `run.sh`). Downloading the model locally ```bash python3 -m venv "${BASE_DIR}/.venv" source "${BASE_DIR}/.venv/bin/activate" pip install "huggingface_hub[cli]" hf download nvidia/Llama-4-Scout-17B-16E-Instruct-FP8 \  --local-dir "${MODEL_DIR}" ``` ## Why the Dockerfile builds Mooncake from source The released Mooncake wheel hard-codes an io_uring queue depth of 32. The Dockerfile rebuilds `mooncake-store/src/uring_file.cpp` with `QUEUE_DEPTH` 255, the largest value the 8-bit completion index allows. That is the build behind the warm results above. The source-built wheel links `libgflags`, `glog`, `libjsoncpp`, `liburing`, and `libyaml-cpp` dynamically. The release wheel bundled them, so the runtime stage installs those packages. Use 0.3.14 or newer. That release keeps the tail partial bucket of each offload heartbeat. Earlier builds dropped it on write-through. ### `./cfg/mooncake.json` `local_buffer_size` is 4 GiB per rank. The DRAM pool is `--global_segment_size` on the owner client. ```json {  "mode": "standalone-store",  "metadata_server": "P2PHANDSHAKE",  "master_server_address": "127.0.0.1:50051",  "protocol": "rdma",  "device_name": "",  "global_segment_size": 0,  "local_buffer_size": "4GB",  "enable_offload": true } ``` ### `./cfg/vllm_kv_transfer.json` ```json {  "kv_connector": "MooncakeStoreConnector",  "kv_role": "kv_both" } ``` ### `./cfg/start.sh` ```bash #!/usr/bin/env bash set -euo pipefail # The owner client rewrites mooncake.json onto a writable path. /cfg is mounted read-only. PROTOCOL="rdma" DATA_HOST="${MOONCAKE_DATA_HOST:-127.0.0.1:18001}" DEVICE="${MOONCAKE_DEVICE:-}" if [[ "$PROTOCOL" == "rdma" && "$DATA_HOST" == 127.* ]]; then  ipaddr="$(ip -4 -o addr show scope global 2>/dev/null | awk '{print $4}' | head -1 | cut -d/ -f1 || true)"  if [[ -z "$ipaddr" ]]; then    echo "RDMA Mooncake needs MOONCAKE_DATA_HOST=:18001" >&2    exit 1  fi  DATA_HOST="${ipaddr}:${DATA_HOST##*:}" fi if [[ "$PROTOCOL" == "rdma" && -z "$DEVICE" ]]; then  DEVICE="$(find /sys/class/infiniband -mindepth 1 -maxdepth 1 -printf '%f\n' 2>/dev/null | paste -sd, - || true)" fi if [[ "$PROTOCOL" == "rdma" && -z "$DEVICE" ]]; then  echo "no RDMA devices under /sys/class/infiniband; set MOONCAKE_DEVICE=mlx5_0,mlx5_1" >&2  exit 1 fi export MOONCAKE_DEVICE="$DEVICE" python3 - <<'PY' import json, os from pathlib import Path cfg = json.load(open("/cfg/mooncake.json")) device = os.environ.get("MOONCAKE_DEVICE", "") if device:    cfg["device_name"] = device Path("/tmp/mooncake.json").write_text(json.dumps(cfg)) PY # Same-host RDMA: pin each HCA to the matching peer so mlx5_0 does not target mlx5_1. export MC_STORE_MEMCPY=1 export MC_ENABLE_DEST_DEVICE_AFFINITY=1 export MOONCAKE_OFFLOAD_FILE_STORAGE_PATH="${MOONCAKE_OFFLOAD_FILE_STORAGE_PATH:-/kvcache/mooncake}" export MOONCAKE_OFFLOAD_STORAGE_BACKEND_DESCRIPTOR=bucket_storage_backend export MOONCAKE_OFFLOAD_USE_URING=1 export MOONCAKE_USE_URING=1 # 16 GiB owner buffer for the storage tier. This is not the per-rank local buffer. export MOONCAKE_OFFLOAD_LOCAL_BUFFER_SIZE_BYTES=17179869184 export MOONCAKE_OFFLOAD_HEARTBEAT_INTERVAL_SECONDS=1 export MOONCAKE_OFFLOAD_FLUSH_PARTIAL_BUCKETS=1 mkdir -p "$MOONCAKE_OFFLOAD_FILE_STORAGE_PATH" chmod 0777 "$MOONCAKE_OFFLOAD_FILE_STORAGE_PATH" 2>/dev/null || true # Write-through: offload_on_evict=false copies KV to NFS as it is admitted. mooncake_master \  --rpc_port=50051 \  --metrics_port=9003 \  --enable_offload=true \  --offload_on_evict=false \  --offloading_queue_limit=500000 \  --offload_cap_ratio=0.8 \  --eviction_high_watermark_ratio=0.9 \  --eviction_ratio=0.05 \  --default_kv_lease_ttl=30000 & MASTER_PID=$! CLIENT=(  mooncake_client  --global_segment_size=180GB  --master_server_address=127.0.0.1:50051  --metadata_server=P2PHANDSHAKE  --protocol=rdma  --port=50052  --enable_offload=true  --threads=16  --enable_http_server=true  --http_port=9300  --host="$DATA_HOST" ) if [[ -n "$DEVICE" ]]; then  CLIENT+=(--device_names="$DEVICE") fi "${CLIENT[@]}" & CLIENT_PID=$! cleanup() { kill "$CLIENT_PID" "$MASTER_PID" 2>/dev/null || true; } trap cleanup EXIT probe() { (echo > "/dev/tcp/$1/$2") >/dev/null 2>&1; } for _ in $(seq 1 60); do probe 127.0.0.1 50051 && break; sleep 1; done probe 127.0.0.1 50051 || { echo "mooncake_master failed readiness on :50051" >&2; exit 1; } CLIENT_IP="${DATA_HOST%%:*}" for _ in $(seq 1 60); do  probe 127.0.0.1 50052 || probe "$CLIENT_IP" 50052 && break  sleep 1 done probe 127.0.0.1 50052 || probe "$CLIENT_IP" 50052 \  || { echo "mooncake_client failed readiness on :50052" >&2; exit 1; } KV_TRANSFER_CONFIG=$(python3 -c 'import json; print(json.dumps(json.load(open("/cfg/vllm_kv_transfer.json")), separators=(",", ":")))') export MOONCAKE_CONFIG_PATH=/tmp/mooncake.json export PYTHONHASHSEED=0 export VLLM_MOONCAKE_STORE_TIER_LOG=1 export VLLM_MOONCAKE_LOAD_RECV_THREADS="${VLLM_MOONCAKE_LOAD_RECV_THREADS:-4}" # 4 GiB per rank (vLLM default). Host staging is 4 GiB times tensor-parallel size. export MOONCAKE_LOCAL_BUFFER_PER_RANK_GIB="4" export MOONCAKE_LOCAL_BUFFER_HOST_TOTAL_GIB="8" export MOONCAKE_PREFERRED_SEGMENT="$DATA_HOST" exec vllm serve /models/model \  --host 0.0.0.0 --port 8000 \  --served-model-name llama-4-scout \  --tensor-parallel-size 2 \  --max-model-len 131072 \  --max-num-seqs 256 \  --max-num-batched-tokens 8192 \  --renderer-num-workers 8 \  --gpu-memory-utilization 0.92 \  --enable-prefix-caching \  --block-size=64 \  --kv-transfer-config "${KV_TRANSFER_CONFIG}" ``` ### `./run.sh` ```bash #!/usr/bin/env bash set -euo pipefail BASE_DIR="/root/vastdata" MODEL_DIR="${BASE_DIR}/models/llama-4-scout" CACHE_DIR="/mnt/kvcache-2ports" CFG="${BASE_DIR}/cfg" IMAGE="${IMAGE:-vllm-mooncake:0.32.0-mooncake0.3.14-qd255}" NAME="${NAME:-vllm-mooncake}" # io_uring needs an unconfined seccomp profile. RDMA needs the InfiniBand device nodes. RDMA_ARGS=() for dev in /dev/infiniband/rdma_cm /dev/infiniband/uverbs* /dev/infiniband/umad*; do  if [[ -e "$dev" ]]; then RDMA_ARGS+=(--device "$dev"); fi done mkdir -p "$CACHE_DIR" "${CACHE_DIR}/mooncake" chmod +x "${CFG}/start.sh" docker rm -f "${NAME}" >/dev/null 2>&1 || true docker run --name "${NAME}" -d \  --network host --ipc host --shm-size 128g \  --ulimit memlock=-1 --ulimit stack=67108864 \  --gpus all \  -v "${MODEL_DIR}:/models/model:ro" \  -v "${CACHE_DIR}:/kvcache:rw" \  -v "${CFG}:/cfg:ro" \  --security-opt seccomp=unconfined \  --cap-add IPC_LOCK \  "${RDMA_ARGS[@]}" \  -e PYTHONHASHSEED=0 \  --entrypoint bash "${IMAGE}" /cfg/start.sh echo "started ${NAME}; logs: docker logs -f ${NAME}" ``` ### `./Dockerfile` ```dockerfile # vLLM 0.32 plus Mooncake Store (master and one owner client). # # vLLM 0.32 MooncakeStoreConnector does not read a filesystem path. Storage # offload is the sidecar mooncake_client. vLLM runs in standalone-store mode # and contributes no DRAM of its own. # #   docker build \ #     --build-arg BASE_IMAGE= \ #     -t vllm-mooncake:0.32.0-mooncake0.3.14-qd255 . ARG BASE_IMAGE FROM ${BASE_IMAGE} AS mooncake-builder # 0.3.14 is the first release that keeps the tail partial bucket of every # offload heartbeat. Earlier builds dropped it on write-through. ARG MOONCAKE_VERSION=0.3.14 ARG MOONCAKE_URING_QUEUE_DEPTH=255 # The released wheel hard-codes an io_uring queue depth of 32. 255 is the # largest value Mooncake's 8-bit completion index supports. RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \      git libibverbs-dev librdmacm-dev libgflags-dev libgoogle-glog-dev \      libnuma-dev libssl-dev libcurl4-openssl-dev liburing-dev \      libyaml-cpp-dev libjsoncpp-dev libzstd-dev libxxhash-dev libboost-dev \      pkg-config \ && rm -rf /var/lib/apt/lists/* \ && git clone --recursive --depth 1 --branch "v${MOONCAKE_VERSION}" \      https://github.com/kvcache-ai/Mooncake.git /tmp/Mooncake \ && sed -i \      "s/static constexpr unsigned QUEUE_DEPTH = 32;/static constexpr unsigned QUEUE_DEPTH = ${MOONCAKE_URING_QUEUE_DEPTH};/" \      /tmp/Mooncake/mooncake-store/src/uring_file.cpp \ && sed -i \      "s/version = \".*\"/version = \"${MOONCAKE_VERSION}+qd${MOONCAKE_URING_QUEUE_DEPTH}\"/" \      /tmp/Mooncake/pyproject.toml \ && python3 -m pip install --no-cache-dir scikit-build-core \ && mkdir /tmp/wheels \ && CMAKE_BUILD_PARALLEL_LEVEL=16 python3 -m pip wheel \      --no-cache-dir --no-deps --wheel-dir /tmp/wheels /tmp/Mooncake FROM ${BASE_IMAGE} ARG MOONCAKE_VERSION=0.3.14 ARG MOONCAKE_URING_QUEUE_DEPTH=255 # The source-built wheel links these dynamically. The release wheel bundled them. RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \      libgflags2.2 libgoogle-glog0v6t64 libjsoncpp25 liburing2 libyaml-cpp0.8 \ && rm -rf /var/lib/apt/lists/* COPY --from=mooncake-builder /tmp/wheels/ /tmp/wheels/ RUN python3 -m pip install --no-cache-dir --force-reinstall --no-deps \      /tmp/wheels/mooncake_transfer_engine-${MOONCAKE_VERSION}+qd${MOONCAKE_URING_QUEUE_DEPTH}-*.whl \ && rm -rf /tmp/wheels \ && python3 -c "import importlib.util; spec=importlib.util.find_spec('mooncake.store'); assert spec and spec.origin, spec" \ && command -v mooncake_master \ && command -v mooncake_client ``` Build the image & Run it ```bash docker build \  --build-arg BASE_IMAGE= \  --build-arg MOONCAKE_VERSION=0.3.14 \  --build-arg MOONCAKE_URING_QUEUE_DEPTH=255 \  -t vllm-mooncake:0.32.0-mooncake0.3.14-qd255 . chmod +x cfg/start.sh run.sh ./run.sh ``` --- ## Additional resources - [https://github.com/kvcache-ai/Mooncake](https://github.com/kvcache-ai/Mooncake) - [https://hub.docker.com/r/vllm/vllm-openai/tags](https://hub.docker.com/r/vllm/vllm-openai/tags) (*) While optimized, they are frequently not the latest vLLM builds ## Final note As workloads and software stacks frequently change, performance opportunities and compatibility shifts may occur. VAST actively expands its capabilities in the KV cache space—contact our team directly to leverage our latest updates and maximize your performance.