vado / docs
GitHub

How it works

Durability

Every 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 storage

Valkey runs with appendonly yes and appendfsync always. Its files live in a WASI file system backed by the shard's SQLite. A file is a set of rows of at most 1 MB, and AOF appends are written to SQLite synchronously, by the write or the fsync after it.

A Durable Object holds every outgoing message until its storage writes are committed. So a reply leaves only after the write behind it is durable, and pipelined writes share one commit.

SET arrives
Valkey appends to its AOF
Row written to SQLite
Commit
+OK leaves

Group commit

After each pass of Valkey's event loop that wrote to the AOF, the shard waits for that commit, with at most two in flight. Input that arrives meanwhile runs in the next pass: one AOF write and one commit for all of it. Replies wait for their own commit either way, so waiting costs no durability. Under load a commit carries about 100 writes instead of 4, and rows written per write fell from 0.26 to 0.008.

AOF rewrites in a helper

A rewrite is due once the AOF's incremental file is at least 8 MB and at least as big as the base, and is forced at 64 MB and twice the base, since a restart replays the whole incremental file (about 1 s per 64 MB). Valkey would fork a child to write the new base. wasm has no fork(), so a rewriter object does it:

  1. Valkey opens a new incremental file, as before a fork, and offers the rewrite to the shard.
  2. The shard sends its rewriter the manifest and every file from before the new incremental file.
  3. The rewriter boots its own Valkey on that copy with nothing expiring, rewrites, and sends back the base with a checksum.
  4. The shard writes the base 1 MB per commit while it keeps serving, and checks length and checksum.
  5. Valkey swaps it in as if a forked child had finished. The swap is one commit.

For a 35.6 MB base, a helper rewrite took 5.2 to 5.9 s while PINGs to the shard stayed at p99 128 to 175 ms. Inline, the same rewrite blocks the shard for 1.4 to 1.9 s. A helper rewrite that fails or takes over 120 s counts as a failed child, and the shard rewrites inline for the next 10 minutes.

When a shard resets

A shard can reset for a deploy, a crash, an exceeded limit, or a move. It also resets itself if Valkey throws mid-command, since its memory can't be trusted after that and its storage can.

  • Acknowledged writes are kept. The object restarts and replays its AOF before serving.
  • In-flight commands get an error: ERR shard connection lost; the command may or may not have run.
  • Read-only commands retry once on a fresh connection. Writes never retry.
  • WATCH breaks. EXEC returns a null reply and the transaction doesn't run.
  • Blocked clients and subscribers lose their wait, as if the server had restarted.

Clean restarts on deploy

Left alone, the runtime moves a busy object to new code only by resetting it, about 5 minutes after a deploy. So a shard restarts itself as soon as it sees newer code: when a router from the new deploy connects, or, every 30 s while busy, by asking its rewriter, which always starts on the newest code.

Stop reading input
Answer what Valkey read
Commit those writes
Greet each router again
Routers resend the rest

The second greeting tells the router that no command still waiting for a reply has run, so it sends them all again, in order, to the new copy. The one exception is a transaction whose MULTI ran and EXEC didn't: its EXEC gets the lost-connection error. Replicas keep serving throughout. In tests, shards were on new code 10 to 25 s after a deploy, and no command failed.

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