# Under the hood

How Object Storage is built, which parts we wrote and which we run off the shelf, what we rejected, what we measured and where the limits are.

Object Storage is a gateway we wrote in front of object stores we did not. Behind it sit the zone
object stores and, since 20 November 2026, a storage cluster of our own: four dedicated servers in
two buildings in Falkenstein running SeaweedFS with a small patch of ours. The decision that
matters most is that the tenant boundary, the credentials and the audit trail live in the gateway,
not in the store, so the store behind a bucket can change without the bucket changing.

## What runs where

```text
S3 client ──TLS 443──▶ Caddy on the control machine
                         │
                         ▼
   s3-gateway, 2 replicas (Node.js)
     SigV4, IAM, bucket policy, key mapping,
     data key, metering, audit
                         │  one store per bucket
                         ▼
   zone object store (de1a, de1b, fi1a)
   own-hosts store
   storage cluster (TLS)
     building A: 2 servers, building B: 2 servers
     each: filer + S3, 4 volume servers (1 per disk)
     masters: one per building + witness (de1b)
     filer DB: Postgres, one per building
     └─ remote copy ──▶ zone store de1b
```

The gateway runs in its own container so object traffic never shares an event loop with the
console. It verifies the SigV4 signature against the key's sealed secret, authorises through the
same IAM engine as every other service, rewrites the bucket to a backing bucket and prefix,
re-signs with the platform's store credential and streams the body through (a write body up to
32 MiB keeps a copy while it streams, so a failed store write can be sent again). The
bucket-to-store mapping is one database row per bucket, which is what makes
[bucket moves](storage-locations.md) possible. Today the endpoint runs on one control machine.
The decided next layout puts it on both control machines behind a TCP load balancer of our own
fleet, each Caddy preferring its local replicas; that layout was proven in our test installation
on two `performance-2` stand-ins (2 shared AMD vCPU, 4 GB) and is not rolled out yet.

On the cluster, each server runs a SeaweedFS filer and S3 server plus one volume server per disk.
A `standard-2` virtual machine (2 shared x86 vCPU, 4 GB) in `de1b` is the witness: a master and an
etcd vote, no data. Filer metadata is in Postgres 16 under Patroni, one node per building,
synchronous replication, backed up with pgBackRest to a bucket in `de1b` through the gateway
itself. Every object has one copy in each building.

## What we built, and what we did not

**The gateway is ours.** A customer S3 service needs credentials scoped to one tenant, policies,
audit and billing; a provider's keys cover every bucket of a project, and one provider project
per customer was rejected as not automatable. It is Node.js on plain `node:http` with our own
SigV4 implementation. Not Rust or Go: the runtime is not the limit, the AWS SDK's per-request CPU
is; we revisit that only if a lean Node path measures below about 5,000 requests per second per
core.

**SeaweedFS, not Ceph, Garage, MinIO or RustFS** (compared 16 November 2026). Ceph RGW is the most
complete and the heaviest to run (8 GB of RAM per OSD, NVMe for WAL and DB, placement-group
tuning); it is for later, past about 2 PB or when we need block storage. Garage has no versioning
and no object lock. MinIO was archived upstream in April 2026. RustFS 1.0 shipped in September
2026 and is too young. SeaweedFS has per-building replication, versioning, object lock, multipart
and SSE-C, and we already ran and tested it.

**Why own hardware at all.** By storage price alone the cluster never wins against the zone store
(break-even around 170 TB with two buildings, more than they may hold). The reasons are the
others: no ceiling on bucket count or per-bucket request rate, and hardware and failures we see
and control.

**A 36-line patch.** In a partition between the buildings, SeaweedFS 4.53's S3 server looked up an
object's entry at the filer owning the key on a cluster-wide hash ring, with no deadline; half the
keys are owned by the other building, so each such read waited out a 20 s connect timeout, and the
failed owner was retried after only 2 s. No flag changes that. Our patch gives the routed lookup a
1 s deadline, skips a failed owner for 30 s and bounds volume lookups to 1.5 s per filer. Rejected:
one filer group per building (it splits the write-lock ring, so conditional and versioned writes
would stop serialising, at all times) and leaving it. The binary is built reproducibly from the
4.53 tag with the Go version and checksum pinned; the patch goes when upstream ships an equivalent.

