vado / docs
GitHub

Start here

Architecture

A router per connection, shard objects running Valkey with their AOF in SQLite, and memory-only replicas in other regions. What each part owns, and what it costs.

One database, end to endClick a box to read about itSwipe to explore
How a client reaches a vado databaseClients connect over TCP, a WebSocket or a service binding to a router in the Worker. The router reads the catalog, sends commands to shard Durable Objects running Valkey with its AOF in SQLite, and reads from replicas in other regions. Rewriters compact each shard's AOF. A Watcher polls shards and replicas for the dashboard.valkey-cli, ioredisTCP via Spectrumvado-shimWebSocket /wsYour Workerservice bindingRouterone per connectionCatalogdatabases, placementShardsValkey wasm + AOFRewritersAOF compactionRead replicasother regionsWatcherdashboard, /live
A client arrives over TCP through Spectrum, over the /ws WebSocket through vado-shim, or from another Worker through a service binding. Each connection gets its own router. AUTH names the database, and the router reads its shard count and placement from the catalog once, then keeps it.
Selected pathOther callsResponsibilities, not machines

A box is a responsibility. Shards, replicas, the pub/sub shard and the __meta shard all run the same Durable Object code under different names. An arrow is a call path, not a statement about which machine runs it.

Where everything lives

PartWhereHolds
RouterIn the Worker, wherever the connection landsPer-connection state only
ShardsDurable Objects at the database's regionsValkey's data, and its AOF in SQLite
Read replicasOne per shard per replica regionA copy of one shard, in memory
RewritersOne per shard, created on its first rewriteA copy of the AOF files during a rewrite
Pub/sub shardOne per databaseEvery channel of that database; messages aren't stored
__meta shardOne per server flavourNothing; it answers COMMAND for the routers' key tables
CatalogOne objectEach database's record
WatcherOne per watched database, near its first viewerFive minutes of history, in memory
PulseOne objectEach router process's open connections, in memory
SendersOne per region, only while test traffic runsThe traffic's database and deadline
DashboardThe same Worker, loaded on the first page requestNothing

You don't run a server or a cluster manager. You still own the shard counts, the placement, the password, and what your clients do when a shard resets.

How clients reach it

Spectrum · /ws · service binding

Owns
Three ways in, all ending at the same router: raw TCP through a Spectrum application, RESP over the /ws WebSocket, or connect() from another Worker.
Why
A Worker's public URL takes HTTP, not raw TCP. Spectrum carries TCP to it, and the shim carries any client over a WebSocket.
How it helps
Stock clients work unchanged on every path. A service binding never leaves Cloudflare.
Trade-off
A WebSocket can't push back on its sender. A client that outruns its router by 16 MB is disconnected, and the shim acknowledges what it has read so the router stops past 8 MB unread.

Router

Worker · one per client connection

Owns
One connection: parsing, AUTH, the selected database, MULTI and WATCH state, and an upstream per shard and replica it has used.
Why
Clients expect one server. Redirecting between shards would need cluster-aware clients.
How it helps
Single-slot commands pass through unchanged and pipelined. Multi-key commands that are safe to split are split and merged in order; whole-database commands go to every shard.
Trade-off
One more hop than talking to a shard. Other multi-key commands across slots get CROSSSLOT.

Shards

ValkeyShard to ValkeyShard7 · <db>.<created>.<i>

Owns
A contiguous range of the 16,384 slots, in a Valkey 9.1 server compiled to wasm, with its AOF in the object's SQLite.
Why
Running Valkey's code keeps every reply, error and edge case Valkey's own.
How it helps
With appendfsync always and a write-through file system, a reply leaves only after its write is stored. A reset shard replays its AOF and carries on.
Trade-off
Data lives in Valkey's memory: at most 64 MB per shard inside a 128 MB memory limit, and wasm memory never shrinks.

Read replicas

ValkeyShard8 to ValkeyShard15 · <shard>.r.<region>

Owns
A copy of one shard in one region, in memory only.
Why
A shard lives in one place, so a far client pays that distance on every read, and a primary's replies also wait for its commits.
How it helps
The primary sends its AOF files as a starting copy, then every committed append. Routers read from the replica in their region, which has no commits to wait for.
Trade-off
A read on another connection can be one replication lag old. Each replica's stream holds back the primary's writes.

Rewriters

ValkeyRewriter to ValkeyRewriter7 · named like their shard

Owns
One AOF rewrite at a time for one shard, in a Valkey of its own.
Why
Valkey compacts its AOF in a forked child. wasm has no fork(), so a rewrite inside the shard would block it.
How it helps
The rewriter loads a copy of the files, rewrites, and sends back a new base. The shard keeps serving and swaps it in.
Trade-off
Each rewrite copies the files to another object and the base back. After a rewriter fails, the shard rewrites inline for 10 minutes.

Catalog

Catalog · one object named catalog

Owns
Every database's name, creation time, shard count, regions, replica regions, flavour and password hash.
Why
Routing must be computed, not looked up per command, and a shard count must never change under existing keys.
How it helps
A record never changes after creation, so each Worker process fetches it once and keeps it.
Trade-off
No online resharding or moving. A different size or placement means a new database.

