Diffinery

homeflare/celldpublic

celld/docs/README.md
708 lines · 35.7 KBRaw History
1# celld documentation
2
3celld is a stateful distributed system. It runs server-side JavaScript on
4your machines, and it stores the long-term state in a bucket that you own:
5S3-compatible, Google Cloud Storage, or Azure Blob Storage. The JavaScript
6API follows the API of Cloudflare Workers and Durable Objects.
7
8In Cloudflare terms, a cell is a Durable Object: a small server with a
9name and a private SQLite database. You make one cell for each user, each
10document, each chat room, or each AI agent. A cell serves HTTP, holds
11WebSocket connections, sets alarms, and makes outbound connections. Cells
12share no database, so the application divides into cells from the start.
13Each cell runs on one thread: a second request interleaves only while the
14first awaits, and storage operations are synchronous and never interleave,
15so the data in a cell stays consistent.
16
17You run celld as one process on each machine. That process is a **node**,
18and the nodes that share one bucket are a **fleet**. Any node can serve
19any cell, so you add capacity by starting another node against the same
20bucket.
21
22A cell has the same states as a Durable Object. A **resident** cell is in
23memory: it is **active** while it does work, and **idle** when it waits.
24celld removes an idle cell from memory. A cell that then keeps its
25hibernatable WebSocket clients, and stays on its node, is **hibernated**.
26A cell that no node holds is **inactive**. An inactive cell is only an
27object in the bucket, so it costs almost zero, and every cell starts in
28this state.
29
30A cell keeps no memory across these transitions, so the constructor
31runs again on the next event. A hibernated cell wakes the same way a
32cold start does, except that its WebSocket clients stay connected and
33it stays on its node.
34
35One 8 GB node holds 1,000 resident cells, so one resident cell costs
36approximately $0.05 each month.
37
38Exactly one node serves a cell at a time. The nodes do not elect a leader
39or keep a membership list: a node claims a cell by writing a small record
40to the bucket, and it writes that record with a condition the storage
41enforces — the write succeeds only if nobody else changed the record
42first. Object storage therefore decides who wins, and two nodes cannot
43both claim the same cell. The claim expires unless the node keeps
44renewing it, so a machine that dies releases its cells without anyone
45having to declare it dead.
46
47celld does not answer a write until the data survives a failure, so no
48write you were told succeeded is ever lost. That guarantee is called
49RPO=0, for a recovery point of zero.
50
51How celld earns it depends on how many nodes you run. One node writes the
52data to the bucket first, which costs one storage round trip. Two or more
53nodes are faster: the node serving the cell sends each write to another
54node as well, and answers as soon as that node has the data on its own
55disk. celld uploads the data to the bucket afterwards, so the bucket
56still holds the long-term state. Run two or more nodes if write latency
57matters to you; a single node has nobody to send to, so every write waits
58for the bucket. `CELLD_DURABILITY` selects this behavior and defaults to
59`fleet`.
60
61When a node stops, another node takes the cell over. It first collects
62whatever the stopped node had not uploaded yet, so the takeover starts
63from a complete history. The [guarantees](guarantees.md) page
64gives the full mechanism and the exact properties that the bucket must
65provide.
66
67When an event sets an alarm before its response boundary, celld does not send a
68successful response until a durable wake entry covers the alarm. celld does
69not let a later `waitUntil` alarm delay another event's response.
70
71## What do you build with cells
72
73A cell fits a workload that divides into named, stateful units:
74
75- **Real-time applications.** A multiplayer game, a chat room, or a
76 collaborative document is one cell. The cell holds the WebSocket
77 connections and the state of one room, so the room needs no lock and
78 no external message bus.
79- **Agents.** Each AI agent is one cell. The cell holds the memory, the
80 schedule, and the inbox of one agent in its own SQLite database. An
81 inactive agent has no resident process, so a large agent fleet costs
82 almost nothing between events.
83- **Sharded web applications.** One cell for each user, each tenant, or
84 each device shards the application from the start. The contention of
85 one shared database does not appear, because no shared database
86 exists.
87
88## Contents
89
90- [What do you build with cells](#what-do-you-build-with-cells)
91- [Install](#install)
92- [Configure object storage](#configure-object-storage)
93- [Deploy an application](#deploy-an-application)
94- [Operate D1 and KV](#operate-d1-and-kv)
95- [Start a node](#start-a-node)
96- [Add nodes](#add-nodes)
97- [Shut down and roll out a node](#shut-down-and-roll-out-a-node)
98- [Diagnose a fleet](#diagnose-a-fleet)
99- [List Durable Objects](#list-durable-objects)
100- [Environment variables](#environment-variables)
101- [Cloudflare compatibility](cloudflare-compat.md)
102- [What celld guarantees](guarantees.md)
103- [Limitations](limitations.md)
104- [Security](security.md)
105- [Telemetry](telemetry.md)
106- [Testing](testing.md)
107- [WebAssembly](wasm.md)
108- [Rust library API](library-api.md)
109
110## Install
111
112The installer downloads the `celld` binary. Replication runs inside the
113celld process, so a node needs no external replicator.
114
115```sh
116curl -fsSL https://celld.dev/install.sh | sh
117```
118
119If the installer tells you, add `~/.local/bin` to `PATH`. To install one
120exact release, set `CELLD_VERSION` to its tag, for example `v0.0.1`; to
121go back, run the installer again with the previous tag. The releases are
122on [GitHub](https://github.com/denoland/celld/releases), and each release
123has a GitHub Actions build attestation: verify a downloaded file with
124`gh attestation verify <asset> --repo denoland/celld`.
125
126## Configure object storage
127
128For an S3-compatible bucket, celld uses the standard AWS credential
129chain. On Amazon EKS, celld reads the Pod Identity credentials from the
130injected environment variables and the authorization-token file. For
131Cloudflare R2: create a bucket, create an S3 API token with access to
132that bucket, and set these variables:
133
134```sh
135export AWS_ACCESS_KEY_ID=...
136export AWS_SECRET_ACCESS_KEY=...
137export AWS_REGION=auto
138export S3_ENDPOINT=https://ACCOUNT_ID.r2.cloudflarestorage.com
139export CELLD_BUCKET=s3://YOUR-BUCKET
140```
141
142For Google Cloud Storage, celld uses Application Default Credentials.
143Create a bucket. Then authenticate with `gcloud auth application-default
144login`, or point `GOOGLE_APPLICATION_CREDENTIALS` at a service-account
145key that has access to the bucket. Then set the bucket:
146
147```sh
148export CELLD_BUCKET=gs://YOUR-BUCKET
149```
150
151A `gs://` bucket takes no `S3_ENDPOINT` and no `AWS_*` credentials, and
152celld ignores the storage region. On a Compute Engine instance, celld can
153use the attached service account, but the access scopes of the instance
154cap this credential, and the default scope permits only storage reads.
155Create the instance with the `cloud-platform` scope, so the IAM role of
156the service account controls the access.
157
158For Azure Blob Storage, the bucket NAME is the container, and the
159storage account comes from the environment. Create a container. Then
160set the account and one credential:
161
162```sh
163export AZURE_STORAGE_ACCOUNT_NAME=YOUR-ACCOUNT
164export AZURE_STORAGE_ACCOUNT_KEY=...
165export CELLD_BUCKET=az://YOUR-CONTAINER
166```
167
168celld accepts three Azure credential families — a storage account key, a
169managed identity, and a workload identity — and you must configure
170exactly one. A system-assigned managed identity needs only the account
171name. A user-assigned managed identity needs exactly one selector among
172`AZURE_CLIENT_ID`, `AZURE_OBJECT_ID`, and `AZURE_MSI_RESOURCE_ID`,
173because two selectors can name two different identities. An identity
174must hold the Azure Blob data-plane permission to read, write, list, and
175delete blobs; the built-in
176[`Storage Blob Data Contributor`](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#storage-blob-data-contributor)
177role supplies it.
178
179celld reads a managed identity from the Azure instance metadata service,
180which an Azure VM and an AKS node supply. Azure App Service and Azure
181Container Apps supply a different endpoint, so a managed identity does
182not work there; use a workload identity or an account key instead. The
183standard AKS workload identity environment (`AZURE_AUTHORITY_HOST`,
184`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_FEDERATED_TOKEN_FILE`)
185works with the public authority host, `https://login.microsoftonline.com`,
186with or without a trailing slash; celld rejects a sovereign or custom
187host. celld also rejects each recognized Azure configuration variable
188outside these families — another credential source, an endpoint override,
189the OneLake endpoint — and it ignores an `AZURE_*` name that
190`object_store` 0.12 does not recognize, because that name cannot change
191the client.
192
193An `az://` bucket takes no `S3_ENDPOINT` and no `AWS_*` credentials, and
194celld ignores the storage region. celld qualifies an `az://` bucket for
195a production fleet: the conditional-write contract and the multipart
196upload path were tested against a live Azure account on 2026-08-18 (see
197[guarantees](guarantees.md)). For local development against
198Azurite, set `AZURE_STORAGE_USE_EMULATOR=true`; Azurite is a development
199store, so celld does not qualify it for a fleet either.
200
201The bucket credentials give full control of the fleet, so keep them
202safe. The bucket contains the deployments, the SQLite replicas, the
203ownership records, the node leases, and the peer-authentication secret.
204
205A bucket value can add a key prefix: `s3://YOUR-BUCKET/PREFIX`. Every
206object of the fleet then goes below `PREFIX/`, so two fleets can share one
207bucket. A bucket value without a prefix keeps the objects at the root of
208the bucket, therefore an existing fleet does not move its data.
209
210The store must provide conditional writes and read-after-write
211consistency, because the ownership records depend on them. Amazon S3,
212Cloudflare R2, Google Cloud Storage, Tigris, and Azure Blob Storage
213qualify; Backblaze B2, Hetzner, and DigitalOcean Spaces do not. MinIO
214(the community edition) passes the storage test, but celld has not
215qualified it for production; do not use RELEASE.2025-09-06T17-38-46Z,
216which rejects the conditional create that the first deploy sends
217(denoland/celld#162). See [what celld guarantees](guarantees.md) for the
218exact requirements.
219
220## Deploy an application
221
222If the project contains Worker code, install `esbuild` on `PATH`; an
223asset-only project does not need it. Then run `celld deploy` from an
224applicable Wrangler project:
225
226```sh
227git clone https://github.com/denoland/celld
228cd celld/examples/counter
229celld deploy . \
230 --bucket "$CELLD_BUCKET" \
231 --endpoint "$S3_ENDPOINT" \
232 --region "$AWS_REGION"
233```
234
235`celld deploy` accepts module Workers, Durable Object bindings, service
236bindings, variables, cron triggers, D1 databases, KV namespaces, Workflows,
237WebAssembly modules, and static assets. An asset project can include a
238Worker or be asset-only, and the asset functions include the assets
239binding, HTML handling, not-found handling, worker-first routes,
240`_headers`, and `_redirects`. If the Wrangler configuration contains an
241unknown key, the deploy stops with an error. See the
242[Cloudflare compatibility](cloudflare-compat.md) page for the complete
243deployment boundary.
244
245A running node does not restart for a new deployment. Each node reads
246`deploy/current.json` every 30 seconds (`CELLD_DEPLOY_POLL_S`) and adopts
247a new deployment in place, and `POST /reload` on the internal listener
248makes a node adopt the pointer now. A node builds the new deployment
249beside the one it serves, and then it switches new requests to the new
250deployment in one step. A request that started on the previous deployment
251finishes on it. A deployment that does not build leaves the current
252deployment serving, and the node reports the failure in its log and in
253the `/reload` response. `POST /reload` also rebuilds an unchanged
254deployment, so an edit to `CELLD_VARS_FILE` takes effect without a
255restart.
256
257A Durable Object that is not resident runs the new deployment at its
258next activation. A resident Durable Object moves to the new deployment
259at a safe point: no request runs in it, no alarm handler runs in it, no
260output waits for durability, and no regular WebSocket is open. A request
261that arrives while the object moves waits for the new code. The move
262keeps the object's storage, its epoch, and its hibernatable WebSockets,
263and it does not read or write the bucket. An object that reaches no safe
264point in `CELLD_DEPLOY_MAX_AGE_S` seconds (default 60) is forced: celld
265cancels its running work and closes its regular WebSockets with code
2661012, which is what a Cloudflare deployment does to every object. A
267value of 0 forces every resident object at the adoption. In this window,
268a request on one deployment can call a Durable Object on the other, so
269two adjacent versions must accept each other's calls. The `/state`
270response reports the deployment a node serves, the deployments it still
271drains, the objects that are moving, and the deployment each resident
272object runs.
273
274## Develop an application locally
275
276Run `celld dev` in a Wrangler project:
277
278```sh
279celld dev
280```
281
282The command opens a local object store, deploys the application, and starts
283one celld node. It does not require Docker or a cloud bucket. The Worker
284listener uses `http://127.0.0.1:9876` by default. Use `--port` to select a
285different port:
286
287```sh
288celld dev --port 3000
289```
290
291Use `--host` to select the Worker listener interface:
292
293```sh
294celld dev --host 0.0.0.0
295```
296
297A non-loopback IP exposes the Worker listener to the network. The internal
298operator listener stays on loopback, so another machine cannot use its
299operator API.
300
301The default display uses color to identify each status and the application
302URL. It hides the node warning and information logs, so the errors and the
303listener remain easy to find. Use `--logs` to show these logs:
304
305```sh
306celld dev --logs
307```
308
309Set `NO_COLOR` to disable color. Set `FORCE_COLOR` to enable color when
310the output is not a terminal. `NO_COLOR` always takes priority when both
311variables are set.
312
313You can also give the command a project directory or a Wrangler
314configuration file:
315
316```sh
317celld dev ./examples/counter
318```
319
320The command stores the local objects and the celld work files in `.celld/dev`
321below the project directory. Add `.celld/` to the application's `.gitignore`
322file. A normal shutdown keeps this directory, so the next invocation uses the
323same durable application state. Delete `.celld/dev` while `celld dev` is
324stopped to reset that state.
325
326The command does not expose the local object store through a fleet flag. A
327regular node or an operator subcommand must use a supported cloud bucket.
328
329The command watches the project directory. A source or configuration
330change builds a new deployment and restarts the local node. The current
331application continues to run during the build, and a failed build does
332not replace it. The restart retains the durable application state.
333
334The watcher ignores `.celld`, `.git`, `node_modules`, and `target`
335directories at each depth. It does not watch a source file outside the
336project directory. Worker projects need `esbuild` on `PATH`, and
337asset-only projects do not need it.
338
339## Operate D1 and KV
340
341`celld d1` runs SQL and migrations against a deployed D1 database. The
342command uses the fleet bucket to find a node, and the node routes the
343operation to the database cell.
344
345```sh
346celld d1 migrations apply ledger --bucket "$CELLD_BUCKET"
347```
348
349`celld kv` reads and writes a deployed KV namespace. The bulk commands use
350the Wrangler file format, so `wrangler kv bulk get` can export data for
351`celld kv bulk put`.
352
353```sh
354celld kv bulk put sessions wrangler-export.json --bucket "$CELLD_BUCKET"
355```
356
357`celld kv list` prints at most 1000 keys, because a namespace can hold
358many more keys than an operator wants to read. The command reports on
359stderr that more keys exist, and it gives the `--after KEY` that continues
360the listing. Pass `--all` to read every key, or `--json` for one JSON
361object per key.
362
363Every celld command writes its data to stdout and its messages to stderr,
364so a redirect or a pipe carries only data:
365
366```sh
367celld kv list sessions --all --json --bucket "$CELLD_BUCKET" > keys.ndjson
368```
369
370`celld --help`, `celld --version`, and the listener announcements use the same
371stdout sink. The sink treats a closed pipe as a successful stop, and it reports
372all other write and flush errors.
373
374## Start a node
375
376For local development, the default listener is sufficient:
377
378```sh
379celld \
380 --bucket "$CELLD_BUCKET" \
381 --endpoint "$S3_ENDPOINT" \
382 --region "$AWS_REGION"
383```
384
385For a fleet node, bind the public and internal listeners separately. The
386ingress can reach the public listener, and the other nodes can reach the
387internal listener:
388
389```sh
390celld \
391 --bucket "$CELLD_BUCKET" \
392 --endpoint "$S3_ENDPOINT" \
393 --region "$AWS_REGION" \
394 --listen 0.0.0.0:8080 \
395 --internal-listen 10.0.0.12:8081 \
396 --advertise node-a.internal:8081
397```
398
399An explicit advertised address requires an explicit internal-listener
400address: set both command-line options, or their equivalent environment
401variables. celld also rejects an explicit non-loopback public listener
402without an explicit internal listener, because that shape identifies an
403obsolete one-listener configuration.
404
405celld cannot verify that an advertised hostname or a translated port
406reaches the internal listener. You must route the advertised address to
407the internal listener, and you must not route it to the public Worker
408listener.
409
410## Add nodes
411
412Start each node with the same bucket settings. Give each internal listener
413a different address that the other nodes can reach, and set `--advertise`
414to that address. The nodes find each other through the leases in the
415bucket; there is no join command and no fixed membership list.
416
417The bucket supplies discovery and authority, not network reachability.
418Cell fetch and RPC traffic has a protocol version but has no content
419signature, so the private network and its code are the security boundary.
420Peer-control and reserved-cell operator requests use the fleet HMAC, but celld does not
421terminate TLS. Put the advertised addresses on a private network that you
422trust, or use an encrypted overlay such as WireGuard or Tailscale. The
423internal listener also has an unauthenticated operator API, so it must not
424reach the public internet. See the [security](security.md) page for the
425complete boundary.
426
427## Shut down and roll out a node
428
429celld shuts a node down gracefully on SIGTERM or SIGINT, the signals that
430`systemctl stop`, `docker stop`, and a Kubernetes pod delete send. The
431`/.well-known/celld/health` path reports the node as unhealthy, so a load balancer
432stops public routing to it. New public requests receive a 503 response,
433and celld closes each connection so the client can retry on a healthy
434node. The node finishes the public HTTP requests that it accepted before
435shutdown, and it continues to accept versioned peer traffic for cells that
436it has not handed off.
437
438You must set a longer orchestrator stop grace, such as systemd
439`TimeoutStopSec` or Kubernetes `terminationGracePeriodSeconds`. The grace
440must cover the drain-token wait, the expected complete handoff, and one
441no-progress interval (the settings below). Otherwise, the orchestrator
442can send SIGKILL before celld completes the handoff.
443
444The handoff works in batches. The node reserves a batch of cells and
445stops new local routes to them: an accepted request stays local until it
446finishes, and a new request waits for the successor route. The node
447proves the batch durable and tries to publish one full snapshot of each
448closed database. The snapshot is an L9 object, so the successor does not
449replay the complete transaction history. The remote L0 chain remains an
450additive fallback. If the snapshot retry window expires, the node releases
451the cell with this proven L0 chain. The node then releases each ownership
452record and asks a
453compatible peer to acquire it. The peer acknowledges after the ownership
454update and keeps the cell dormant, so the handoff does not restore an
455unused runtime; a later request starts the cell under the peer activation
456limit. The donor starts the next batch after each acknowledgement.
457
458Four settings pace this work. `CELLD_RELEASES` sets the maximum number
459of complete handoffs in progress (default 8), covering activity
460cancellation, the durability proof, the final snapshot, the ownership
461release, and the successor update; `CELLD_ACTIVATIONS` limits the
462demand-driven restore and startup work. `CELLD_SHUTDOWN_DRAIN_MS` sets
463the maximum interval without a completed handoff (default 25000). Each
464successor acknowledgement starts the interval again, so a large handoff
465can continue while it makes progress. `CELLD_SHUTDOWN_TOTAL_MS` sets a 40000 ms
466default bound for the complete process stop. An orchestrator stop grace must
467be longer than this bound, so celld can finish its local durability shutdown.
468A same-node preserve operation uses the shorter drain value as its semantic
469limit because it has no successor acknowledgements.
470
471Simultaneous stop signals do not flood the surviving nodes. A draining
472node claims a fleet drain token in the bucket before it releases cells,
473so concurrent donors hand off one node at a time. A donor that cannot
474claim the token within `CELLD_DRAIN_TOKEN_WAIT_MS` milliseconds (default
47530000; `0` disables the token) proceeds without it, because the
476orchestrator grace is finite. The token is advisory: a dead holder's
477claim expires, and a handoff without the token is still safe.
478
479A fresh process also holds its first healthy response until the fleet is
480settled. The process requires its live node lease, no active donor, and memory
481below every pressure low watermark on each live node. It also requires a total
482restore backlog no larger than one `CELLD_ACTIVATIONS` budget. The incumbent
483ownership counts must remain within one equal successor share above the fleet
484mean. A joining process can satisfy this condition when it advertises paced
485handoff support and owns fewer cells than the busiest incumbent. The process
486publishes this successor capacity before readiness, so an idle rollout can
487repair the ownership distribution during the next donor handoff.
488
489An older peer does not publish the low-watermark result, so the gate uses that
490peer's pressure latch during a mixed-version update. An unreadable fleet or an
491unsettled condition holds readiness for up to `CELLD_READY_FLEET_GATE_MS`
492milliseconds (default 120000; `0` disables the gate). The process then reports
493healthy with a `ready_gate_expired` event. After the first healthy response,
494fleet state does not remove readiness again.
495
496A deadline-cut handoff can leave a node-log recovery for the replacement.
497One process reads and uploads that dead session, and the other processes wait
498for its result. A waiting process can replace an unresponsive recovery after
49930 seconds, so a failed recovery cannot block the fleet permanently. A
500recovery store error keeps the session unsealed, so a later recovery must read
501every retained bundle before the replacement can restore the acknowledged
502state.
503
504The internal listener continues to accept `/state` requests during the
505drain, and the response reports the handoff and restore counters. The
506public health response identifies the active drain with a 503 status.
507
508To roll out a new version, use the rolling update of your orchestrator:
509stop each node with SIGTERM, wait for its replacement to report healthy,
510then move to the next node. celld paces the cell handoffs inside each node
511shutdown, and the first-readiness gate paces the update against fleet
512recovery, so a deployer does not need a separate fleet-level handoff gate.
513
514Some upgrades are exceptions:
515
516- The upgrade from v0.1.0 to v0.2.0 must not be a rolling update. Stop
517 every v0.1.0 node, then start the v0.2.0 nodes. Two changes require
518 this: v0.2.0 nodes advertise the internal listener, so ownership
519 records that v0.1.0 nodes wrote name an address that v0.1.0 peers can
520 not follow to a v0.2.0 node; and v0.2.0 compacts replicated data into
521 block objects that a v0.1.0 reader can not restore. A fleet must not
522 mix the two versions.
523- The upgrade from v0.2.1 to v0.3.0 can use a rolling update. v0.3.0
524 changes the default durability from `bucket` to `fleet`: a single node
525 keeps the v0.2.1 behavior, and a fleet of two or more nodes activates
526 fleet replication automatically. Stage the v0.3.0 binary on every node,
527 and restart one node at a time. A mixed fleet stays safe, but a v0.3.0
528 node cannot replicate to a v0.2.x peer, so it acknowledges writes
529 through the bucket and retries until the peer runs v0.3.0. Do not start
530 a v0.2.x binary after that node runs v0.3.0 unless the shutdown log
531 contains `node-log close: sealed epoch`. A graceful stop attempts this
532 seal, but a stop under load can leave the record open, and a v0.2.x
533 binary cannot read writes that wait in the replicated log or bundle
534 objects — this downgrade can lose acknowledged writes.
535- The upgrade from v0.3.0 to v0.4.0 must not use a rolling update. Stop
536 every v0.3.0 node, and then start the v0.4.0 nodes. v0.4.0 moves every
537 proxied cell call — the fetch, the RPC, and the WebSocket — onto one
538 tunneled connection that carries plain HTTP, and the peer protocol
539 refuses a different version, so the two versions cannot proxy calls to
540 each other. v0.4.0 also stores each new large KV value under its ownership
541 epoch and writes an epoch-qualified row reference. A v0.3.0 node cannot
542 read that reference, so a mixed fleet can make a committed KV value
543 unavailable. The tunnel establishment carries the version, so a later
544 protocol change can negotiate instead of refuse.
545
546The internal listener also provides an alpha operator API. `/state`
547reports the node state, `POST /reload` adopts the deployment pointer now,
548and `POST /shutdown` starts the same graceful
549handoff. The `POST /shutdown?handoff=preserve` request prepares a clean
550same-node reload and keeps the ownership records. A release can change
551this API, so keep the operator tooling and the celld release together.
552
553## Diagnose a fleet
554
555`celld diagnose` reads the node leases in the bucket and sends a probe to
556each live peer. It does not take a lease, and it does not change
557ownership.
558
559```sh
560celld diagnose \
561 --bucket "$CELLD_BUCKET" \
562 --endpoint "$S3_ENDPOINT" \
563 --region "$AWS_REGION"
564```
565
566To probe only some nodes, use `--peer NODE_ID` one or more times. The
567report identifies expired records, unsafe or incorrect advertised
568addresses, peers that it cannot reach, authentication failures, and
569protocol versions that do not agree.
570
571Each node line also shows `restoring`: the count of cold routes that hold
572an activation permit or wait for one (a capacity waiter already holds a
573permit, so each cold route counts once). During a rolling update, wait
574for every node to report `restoring=0` before you restart the next node,
575so one restart's cold work finishes before the next restart removes more
576warm capacity.
577
578## List Durable Objects
579
580List the Durable Object instances in the bucket:
581
582```sh
583celld cell list \
584 --bucket "$CELLD_BUCKET" \
585 --endpoint "$S3_ENDPOINT" \
586 --region "$AWS_REGION"
587```
588
589Each line is a `Class:ID` cell scope. The ID is the Durable Object ID: a
59064-character hash unless the application supplies its own name. Give a
591class name to list only that class, and pass `--json` for one JSON object
592per line. An instance appears after the first event reaches it, because
593its owner then writes an ownership record to the bucket; an ID that an
594application only derives does not appear.
595
596The listing also shows celld's own cells. A D1 database, a KV namespace,
597and a Workflow are each a cell in a reserved class, and their names start
598with `__`. They hold real data in the bucket, therefore the command shows
599them. The `--json` output marks each row with `"reserved": true` or
600`false`, so a script can select one kind:
601
602```sh
603celld cell list --all --json --bucket "$CELLD_BUCKET" |
604 jq -r 'select(.reserved | not) | .scope'
605```
606
607A storage request returns at most 1000 instances, so the command stops at
6081000 instances and writes this line to stderr:
609
610```
6111000 cells shown; more exist. Continue with --after Room:d99d9174b25e46310694dd931b47fbde70a7460bb7b210b546060651ea2ff6e0
612```
613
614Pass that `--after SCOPE` to read the next 1000 instances, or use
615`--limit N` for a different bound:
616
617```sh
618celld cell list --bucket "$CELLD_BUCKET" \
619 --after Room:d99d9174b25e46310694dd931b47fbde70a7460bb7b210b546060651ea2ff6e0
620```
621
622Pass `--all` to read the whole listing in one command. This makes one
623request for each 1000 instances, so it can take minutes on a large fleet;
624the command reports its progress and its request count on stderr.
625
626The order is the storage order, and `--after` continues from the last
627instance printed, so a sequence of `--after` commands lists each instance
628one time. An instance that an application creates during the sequence can
629appear or not appear, because the listing is not a snapshot.
630
631The command writes the instances to stdout and every message to stderr,
632so a script reads only instance data:
633
634```sh
635celld cell list --all --json --bucket "$CELLD_BUCKET" > cells.ndjson
636```
637
638## Hot-cell overload
639
640celld admits a maximum of 64 concurrent fetch events for one Durable Object
641or Queue broker. Set `CELLD_MAX_CELL_REQUESTS` to use a different positive
642limit.
643
644celld returns HTTP status `503` when the target reaches this limit, and it
645does not start the excess event. The response contains `Retry-After: 1` and
646`X-Celld-Overload: cell`, so the application can retry or reject the work.
647A local or remote Queue owner uses the same status and headers when it refuses
648producer admission. The Queue response body is
649`{"error":"cell admission refused"}`. A fixed-rate client must count the
650response as rejected work, so an immediate retry does not increase the
651configured offered rate.
652
653The runtime writes a `cell_overload_refused` log event when a target becomes
654saturated. The event contains the cell scope, the node, the region, the
655in-flight count, and the limit. Count these overload responses separately
656from the transport errors and the application failures.
657
658## Environment variables
659
660For the full list, run `celld -h`. This table shows the primary settings:
661
662| variable | purpose |
663| --- | --- |
664| `CELLD_BUCKET` | The fleet bucket, and an optional key prefix. The same as `--bucket` |
665| `S3_ENDPOINT` | The S3-compatible endpoint. The same as `--endpoint` |
666| `AWS_REGION`, `AWS_DEFAULT_REGION` | The storage region |
667| `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN` | Explicit AWS credentials. The standard AWS credential chain is also available |
668| `GOOGLE_APPLICATION_CREDENTIALS`, `GOOGLE_SERVICE_ACCOUNT_KEY` | Google credentials for a `gs://` bucket. Application Default Credentials are also available |
669| `AZURE_STORAGE_ACCOUNT_NAME` | The storage account for an `az://` bucket. The bucket NAME is the container |
670| `AZURE_STORAGE_ACCOUNT_KEY` | The storage account key. Do not combine it with an identity selector |
671| `AZURE_AUTHORITY_HOST`, `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_FEDERATED_TOKEN_FILE` | The standard AKS workload identity environment for an `az://` bucket. The authority must be the public Azure host |
672| `AZURE_STORAGE_USE_EMULATOR` | Set to `true` to develop against Azurite. celld does not qualify Azurite for a production fleet |
673| `CELLD_ADDR` | The public Worker listener. The same as `--listen` |
674| `CELLD_INTERNAL_ADDR` | The peer and operator listener. The same as `--internal-listen` |
675| `CELLD_ADVERTISE` | The internal address that peers can reach. The same as `--advertise` |
676| `CELLD_UNSAFE_PUBLIC_ADVERTISE` | Set to `1` to permit a literal public IP in `CELLD_ADVERTISE`. This setting does not resolve a DNS name or restrict the internal listener |
677| `CELLD_NODE` | An explicit node-session ID |
678| `CELLD_WATCH` | The local work directory for SQLite and replication |
679| `CELLD_ESBUILD` | The path of the esbuild executable |
680| `CELLD_ACTIVATIONS` | The limit for concurrent cold-cell activations (default: the available CPU count or 128, whichever is smaller) |
681| `CELLD_DEPLOY_POLL_S` | The interval in seconds at which a node reads the deployment pointer and adopts a new deployment in place (default: 30) |
682| `CELLD_DEPLOY_MAX_AGE_S` | How long a resident Durable Object can keep the previous deployment's code after an adoption before celld forces the move (default: 60; 0 forces at once) |
683| `CELLD_OPERATION_DEADLINE_MS` | The deadline for a non-restore operation (default: 15000) |
684| `CELLD_WORKER_LOADER` | Bind a Worker Loader (Code Mode) at this `env` name. A Worker can then start isolates at runtime. Off unless set (experimental) |
685| `CELLD_MAX_LOADED_WORKERS` | The limit for concurrent loaded workers (default: 256) |
686| `CELLD_MAX_CELL_REQUESTS` | The concurrent fetch limit for one Durable Object or Queue broker (default: 64) |
687| `CELLD_MAX_REQUEST_BODY_BYTES` | The body limit for a public Worker request or a direct Durable Object request (default: 1 GiB) |
688| `CELLD_MAX_RESIDENT_CELLS` | The hard limit for resident cells, enforced at admission |
689| `CELLD_MAX_RSS_MB` | The memory threshold for pressure shedding, applied to the greater of the allocator-adjusted RSS and the allocator-adjusted active cgroup working set (default: 80% of the available memory; 0 disables the threshold and the absolute cap) |
690| `CELLD_OUTPUT_GATE` | The default is `1`, so celld proves each write durable before it acknowledges the write. Set `0` to remove the replication wait and accept possible loss of an acknowledged write |
691| `CELLD_DURABILITY` | How celld proves a write durable before it answers. The default is `fleet`: the node serving the cell sends the write to one or two other nodes and answers once they hold it on disk, or once the bucket upload finishes, whichever comes first. This needs two or more nodes; a single node has nobody to send to, so every write waits for the bucket. Set `bucket` to always wait for the bucket |
692| `CELLD_LOG_CAPTURE_WORKERS` | The limit for concurrent log-capture workers (default: 8) |
693| `CELLD_LOG_PIPELINE` | The limit for fleet log rounds that can be in flight (default: 4) |
694| `CELLD_LOG_HEDGE_MS` | The wait before a leader sends a second copy of a slow log append to a follower. The default is adaptive: celld derives the wait from the slowest recent append in the ensemble (4 times that append, at least 250 ms, and always below the eviction backstop), so a loaded fleet does not send copies for honest slow appends. Set a value to use a fixed wait in milliseconds, and set `0` to disable the second copy. An append is idempotent per sequence, so the copy is safe, and the leader uses the answer that arrives first and confirms |
695| `CELLD_LTX_TRUNCATE_PAGES` | The WAL size, in pages, at which celld truncates an ordinary cell's WAL file at the next checkpoint (default: 128, a 512 KiB cap). A passive checkpoint does not shrink the WAL file, so each capture reads the stale region after a restart. The truncate keeps the read small. Queue cells use passive checkpoints because a truncate boundary emits a full database image. Set `0` to disable the truncate for all cells |
696| `CELLD_LTX_COMPACTION` | The default is `1`: celld creates additive L1 objects, and a takeover reads tens of objects instead of thousands. Set `0` on every node of a mixed fleet until all nodes can read v0.5.2 block objects, because an old reader cannot take over a cell after its first L1 publication |
697| `CELLD_LTX_COMPACTION_MIN_TXIDS` | The durable TXID distance that queues a background L1 attempt (default: 256) |
698| `CELLD_LTX_COMPACTIONS` | The node-wide limit for concurrent background L1 attempts (default: 2). `CELLD_RELEASES` bounds final handoff snapshots |
699| `CELLD_LTX_DURABILITY_TIMEOUT_SECS` | The deadline for a durability proof and the final snapshot retry window, in seconds (default: 10). A slow or busy object store can need a longer deadline for a large write burst |
700| `CELLD_VAR_*`, `CELLD_VARS_FILE` | Worker variable overrides |
701| `RUST_LOG` | The runtime log filter |
702
703The help output also shows the advanced tuning switches and their
704defaults.
705
706An unset variable selects its documented default. A Boolean variable
707accepts only `0` or `1`. celld exits during startup when a supplied value
708is invalid.