Snapwake

Architecture

What runs under your app

Each piece is there for one of two reasons: so a sleeping app costs nothing, or so a waking one loses nothing. Here is the path of a request and everything behind it.

The path of a request

From a browser to a microVM

Cloudflare in front, our edge behind it, then the server that holds the app. A standby server keeps a copy of everything the app needs to move.

A request goes from the browser to Cloudflare, then over mutual TLS to the Snapwake edge, then over WireGuard to the app’s home server, where every app is its own microVM. A standby server holds a copy of each snapshot and a replica of each volume. The control plane keeps a journal of state; servers keep running without it.

Pieces

The pieces, one by one

01

Sleep is a snapshot

When an app goes quiet its memory is saved to disk as it was. A wake loads the pages it needs to start serving first, then the rest as the app asks for them.

  • firecracker
  • userfaultfd
  • working-set
02

Queue workers sleep too

A worker with an empty Redis queue sleeps, and the next job wakes it. Its Redis connection survives the sleep: no reconnect, no lost job.

  • rq
  • bullmq
  • redis
03

Volumes with a replica

Disks that keep data are copied to a standby server as you write. If a server dies, the app moves there with its data. No confirmed write lost in our failover drills.

  • replica
  • failover
04

Encrypted at rest

Snapshots, memory and secrets are encrypted with your organization's own key. Secrets are handed to the VM at start and never baked into the image.

  • aes-256-gcm
  • per-org-key
05

A cage per VM

Every VM has its own kernel, runs jailed without privileges, and gets its own memory, CPU, disk and network limits. A noisy neighbour stays its own problem.

  • jailer
  • cgroups
  • rate-limits
06

Only Cloudflare reaches the edge

Our edge accepts Cloudflare alone, with a client certificate of our own, and talks to servers over WireGuard. Nobody gets to the servers around it.

  • mtls
  • wireguard
07

Servers don't wait for the control plane

The control plane keeps a journal of what runs where. If it stops, servers keep serving and waking the apps they have.

  • journal
  • no-single-brain
08

Sign in with GitHub

No passwords to leak: GitHub only, a second step with an authenticator app, and the CLI signs in through your browser.

  • github
  • totp

Life of an app

Deploy, serve, sleep, wake, move

01deploy

The image is built in a throwaway VM, started once, and its warm memory saved as the version's snapshot. Secrets are handed to the VM at start, never baked in.

02serve

Requests go through the edge to the app's home server. Its VM runs with its own kernel, jailed, with its own memory, CPU, disk and network limits.

03sleep

A few seconds after the last request the app's connections are closed cleanly and the VM stops. Its memory is a file on disk, encrypted; it uses nothing else.

04wake

The next request restores the VM from the snapshot. The pages it needs to start serving load first, recorded at deploy (workers learn theirs on their first real wake); the rest arrive as the app asks for them.

05move

If the home server stops answering, the standby server already has the snapshot and the volume replica, and the app comes back there.

Security

Your data stays yours

Every organization has its own key. Snapshot memory, snapshot files and secrets are encrypted with keys derived from it, so one organization’s data is unreadable with another’s. Secrets never go into an image. Each VM is jailed without privileges and has its own limits, and the edge only accepts connections from Cloudflare, checked with a client certificate of our own.

organization key ├─ version key snapshot memory and files └─ secrets key one per app, AES-256-GCM

Sign-in is GitHub only, with a second step in an authenticator app. The CLI signs in through your browser, so no password or long-lived key sits in your terminal history.

Metering

Billed by what actually ran

Every few seconds each server looks at the memory a VM really holds while awake, the CPU time it really used, the traffic it sent and the storage it keeps. Five-minute totals go to the books once each, however often they are sent. When a plan’s allowance and credits run out, or a spend cap is reached, apps sleep instead of running up a bill.

Put your apps to sleep

Free during the beta: $10 of usage a month is on us. Apply with your GitHub account.