Get started
Quickstart: run KVStash on one machine
Start the daemon with a DRAM tier, store a block, read it back and check the metrics. This is the same daemon production runs, with the NVMe and S3 tiers left off.
Last updated
Before you start
- A Linux machine, x86-64 or arm64, with 2 GB of free memory. macOS runs the daemon for development only.
- The
kvblockdandkvbctlbinaries on yourPATH. Both are static, so there is nothing else to install. Download the daemon from the install page: static binaries for Linux x86-64 and arm64 (macOS arm64 for development), with SHA-256 checksums, or run curl -fsSL https://kvstash.com/install.sh | sh. The container image and Helm chart are available on request. curlto read the health and metrics endpoints.
Check the binaries: kvblockd --version and kvbctl version each print a version string.
Run it
- Write a config file. This one keeps every listener on loopback and gives the hot tier 1 GiB.
# config.yaml: DRAM-only, loopback only. Every key is optional; # the full list is on the configuration reference page. listen_addr: "127.0.0.1:9440" # data plane (engines and kvbctl connect here) metrics_addr: "127.0.0.1:9442" # /metrics and /healthz dram_arena_bytes: 1073741824 # 1 GiB hot tier dram_hugepages: false namespaces_path: "/etc/kvblockd/namespaces.yaml" # use an absolute path nvme_paths: [] # no NVMe tier for the first run - Create a namespace. A namespace is a tenant: its own key space and its own token. A daemon with no namespaces accepts no connections, by design.
# namespaces.yaml: who may connect. With no namespaces, nobody can. namespaces: - { name: demo, id: 1, token: "demo-token" } # change before real use - Start the daemon. It stays in the foreground and logs to the terminal. Stop it later with Ctrl-C, which drains in-flight requests first.
sudo mkdir -p /etc/kvblockd sudo cp config.yaml namespaces.yaml /etc/kvblockd/ kvblockd --config /etc/kvblockd/config.yamlThe last lines of the log name each listener, ending with
kvblockd listening addr=127.0.0.1:9440. The admin listener for adding tenants at runtime is off in this config; turn it on when you need it. - Check that it is ready. In a second terminal:
curl -s 127.0.0.1:9442/healthz # okWhile the daemon is still starting,
/healthzanswers HTTP 503 withstarting. - Store a block and read it back.
kvbctlturns a plain name likegreetinginto a 32-byte key by hashing it, which is convenient for tests. Engines derive their own keys.export KVBCTL_TOKEN=demo-token # keeps the token out of argv echo "hello" | kvbctl put -ns demo greeting - # stored 6 bytes kvbctl get -ns demo greeting # hello kvbctl exists -ns demo greeting # consecutive=1 # greeting OK - Look at the counters. The bytes you wrote and read show up in Prometheus format. The
nslabel is the namespace id fromnamespaces.yaml.curl -s 127.0.0.1:9442/metrics | grep -E '^kvb_(bytes_total|hits_total|blocks)' # kvb_blocks{tier="dram"} 1 # kvb_bytes_total{dir="in",ns="1"} 6 # kvb_bytes_total{dir="out",ns="1"} 6 # kvb_hits_total{ns="1",tier="dram"} 1
What just happened
putopened a connection, authenticated into thedemonamespace once, and wrote the block with a two-phase commit: the block is visible to readers only after the commit is acknowledged.getread it back. The client checks the block's xxh3 checksum before printing a byte.existsasked how many keys, from the start of the list, are present. Engines use this to find how much of a prompt prefix they can skip.- The block lives in DRAM only. Restart the daemon and it is gone. That loss is safe, because a KV block can always be recomputed; add an NVMe tier to keep blocks across restarts.
Next steps
- Connect vLLM or SGLang to this daemon. Add a namespace for the engine first.
- Add an NVMe tier so blocks survive a daemon restart, then S3 for a cold tier.
- Replace the demo token before anything other than loopback can reach port 9440.
- Scrape
/metricswith Prometheus and import the Grafana dashboard.
Something missing or wrong on this page? Email rudray@kvstash.com and it gets fixed.