storage survives.
Where it Runs
An instance is placed on first touch — the first method call to a name brings it up. After that you address it by name, never by location; the platform routes every call to wherever the instance currently lives. (idFromName accepts a locationHint
option, reserved for regional placement — see
Actor Namespace.)
Activation, Sleep, and Eviction
- Activated on demand. Naming an instance is cheap; the first method call to a name brings the instance up and routes the call to it.
- Kept warm while busy, evicted when idle. Between calls, an idle instance may be removed from memory to free resources, then re-activated on the next call.
- Scales to zero like functions. Where the actor runtime runs on Knative, an idle instance sleeps after an idle period — the same way a function container scales to zero after idling — unless something is holding it resident: an actor with an open WebSocket stays active between frames and does not sleep. (Alarms also wake a sleeping instance — below.) The first request to a sleeping instance pays a cold start (pod boot + activation) before the method runs, just like a function’s first invocation after idle. Duration billing is unchanged in spirit: you pay for active seconds only — a sleeping instance does not accrue.
- Alarms wake a sleeping instance. Where scale-to-zero is enabled, a scheduled
alarm()fires even if the instance is scaled to zero — the alarm delivery brings the pod back up. Alarms are the one trigger (besides requests) that wakes a sleeping instance. - Restarted on deploy or host failure. A new code version or a host issue tears the instance down and re-creates it.
What Survives a Restart
In-memory state — instance fields likethis.x — is a cache. It vanishes on
eviction, restart, or relocation. Your actor’s storage is the truth: it is durable
and reloaded when the instance next activates. Treat memory exactly like a process that
can be SIGKILLed at any instant — only what you flushed to storage is real. (This
is guarantee 4 in Execution model.)
A common pattern is to load from storage once on activation and cache the result in
memory; just never assume the cache is still there.
Next Steps
- How it works — the execution model and its guarantees
- Addressing — naming and routing instances
- Runtime API —
ctx.storage,blockConcurrencyWhile