**Buildings are SeaweedFS data centres, and the gateway hedges reads.** SeaweedFS orders a volume's
copies by data centre, never by rack, and its dial timeout is a hard-coded 30 s; so each building
is a data centre and reads are served from the caller's building. On top, a GET or HEAD on the
cluster without response headers after 800 ms is also asked of a node in the other building, then
one more every 500 ms; the first answer wins, within a budget of 5 hedges a minute plus 5 % of
reads. Writes are never hedged: a doubled DELETE on a versioned bucket leaves two delete markers.

**Keys are escaped, buckets are packed.** SeaweedFS treats keys as file paths (it refuses `.`,
`..` and NUL and folds `a//b`), so the gateway escapes such keys with a private-use marker
(U+E000); percent-encoding would have renamed every existing object. SeaweedFS also makes one
collection and one 16 GiB volume pair per bucket, which caps a cluster near 9,000 buckets; so
plain buckets are packed as prefixes into one of 16 pool buckets, and only object-lock buckets
stay one-to-one. Overcommitting volumes instead would cost about 30 GB of resident memory per
node at 50,000 buckets.

**Filer metadata in Postgres, not embedded leveldb,** whose asynchronous peer sync could answer
404 for a key just written.

**Two buildings plus a witness, 45 % fill, repair uncapped.** A third building is "not now"; the
order point is about 35 % fill. Until then the fill limit of the fullest building is 45 %, not the
70 % first set, so a lost server can be re-copied onto its partner: weeks of single-copy data is
not something a glass-box cloud sells. Repair bandwidth is uncapped because a 20 MB/s cap doubled
the exposure window (54 h to 116 h per disk). Bucket moves happen behind the gateway, not by a
store-side mirror, which cannot see gateway writes or flip atomically. The two-machine endpoint
is to sit behind our load balancer rather than DNS round robin because S3 clients cache DNS.

## Benchmarks

**How to rerun these.** Every run below was driven by an internal tool, not published, against
our own cluster and test installation. Its parts are public: the canary can be rebuilt with boto3
as described under the soak, and the faults name the `nftables`, `systemctl` and SeaweedFS
commands they used.

The cluster under test is the one described above: four dedicated storage servers in
Falkenstein, each an 8-core AMD Ryzen 7 3700X with 64 GB of ECC memory, four 22 TB hard disks and
a 1 Gbit NIC. Figures "through the gateway" went through the gateway of our test installation on
a shared 1 Gbit host; that host, not the cluster, bounds the large-object numbers. Raw per-second
data of every run below is kept.

### 24-hour soak, 18 to 19 November 2026

From the witness in `de1b`, with 50,000 buckets in place: a canary writing random 1 KiB to 64 MiB
objects straight at the cluster and reading every one back against its SHA-256, plus a mixed load
through the gateway (registry layers of 5 to 64 MB, multipart backups to about 400 MB, small
objects, lists, deletes; about 100 GB working set).

| Client                   | Operations | Errors  |      p50 |       p99 | Lost / mismatch |
| ------------------------ | ---------: | ------- | -------: | --------: | --------------- |
| Canary PUT (store level) |    888,497 | 2 × 503 |          |           | 0 / 0           |
| Canary GET               |  1,753,371 | 0       |          |           | 0 / 0           |
| Gateway put, 1 to 64 KB  |    160,732 | 8       |   132 ms |  1,418 ms |                 |
| Gateway get, small       |    160,523 | 7       |    32 ms |    216 ms |                 |
| Gateway list             |     36,685 | 2       |   123 ms |    385 ms |                 |
| Gateway put, layer       |     43,654 | 11      | 1,726 ms |  7,680 ms |                 |
| Gateway put, multipart   |      2,371 | 2       | 5,040 ms | 15,344 ms |                 |
| Gateway get, large       |     46,003 | 7       | 1,113 ms |  4,679 ms |                 |

963 GB written by the canary; 2.39 TB of layers and 473 GB of backups written and 2.88 TB read
through the gateway. None of the 37 gateway errors traced to a cluster fault. The canary is easy to
rebuild with boto3: writers record the digest of what they put, readers fetch random written keys
and verify, every 404 of a written key counts as lost.

### 50,000 buckets, 18 November 2026

Created through the platform API 16 at a time, each given one 1 KiB object: 50,000 in 14.5 min
(about 57/s), create p50 flat at 114 to 126 ms per thousand from first to last; PUT p50 150 ms,
p99 322 ms. Before prefix packing, a store-level test on 17 November (buckets created straight on
the cluster, 16 at a time) slowed to a p50 of 6.7 s per create by 5,116 buckets.