Watcher, Pulse and the dashboard

Watcher · Pulse · apps/dashboard

Owns
The Watcher keeps five minutes of history for one watched database. Pulse holds each router process's latest report of its open connections.
Why
Routers run in many places and share nothing, so something has to collect what the dashboard shows.
How it helps
The Watcher polls shards and ready replicas once a second while anyone has /live open, and stops when nobody does.
Trade-off
Both keep everything in memory, so a reset loses the history. Each watched database costs a poll of every shard and replica a second.

What the design buys, and costs

ChoiceBenefitCost
Real Valkey in wasmValkey's behaviour for every command64 MB per shard; memory never shrinks
AOF in SQLite, appendfsync alwaysAcknowledged writes survive resets and deploysEach write waits for a storage commit
Group commitUnder load, one commit carries many writesInput waits while two commits run
Rewrites in a helper objectThe shard keeps serving during a rewriteFiles copied both ways
Replicas fed by the AOFNearby reads that don't wait for commitsStale reads across connections
A router per connectionStock clients, no cluster supportAn extra hop; cross-slot limits
Eight shard classesA database's first 8 shards never share memoryMore bindings to keep
Size and placement fixed at creationRouting is computed, with no directoryNo resharding
Backpressure on every hopMemory stays bounded under any loadOverload slows clients down

Browse topics or type to search

Introductionvado runs real Valkey 9.1, compiled to WebAssembly, in Cloudflare Durable Objects. A router in a Worker spreads keys over the shards, so valkey-cli and ioredis see one ordinary server.What you getIntroductionA first commandIntroductionThe dashboardIntroductionRead onIntroductionQuick startCreate the Access application, deploy the Worker, and connect valkey-cli or ioredis. About ten minutes on Workers Paid.1. Create the Access applicationQuick start2. DeployQuick start3. Connect valkey-cliQuick start4. Connect from a WorkerQuick startRun it locallyQuick startArchitectureA router per connection, shard objects running Valkey with their AOF in SQLite, and memory-only replicas in other regions. What each part owns, and what it costs.Where everything livesArchitectureHow clients reach itArchitectureRouterArchitectureShardsArchitectureRead replicasArchitectureRewritersArchitectureCatalogArchitectureWatcher, Pulse and the dashboardArchitectureWhat the design buys, and costsArchitectureSharding and routingKeys hash to 16,384 slots, slots map to shards in contiguous ranges, and a database's size and placement are fixed when it is created.Slots and shardsSharding and routingShard countSharding and routingPlacementSharding and routingHow the router routesSharding and routingCROSSSLOTSharding and routingShard classesSharding and routingConnectionsSharding and routingUnsupported commandsSharding and routingDurabilityEvery acknowledged write is in SQLite before its reply leaves. Group commit keeps that cheap under load, a helper object compacts the AOF, and deploys restart shards without failing commands.Write-through storageDurabilityGroup commitDurabilityAOF rewrites in a helperDurabilityWhen a shard resetsDurabilityClean restarts on deployDurabilityRead replicasEach shard can keep a memory-only copy in other regions, fed from its AOF. Routers read the nearest one, a connection always reads its own writes, and an idle database's replicas sleep.RegionsRead replicasCopy, then streamRead replicasWhat a replica read can seeRead replicasFailuresRead replicasIdle sleepRead replicasLife of a requestWhat happens between a client sending SET k v and reading +OK, and what each reply tells you.One SET, step by stepLife of a requestWhat a reply tells youLife of a requestOperationsDeploy, configure, create databases with a placement, sign in to the dashboard, drive the bench API, and upgrade without breaking running shards.DeployOperationsSettingsOperationsCreate a database with a placementOperationsDashboard sign-inOperationsThe bench APIOperationsUpgrading safelyOperationsSecurityWho can connect, what clients may change, how data travels, where copies live, and what the bench token and the dashboard allow.AuthenticationSecurityWithout a passwordSecurityWhat clients can changeSecurityTransportSecurityReplicas and data locationSecurityThe bench token and the dashboardSecurityLimits and measurementsWhat one shard holds, how fast writes and reads went, and the conditions behind each number. Measured on production in November 2026, on one account.LimitsLimits and measurementsMemoryLimits and measurementsThroughputLimits and measurementsLatencyLimits and measurementsReplicasLimits and measurementsRewritesLimits and measurementsCold starts and deploysLimits and measurementsFailure testsLimits and measurementsWhat these don't showLimits and measurementsRedisA database can run Redis 8.12 instead of Valkey. It is opt-in at build time because it doubles the upload and is distributed under the AGPLv3.Choosing RedisRedisBuilding with RedisRedisDifferencesRedisThe AGPL licenceRedisRepositoryAn npm workspace: two apps and three packages. How to check, test and build it, and what CI runs on every push.LayoutRepositoryCommandsRepositoryEnd-to-end testsRepositoryContinuous integrationRepositoryThe wasm buildsRepositoryCode rulesRepository
Local search. Nothing is sent to a server.Esc to close
Documentation