vado / docs
GitHub

How it works

Life of a request

What happens between a client sending SET k v and reading +OK, and what each reply tells you.

One SET, step by step

  1. Client → Worker

    Connect

    Spectrum, a service binding's connect(), or /ws hands the Worker a socket, and it starts a router. Through a binding, the dialed host names the database.

  2. Router

    AUTH

    With VALKEY_PASSWORD set, only AUTH, HELLO and QUIT run until the client signs in, and requests are capped at 64 KB. The username picks the database; its record comes from the catalog once per process.

  3. Router

    Parse

    The router cuts one RESP request from the buffered bytes. A request over about 8 MB gets Valkey's protocol error and the connection closes.

  4. Router

    Route

    Valkey's COMMAND table gives the key positions. Each key hashes to a slot, and the slot to a shard. One slot: the bytes go unchanged to that shard, or a nearby replica for a read.

  5. Shard

    Run and store

    The shard feeds the bytes to Valkey and runs one pass of its event loop. Valkey executes SET and appends it to its AOF, which the file system writes to SQLite. The output gate holds the reply until that commit.

  6. Shard → replicas

    Replicate

    Once committed, the same AOF bytes go to each of the shard's replicas, which run them as commands.

  7. Router → client

    Reply

    The router matches the reply to its request and writes replies in request order, batching every reply ready at once into one write.

What a reply tells you

You seeIt means
A normal reply to a writeThe write is committed to the shard's SQLite. It survives resets and deploys.
ERR shard connection lost; the command may or may not have runThe shard reset with the command in flight. Retry only if it is safe to repeat.
A read succeeds after a resetThe router retried it once, on a fresh connection or on the primary. Writes are never retried.
EXEC returns a null replyA watched key's shard reset, so the transaction didn't run.
A read misses another connection's writeIt went to a replica that hadn't run the write yet. Use WAIT on the writer if that matters.
Replies from one shard slow by up to about 150 msA rewriter is compacting that shard's AOF, for a few seconds.
One shard pauses for a second or twoIt is rewriting inline, which blocks it. That happens for 10 minutes after a rewriter fails.
CROSSSLOTThe command needs its keys in one slot. Use a {hashtag}.
The connection closesA protocol error or size limit (an error comes first), a WebSocket client that sent too fast, or the Worker restarting.

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