### Partition between the buildings, 19 November 2026

`nftables` drops all traffic between the buildings for 180 s under gateway load. With the patch:
683 of 683 GETs answered, worst 872 ms; lists worst 934 ms; 630 PUTs answered 503 with
`Retry-After: 10` by design; 0 of 4,458 objects lost. Before the patch, with topology and hedging
already in place, the worst GET was 24 s.

### Repair after a lost disk, 18 November 2026

About 128 GiB of test data, two copies, under canary load; one disk lost by stopping its volume
server (`systemctl stop` of that disk's SeaweedFS volume server), then SeaweedFS
`volume.fix.replication`:

| Setting                             |  Copied |  Time | Rate    |
| ----------------------------------- | ------: | ----: | ------- |
| defaults                            | 34.5 GB | 526 s | 66 MB/s |
| 4 parallel copies per server        | 46.2 GB | 582 s | 79 MB/s |
| capped at 20 MB/s per volume server | 34.4 GB | 934 s | 37 MB/s |

Calculated from these rates, not measured: at 70 % fill a 22 TB disk re-copies in about 54 h at
79 MB/s; a whole server, through its partner's single 1 Gbit NIC, in at least 6 days.

### Endpoint on two machines, 19 November 2026

Eight clients, each a PUT, GET and LIST per second, against the two `performance-2` stand-ins
while one was powered off: 3,468 requests, 0 failed, worst 10.8 s (the load balancer's 10 s TCP
user timeout). Both gateways stopped on one machine, or its Caddy killed: 3,600 requests, 0 failed.

### Bucket moves, 19 and 20 November 2026

In our test installation: a 5.06 GiB bucket under about 4 writes/s moved from the zone store to
the cluster with writes held 25 ms and no 503; a pgBackRest repository of 880 MB archiving a WAL
segment every 10 s moved with writes held 1.9 s and 0 of 1,364 archive samples failed; the 5 GiB
bucket moved back with writes held 284 ms, all 8,432 keys read back intact.

### Chaos harness, 20 November 2026

Fourteen scripted faults against the cluster in the hours before its first production bucket: 10
passed, 3 failed their bar, one was a harness error; 0 lost and 0 mismatched over 121,325 canary
and 38,494 gateway keys. Of the four that did not pass, two (the blind scrub and a bucket move
under faults) were bugs in the harness, not in the cluster. Master leader killed: new leader in 1.4 s, writes paused 16.7 s. A server
loses power: slowest write 12.7 s (bar 10 s, failed). Partition: slowest read 1.07 s. A building's
disks fill: writes back 120.4 s after room returned (bar 120 s, failed). Bit rot in an object: 0
wrong reads, found by the scrub, repaired in 56.5 s. Filer database failover: promoted in 22.0 s.

## Known limits

- Both buildings are in one park in Falkenstein; a building loss makes the cluster read-only, and
  zone redundancy exists only through the remote copy in `de1b`.
- A lost server re-copies for at least 6 days through its partner's one NIC.
- Writes during a server or filer loss take up to 9.6 to 12.7 s; a master change pauses writes
  about 17 s; a filer database failover stops reads and writes for 22 to 23 s; recovering from
  "full" takes about 120 s.
- In a partition, a volume whose copy in the serving building is also down still waits the 30 s
  dial.
- Versioning and lifecycle on a pooled bucket only while it is empty; a versioned or object-lock
  bucket cannot be moved between stores; folder keys (`dir/`) lose user metadata on the cluster.
- SeaweedFS's own repair does not see short copies left by a power loss (we run our own detector
  and repair); its open-source erasure coding is RS(10,4) on sealed volumes only, so we use
  replication; it answers an occasional `503` of its own, unexplained.
- The S3 endpoint runs on one control machine today; the two-machine layout is proven but not
  rolled out.
- The gateway is CPU-bound in the AWS SDK: about 480 small GETs per second for two replicas
  (k6 constant-arrival-rate GETs of 4 KiB, 11 November 2026, on an `arm-16` test machine with a
  SeaweedFS stand-in for the store; internal tool, not published; raw output not kept).
- The zone stores have their own per-bucket request-rate and bucket-count limits, and a new bucket
  in `de1b` took about 45 minutes to be known everywhere when we checked on 12 November 2026.

## Related

- [What runs on your machines](what-runs-on-your-machines.md)
- [Storage locations](storage-locations.md)
- [Keep a remote copy](keep-a-remote-copy.md)
- [Encryption](encryption.md)
