diff --git a/seaweed-block/README.md b/seaweed-block/README.md index e8f4290760..a406d221f8 100644 --- a/seaweed-block/README.md +++ b/seaweed-block/README.md @@ -1,93 +1,20 @@ # Seaweed Block -Block storage written in Go: a local-speed block device whose ownership is -fenced by epochs. It serves agent workspace disks backed by -[SeaweedFS](https://github.com/seaweedfs/seaweedfs) snapshots, and Kubernetes -block volumes (alpha). +[![tag](https://img.shields.io/github/v/tag/seaweedfs/seaweed-block?sort=semver&label=release)](docs/releases/v1.0.0.md) +[![CI](https://github.com/seaweedfs/seaweed-block/actions/workflows/test.yml/badge.svg)](https://github.com/seaweedfs/seaweed-block/actions/workflows/test.yml) +[![Go](https://img.shields.io/github/go-mod/go-version/seaweedfs/seaweed-block)](go.mod) +[![License](https://img.shields.io/github/license/seaweedfs/seaweed-block)](LICENSE) + +**Block storage for AI agent workspaces at local-disk speed, with snapshots, restore and moves backed by your own +[SeaweedFS](https://github.com/seaweedfs/seaweedfs).** Each sandbox or microVM gets a plain virtio block disk. Writes +and `fsync` complete on the host's local disk; cuts copy the changed data to SeaweedFS in the background. Losing the +host loses what was written since the last successful cut: normally about a day with the default schedule (one +snapshot a day), not a guaranteed bound; `--chunk-capture-interval` (5 minutes or more) cuts more often. The same core serves Kubernetes block volumes (alpha).

- Seaweed Block: a shared core (blockvolume with ublk, NVMe/TCP and iSCSI frontends and the walstore WAL engine, plus blockmaster as the epoch authority) used for agent workspace disks with chunk snapshots in SeaweedFS and for Kubernetes PVCs, with optional RF=2 or RF=3 replication + Seaweed Block. Write path: an agent sandbox or microVM writes over NVMe/TCP or iSCSI to blockvolume, which completes the write and fsync on its local WAL and acknowledges; a write does not wait on SeaweedFS, except that a restored volume fetches each chunk from its snapshot once, on its first read or write. Background path: a cut (by default one scheduled snapshot a day; periodic cuts are optional) uploads only the changed 4 MiB chunks to your SeaweedFS, then updates the HEAD root with a conditional update on generation and epoch. blockmaster issues epochs and leases. Snapshots name a root and share chunks; a restore reads the snapshot's chunks on first use; a move hands the volume to another host at a higher epoch, and a stale holder's update is refused.

-## What it is - -| | Agent workspace disks | Kubernetes block volumes | -|---|---|---| -| Consumer | an agent sandbox or microVM, as a plain virtio block device | an app pod, through a PVC and the CSI driver | -| Frontend | NVMe/TCP loopback or ublk | iSCSI, or NVMe/TCP (source-gated) | -| Durability | one local replica, with cuts to SeaweedFS | RF=1 with best-effort ack by default; synchronous RF=2 or RF=3 (`sync-quorum`, `sync-all`) when configured, in a supported lab | -| Maturity | v1.0.0, single replica | alpha | - -Both uses share one core. `blockvolume` serves one volume replica; its -frontends turn block requests into a single Read / Write / Sync contract, and -`Sync` is the only durability point. Writes land in a local WAL engine, -`walstore` (a WAL plus an extent). `blockvolume --durable-impl` defaults to -auto: a new volume is created as `walstore` and an existing one opens with its -on-disk format; auto refuses a `walstore-chunk` root, which needs -`--durable-impl=walstore-chunk` with its remote configuration. `smartwal` is -experimental. `blockmaster` is the only component that mints epochs. Each -`blockvolume` admits I/O only while its local view of the assignment is -current: a deposed primary refuses I/O once it observes the new assignment or -a fence, or once its workspace lease expires. That is a local admission rule, -not an instant global revocation. Separately, every remote HEAD publish is a -conditional update on `{gen, epoch}`, so the store refuses a stale holder's -publish even before that holder notices it was replaced. The design is in -three documents: the [core design](docs/design/block-design.md), the [agent -workspace design](docs/design/agent-workspace-design.md) and the [Kubernetes -block design](docs/design/kubernetes-block-design.md). Each covers its parts, -their invariants, the tests behind them and the known issues. - -## Highlights - -**Agent workspace disks** - -- **Local-speed disk.** Writes and `fsync` complete against the local WAL; - nothing on the write path waits on the network. -- **Incremental snapshots.** A cut uploads only the changed 4 MiB chunks. - Chunks are immutable; the volume's state is a HEAD root of about 2 KB, and - every publish is a conditional update on `{gen, epoch}`. -- **Cheap snapshot and restore.** A snapshot copies only the HEAD root; chunks - are shared. A restore makes a new volume that reads the snapshot's chunks. - The holder's cleaning removes the chunks that no snapshot, restore target - or current image names; SeaweedFS vacuum then returns the space. -- **Move to any host.** Another host takes over with a higher epoch and fetches - chunks lazily on first read. A stale holder cannot publish. -- **Single replica by design.** Losing a host loses at most the writes since - the last cut. Cut at semantic points: after an agent step, before a risky - command, on detach. - -**Kubernetes block volumes (alpha)**: Helm install, dynamic PVCs, RF=3 -recovery gates in a supported lab, support-bundle replay, and negative-first -read-only status (stale evidence is `Ready=Unknown`, never a false ready). - -## Measured results - -Lab runs, median of 3; not SLOs. Workloads: Firecracker microVMs (4 vCPU, -4 GiB) on one bare-metal host over NVMe/TCP loopback, against a local -file-backed disk. The two `fsync` rows marked "ublk" come from a later run on -the same host with the ublk frontend, after the group-commit fix -([#173](https://github.com/seaweedfs/seaweed-block/pull/173)). For -the snapshot row: a host-side proxy without network latency, guest `fsync` or the block -frontend. The two-host lifecycle row is a pre-release run that included fork (removed -from this release) and the earlier GC. - -| Measurement | Seaweed Block | Local disk | -|---|---|---| -| `npm ci` (617 packages, offline) / `git clone` (Go 1.23, local) | 2.14 s / 7.10 s | 2.14 s / 6.99 s | -| Untar 100,000 files / cold `find` + `stat` over them | 1.10 s / 0.32 s | 1.06 s / 0.33 s | -| 2,000 × create + write + `fsync` (ublk) | 8.48 s | 6.11 s | -| Guest `fsync` median, fio 4 KiB random write, one at a time (ublk) | 3.23 ms | 2.74 ms | -| Snapshot of a 10 GiB volume (2,560 chunks) | 0.18 ms | | -| Two-host lifecycle (pre-release): create, snapshot, fork, move, stale holder, delete, GC | 35 of 35 checks | | - -Metadata-heavy workloads run at local-disk speed. The remaining cost is -`fsync`: a median of 3.23 ms against 2.74 ms local with the ublk frontend -(3.59 ms over NVMe/TCP loopback), down from about 7 ms before the group-commit -fix. Every guest `fsync` still reaches the backend sync; no write cache is -turned off to get there. -[Workspace measurements](docs/workspace-measurements.md) has every number and -how each was measured. - ## Install The binaries are `blockmaster`, `blockvolume` and the `sw-block` CLI. The commands on this page are for v1.0.0. @@ -119,6 +46,76 @@ not format or write the attached device; it only creates local backing files and logs. It needs Linux, bash, `nvme-cli`, `sudo` and the binaries above. To format and write, use the [write test](docs/standalone-deployment.md#write-test-scratch-host-only) (scratch host only). +## Why Seaweed Block + +- **Close to local-disk speed for agent work.** In a pre-release run on the `walstore` engine (the local engine the + released chunk path builds on), `npm ci`, `git clone` and untar ran within 0-4% of a local disk for the operation + itself. With the final file-system flush included on both sides, they were 11-23% slower than the local disk, and + untar of 5,000 small files took about 2.2 times as long. On the released path, `fsync` costs about + 1.3 times local ([measured results](#measured-results), [how each was measured](docs/workspace-measurements.md)). +- **`fsync` is durable on the host that serves the volume.** Every guest `fsync` reaches the host's disk; no write + cache is turned off to get the speed (a gate counts flushes against backend syncs, with an unsafe-cache control). + In fault injection on the release candidate (process kills and a store pause on one host; not a power-loss test), + 0 acknowledged writes were lost across 253 judged; the same runs failed other operation checks, listed with the + record. If the host itself is lost, the volume comes back from its last cut + ([records](docs/workspace-measurements.md)). +- **Snapshots in your object store.** A cut uploads only the changed 4 MiB chunks. A snapshot names a root of about + 2 KB and shares its chunks; a restore makes a new volume that reads them on first use + ([agent workspace design](docs/design/agent-workspace-design.md)). +- **Safe moves between hosts.** One blockmaster issues epochs and leases, and a holder admits I/O only while its own + lease is current; run exactly one blockmaster per cluster. Separately, every HEAD update is conditional on + `{gen, epoch}`, so the store refuses a stale holder's publish even before that holder notices it was replaced + ([volume lifecycle](docs/volume-lifecycle.md), [TLA+ specifications](docs/spec/README.md)). +- **Self-hosted.** Go, Apache-2.0, on your own hosts and your own SeaweedFS. +- **Against an early FUSE prototype on the same host** (host-side, built on the SeaweedFS filer; not a released + product), in the same pre-release run, untar, `npm ci` and `git clone` were 4 to 36 times faster with the final + flush included; `fsync`-bound work took the same time ([record](docs/workspace-measurements.md)). + +## Measured results + + + + Time on Seaweed Block relative to a local disk, over NVMe/TCP loopback: npm ci 1.00, git clone 1.02, untar 100,000 files 1.04, cold find and stat 0.97, 2,000 create plus write plus fsync 1.52, guest fsync median 1.31. + + +Lab runs, median of 3; not SLOs. Workloads: Firecracker microVMs (4 vCPU, 4 GiB) on one bare-metal host over +NVMe/TCP loopback, against a local file-backed disk. The first four rows come from a pre-release build on the +`walstore` engine and time the operation itself. With the final `syncfs` flush included on both sides (recorded +separately), the first three are 11-23% slower than the local disk (see the measurements page). The two `fsync` rows come from a later run of the released path +(`walstore-chunk`) on the same host, after the group-commit fix +([#173](https://github.com/seaweedfs/seaweed-block/pull/173)). The chart is drawn from +[measured-results.csv](docs/assets/measured-results.csv) by `docs/assets/readme-chart.py`. + +| Measurement | Seaweed Block | Local disk | +|---|---|---| +| `npm ci` (617 packages, offline) / `git clone` (Go 1.23, local) | 2.14 s / 7.10 s | 2.14 s / 6.99 s | +| Untar 100,000 files / cold `find` + `stat` over them | 1.10 s / 0.32 s | 1.06 s / 0.33 s | +| 2,000 × create + write + `fsync` | 9.27 s | 6.11 s | +| Guest `fsync` median, fio 4 KiB random write, one at a time | 3.59 ms | 2.74 ms | +| Snapshot of a 10 GiB volume (2,560 chunks) | 0.18 ms | | +| Two-host lifecycle (pre-release): create, snapshot, fork, move, stale holder, delete, GC | 35 of 35 checks | | + +The snapshot row is a host-side proxy without network latency, guest `fsync` or the block frontend. The two-host +lifecycle row is a pre-release run that included fork (removed from this release) and the earlier GC. The remaining +cost is `fsync`: a median of 3.59 ms against 2.74 ms local over NVMe/TCP loopback. The ublk frontend measured +3.23 ms in the same run; ublk is not among v1.0.0's supported frontends (NVMe/TCP and iSCSI). +[Workspace measurements](docs/workspace-measurements.md) has every number, the FUSE comparison and how each was +measured. + +## Status and limits + +- **Recovery point:** a lost host loses what was written since the volume's last successful snapshot or cut: + normally about a day with the default schedule (one scheduled snapshot a day, which is attempted, not + guaranteed). `--chunk-capture-interval` + (5 minutes or more) adds periodic cuts and shortens it. +- **v1.0.0 supports** the single-replica volume (`--durable-impl walstore-chunk`), backed up to SeaweedFS with + snapshots, restore, moves and volume delete. New volumes are at most 256 GiB. See the + [release note](docs/releases/v1.0.0.md) and its [known limits](docs/releases/v1.0.0.md#known-limits). +- **Replicated volumes** are a preview ([replicated volumes preview](docs/releases/replicated-volumes-preview.md)). +- **Kubernetes** is an alpha, for supported lab clusters ([Kubernetes status](docs/kubernetes-status.md)). +- **Planned for v1.0.1:** larger volumes, a troubleshooting check and page, and an interactive `sw-block shell`. + The recovery point above does not change in v1.0.1. + ## Agent workspace disks: chunk lifecycle The workspace path runs `blockvolume` with `--durable-impl=walstore-chunk`, @@ -180,8 +177,7 @@ helm uninstall sw-block --namespace kube-system bash scripts/uninstall-k8s-alpha.sh "$PWD" && bash scripts/verify-helm-cleanup.sh ``` - -## Status +## Detailed status | Area | Status | |---|---| @@ -205,8 +201,8 @@ Secrets first ([quickstart](docs/quickstart-kubernetes.md)). ### Not claimed yet - Production readiness, SLOs, or a published performance, RTO or RPO claim. -- `fsync` parity with local disk. Today it is about 1.2× local (see Measured - results). +- `fsync` parity with local disk. Today it is about 1.3× local over NVMe/TCP + (see Measured results). - ublk at high density. Unprivileged per-volume servers need a privileged control broker, which is not done. - Crash-restart recovery of a ublk server. A crashed server fails closed. @@ -261,6 +257,11 @@ go test ./cmd/sw-block ./core/ops ./core/csi ./core/launcher ./core/host/master The full `go test ./...` sweep may include in-progress packages outside the release gate. `scripts/activate-k8s-alpha.sh` remains for local images. +## Community + +Questions and bug reports: [GitHub Issues](https://github.com/seaweedfs/seaweed-block/issues). Seaweed Block builds on +[SeaweedFS](https://github.com/seaweedfs/seaweedfs). + ## License Apache-2.0 diff --git a/seaweed-block/docs/assets/measured-results-dark.svg b/seaweed-block/docs/assets/measured-results-dark.svg new file mode 100644 index 0000000000..9db164b963 --- /dev/null +++ b/seaweed-block/docs/assets/measured-results-dark.svg @@ -0,0 +1,43 @@ + +Workload time on Seaweed Block relative to a local disk +npm ci (617 packages; offline): 1.00 times local (2.14 s against 2.14 s); git clone (Go 1.23; local): 1.02 times local (7.10 s against 6.99 s); Untar 100,000 files: 1.04 times local (1.10 s against 1.06 s); Cold find + stat over them: 0.97 times local (0.32 s against 0.33 s); 2000 x create + write + fsync: 1.52 times local (9.27 s against 6.11 s); Guest fsync median (fio 4 KiB): 1.31 times local (3.59 ms against 2.74 ms) + +Time on Seaweed Block relative to a local disk (local disk = 1.0) +Lab runs over NVMe/TCP loopback, median of 3, not SLOs. Lower is faster. + +0.0 + +0.5 + +1.0 + +1.5 + +2.0 + +local disk +npm ci (617 packages; offline) +pre-release walstore; operation only +npm ci (617 packages; offline): 1.00 x local (2.14 s against 2.14 s) +1.00x (2.14 s / 2.14 s) +git clone (Go 1.23; local) +pre-release walstore; operation only +git clone (Go 1.23; local): 1.02 x local (7.10 s against 6.99 s) +1.02x (7.10 s / 6.99 s) +Untar 100,000 files +pre-release walstore; operation only +Untar 100,000 files: 1.04 x local (1.10 s against 1.06 s) +1.04x (1.10 s / 1.06 s) +Cold find + stat over them +pre-release walstore +Cold find + stat over them: 0.97 x local (0.32 s against 0.33 s) +0.97x (0.32 s / 0.33 s) +2000 x create + write + fsync +walstore-chunk (released path) +2000 x create + write + fsync: 1.52 x local (9.27 s against 6.11 s) +1.52x (9.27 s / 6.11 s) +Guest fsync median (fio 4 KiB) +walstore-chunk (released path) +Guest fsync median (fio 4 KiB): 1.31 x local (3.59 ms against 2.74 ms) +1.31x (3.59 ms / 2.74 ms) + diff --git a/seaweed-block/docs/assets/measured-results-light.svg b/seaweed-block/docs/assets/measured-results-light.svg new file mode 100644 index 0000000000..f428a56ecc --- /dev/null +++ b/seaweed-block/docs/assets/measured-results-light.svg @@ -0,0 +1,43 @@ + +Workload time on Seaweed Block relative to a local disk +npm ci (617 packages; offline): 1.00 times local (2.14 s against 2.14 s); git clone (Go 1.23; local): 1.02 times local (7.10 s against 6.99 s); Untar 100,000 files: 1.04 times local (1.10 s against 1.06 s); Cold find + stat over them: 0.97 times local (0.32 s against 0.33 s); 2000 x create + write + fsync: 1.52 times local (9.27 s against 6.11 s); Guest fsync median (fio 4 KiB): 1.31 times local (3.59 ms against 2.74 ms) + +Time on Seaweed Block relative to a local disk (local disk = 1.0) +Lab runs over NVMe/TCP loopback, median of 3, not SLOs. Lower is faster. + +0.0 + +0.5 + +1.0 + +1.5 + +2.0 + +local disk +npm ci (617 packages; offline) +pre-release walstore; operation only +npm ci (617 packages; offline): 1.00 x local (2.14 s against 2.14 s) +1.00x (2.14 s / 2.14 s) +git clone (Go 1.23; local) +pre-release walstore; operation only +git clone (Go 1.23; local): 1.02 x local (7.10 s against 6.99 s) +1.02x (7.10 s / 6.99 s) +Untar 100,000 files +pre-release walstore; operation only +Untar 100,000 files: 1.04 x local (1.10 s against 1.06 s) +1.04x (1.10 s / 1.06 s) +Cold find + stat over them +pre-release walstore +Cold find + stat over them: 0.97 x local (0.32 s against 0.33 s) +0.97x (0.32 s / 0.33 s) +2000 x create + write + fsync +walstore-chunk (released path) +2000 x create + write + fsync: 1.52 x local (9.27 s against 6.11 s) +1.52x (9.27 s / 6.11 s) +Guest fsync median (fio 4 KiB) +walstore-chunk (released path) +Guest fsync median (fio 4 KiB): 1.31 x local (3.59 ms against 2.74 ms) +1.31x (3.59 ms / 2.74 ms) + diff --git a/seaweed-block/docs/assets/measured-results.csv b/seaweed-block/docs/assets/measured-results.csv new file mode 100644 index 0000000000..6504a42668 --- /dev/null +++ b/seaweed-block/docs/assets/measured-results.csv @@ -0,0 +1,7 @@ +workload,seaweed_block,local_disk,unit,frontend +npm ci (617 packages; offline),2.14,2.14,s,pre-release walstore; operation only +git clone (Go 1.23; local),7.10,6.99,s,pre-release walstore; operation only +"Untar 100,000 files",1.10,1.06,s,pre-release walstore; operation only +Cold find + stat over them,0.32,0.33,s,pre-release walstore +2000 x create + write + fsync,9.27,6.11,s,walstore-chunk (released path) +Guest fsync median (fio 4 KiB),3.59,2.74,ms,walstore-chunk (released path) diff --git a/seaweed-block/docs/assets/readme-chart.py b/seaweed-block/docs/assets/readme-chart.py new file mode 100644 index 0000000000..a5c898a2e9 --- /dev/null +++ b/seaweed-block/docs/assets/readme-chart.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python3 +"""Draw the README's measured-results chart from docs/assets/measured-results.csv. + +Each workload's time on Seaweed Block is shown relative to the same workload on +a local disk (local disk = 1.0), so rows with different units share one axis. +Writes a light and a dark SVG next to the CSV. With --check, it writes nothing +and exits 1 if either SVG differs from what the CSV gives. + +usage: python3 docs/assets/readme-chart.py [--check] +""" +import csv +import sys +from pathlib import Path +from xml.sax.saxutils import escape + +ROOT = Path(__file__).resolve().parent.parent.parent +CSV = ROOT / "docs" / "assets" / "measured-results.csv" +OUT = {"light": ROOT / "docs" / "assets" / "measured-results-light.svg", + "dark": ROOT / "docs" / "assets" / "measured-results-dark.svg"} + +THEMES = { + "light": {"surface": "#fcfcfb", "ink": "#0b0b0b", "ink2": "#52514e", "grid": "#e4e3df", + "ref": "#52514e", "bar": "#2a78d6"}, + "dark": {"surface": "#1a1a19", "ink": "#f0efec", "ink2": "#c3c2b7", "grid": "#383835", + "ref": "#c3c2b7", "bar": "#3987e5"}, +} + +W, LABEL_W, RIGHT_W = 760, 250, 150 +ROW_H, BAR_H, TOP, BOTTOM = 34, 14, 56, 44 +XMAX = 2.0 +TICKS = [0.0, 0.5, 1.0, 1.5, 2.0] + + +def rows(): + with CSV.open(encoding="utf-8", newline="") as f: + out = [] + for r in csv.DictReader(f): + sb, local = float(r["seaweed_block"]), float(r["local_disk"]) + out.append((r["workload"], sb, local, r["unit"], r["frontend"])) + return out + + +def fmt(v, unit): + return f"{v:.2f} {unit}" + + +def bar_path(x0, y, w, h, r=4): + """A bar anchored at x0 with a rounded data end (right side only).""" + r = min(r, w, h / 2) + x1 = x0 + w + return (f"M{x0:.1f},{y:.1f} H{x1 - r:.1f} Q{x1:.1f},{y:.1f} {x1:.1f},{y + r:.1f} " + f"V{y + h - r:.1f} Q{x1:.1f},{y + h:.1f} {x1 - r:.1f},{y + h:.1f} H{x0:.1f} Z") + + +def svg(theme): + t = THEMES[theme] + data = rows() + for w, sb, lo, _, _ in data: + if sb / lo > XMAX: + raise SystemExit(f"{w}: {sb / lo:.2f} is beyond the axis ({XMAX}); raise XMAX") + plot_w = W - LABEL_W - RIGHT_W + h = TOP + ROW_H * len(data) + BOTTOM + + def x(v): + return LABEL_W + plot_w * v / XMAX + + parts = [ + f'', + 'Workload time on Seaweed Block relative to a local disk', + '' + escape("; ".join( + f"{w}: {sb / lo:.2f} times local ({fmt(sb, u)} against {fmt(lo, u)})" for w, sb, lo, u, _ in data)) + '', + f'', + f'' + 'Time on Seaweed Block relative to a local disk (local disk = 1.0)', + f'' + 'Lab runs over NVMe/TCP loopback, median of 3, not SLOs. Lower is faster.', + ] + for v in TICKS: + parts.append(f'') + parts.append(f'{v:.1f}') + parts.append(f'') + parts.append(f'local disk') + for i, (w, sb, lo, u, fe) in enumerate(data): + yc = TOP + ROW_H * i + ROW_H / 2 + ratio = sb / lo + parts.append(f'{escape(w)}') + parts.append(f'{escape(fe)}') + parts.append(f'{escape(w)}: {ratio:.2f} x local ' + f'({fmt(sb, u)} against {fmt(lo, u)})') + parts.append(f'' + f'{ratio:.2f}x ' + f'({fmt(sb, u)} / {fmt(lo, u)})') + parts.append("") + return "\n".join(parts) + "\n" + + +def main(): + check = sys.argv[1:] == ["--check"] + stale = [] + for theme, path in OUT.items(): + text = svg(theme) + if check: + if not path.exists() or path.read_text(encoding="utf-8").replace("\r\n", "\n") != text: + stale.append(str(path.relative_to(ROOT))) + else: + path.write_text(text, encoding="utf-8", newline="\n") + if stale: + print("stale, rerun docs/assets/readme-chart.py: " + ", ".join(stale)) + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/seaweed-block/docs/assets/seaweed-block-hero.svg b/seaweed-block/docs/assets/seaweed-block-hero.svg index 6c2ba3f7fe..f31a7bc4bc 100644 --- a/seaweed-block/docs/assets/seaweed-block-hero.svg +++ b/seaweed-block/docs/assets/seaweed-block-hero.svg @@ -1,105 +1,113 @@ - - Seaweed Block: one block service core, two uses - A shared core (blockvolume with ublk, NVMe/TCP and iSCSI frontends, one Read/Write/Sync backend contract and the walstore WAL engine, plus blockmaster as the epoch authority) serves two uses: agent microVM disks that cut changed chunks to SeaweedFS for snapshots, forks and host moves, and Kubernetes PVCs through CSI, RF=1 by default with optional RF=2 or RF=3 replication. + + Seaweed Block: the write path and the background path + Left, the write path: an agent sandbox or microVM writes to a plain virtio block disk; NVMe/TCP or iSCSI carries the request to blockvolume, which completes the write and fsync on its local WAL and acknowledges. A write does not wait on SeaweedFS, except that a restored volume fetches each chunk from its snapshot once, on its first read or write. Right, the background path: a cut (by default one scheduled snapshot a day; periodic cuts are optional) uploads only the changed 4 MiB chunks to your SeaweedFS and then updates the volume's HEAD root with a conditional update on generation and epoch. A snapshot names a root and shares its chunks; a restore makes a new volume that reads chunks on first use; a move lets another host take over at a higher epoch, and a stale holder's update is refused. Above both, blockmaster issues epochs and leases. The same core serves Kubernetes volumes through the CSI driver (alpha). + - - - - - - - - - + + + - + + Seaweed Block + Writes complete on the host's local disk; snapshots, restore and moves go through your SeaweedFS in the background. - Seaweed Block - One block service core · two uses: agent workspace disks and Kubernetes block volumes + + + blockmaster: the epoch authority + assigns each volume's holder · issues epochs and leases - - AGENT WORKSPACE DISKS - · proof of concept - - agent microVM - /dev/vda · ext4 - one local-speed disk per sandbox + + + + + WRITE PATH (synchronous) + + BACKGROUND PATH (cuts) - - KUBERNETES BLOCK VOLUMES - · alpha - - app pod + PVC - blockcsi: provision, attach, mount - Helm chart · read-only status + + + agent sandbox or microVM + a plain virtio block disk + + + NVMe/TCP or iSCSI + + + blockvolume (one per volume) + + + local WAL + extent + walstore, on the host's disk + + + a write does not wait on + SeaweedFS (a restored volume + fetches each chunk once, + on first read or write) + ack (left arrow) + write and fsync complete + on the local WAL - - - Shared core + + + cut + daily snapshot by default; optional periodic cuts + + + only the changed 4 MiB chunks + + + your SeaweedFS + + + HEAD root (about 2 KB) + conditional update on {gen, epoch} + + snapshot + names a root; chunks are shared + restore + a new volume that reads the + snapshot's chunks on first use + move + another host takes over at a + higher epoch; a stale holder's + HEAD update is refused - - blockvolume - one process per volume replica + + - - ublk - - NVMe/TCP - - iSCSI + + + epoch, lease + + epoch fencing - one Backend contract: Read · Write · Sync - - - local WAL engine: walstore - WAL + extent · group fsync · typed recovery reasons - - - - blockmaster · epoch authority - assignments · epochs · leases · epoch fencing - - - - virtio-blk - - iSCSI or - NVMe/TCP - - - - SeaweedFS - - HEAD root (~2 KB) - conditional update on {gen, epoch} - - - - - - - - - immutable 4 MiB chunks, shared - snapshot / fork = copy the root - resume on another host at epoch + 1 - - - cut - changed - chunks - - - - Optional replicas (RF=2 / 3) - ship by LSN · durable barrier - best_effort · sync_quorum · sync_all - catch-up or rebuild · epoch-fenced - - - replicate - - - Workspace disks run one local replica; durability comes from cuts to SeaweedFS. Kubernetes volumes default to RF=1; synchronous RF=2 or RF=3 is opt-in (supported lab). + + The same core serves Kubernetes volumes through the CSI driver (iSCSI or NVMe/TCP; alpha in v1.0.0). diff --git a/seaweed-block/docs/workspace-measurements.md b/seaweed-block/docs/workspace-measurements.md index 8a532d684d..82e87c33e6 100644 --- a/seaweed-block/docs/workspace-measurements.md +++ b/seaweed-block/docs/workspace-measurements.md @@ -12,17 +12,21 @@ microVMs (4 vCPU, 4 GiB, guest kernel 6.1). The snapshot, fork and cut numbers come from a host-side proxy, described with their table. Each number is the median of 3 runs. They are measurements, not SLOs. -**Workspace workloads, Seaweed Block disk vs a local file-backed disk** (one -bare-metal host; NVMe/TCP loopback; seconds): +**Workspace workloads, Seaweed Block disk vs a local file-backed disk** (run +`swbd0a-r5`, 2026-11-15; a pre-release build, commit `f7a6305`, with +`--durable-impl walstore`, the local engine that the released `walstore-chunk` +path builds on; one bare-metal host; NVMe/TCP loopback; seconds). The first two +columns time the operation itself; the last two add the guest `syncfs` that +followed it, recorded separately: -| Workload | Seaweed Block | Local disk | -|---|---|---| -| `npm ci` (617 packages, offline) | 2.14 | 2.14 | -| `git clone` (Go 1.23 repository, local) | 7.10 | 6.99 | -| Untar 5,000 files | 0.31 | 0.31 | -| Untar a 100,000-file tree | 1.10 | 1.06 | -| `find` + `stat` over 100,000 files (cold) | 0.32 | 0.33 | -| 2,000 × create + write + `fsync` | 14.33 | 6.09 | +| Workload | Seaweed Block | Local disk | Seaweed Block with `syncfs` | Local disk with `syncfs` | +|---|---|---|---|---| +| `npm ci` (617 packages, offline) | 2.14 | 2.14 | 2.90 | 2.36 | +| `git clone` (Go 1.23 repository, local) | 7.10 | 6.99 | 8.01 | 7.23 | +| Untar 5,000 files | 0.31 | 0.31 | 1.07 | 0.49 | +| Untar a 100,000-file tree | 1.10 | 1.06 | 1.32 | 1.17 | +| `find` + `stat` over 100,000 files (cold) | 0.32 | 0.33 | | | +| 2,000 × create + write + `fsync` | 14.33 | 6.09 | 14.34 | 6.09 | - Metadata-heavy agent workloads run at local-disk speed, because the guest kernel absorbs metadata and the block device only sees batched writes. @@ -34,6 +38,25 @@ bare-metal host; NVMe/TCP loopback; seconds): - The same comparison on an Azure `D16s_v5` nested-virtualization host gives the same picture. +**The same workloads against an early FUSE prototype on the same host** (same +run, `swbd0a-r5`; the comparator is a host-side FUSE prototype built on the +SeaweedFS filer, not a released product and not FUSE file systems in general; +seconds, median of 3; its times change by less than 0.01 s with `syncfs`): + +| Workload | Seaweed Block | FUSE prototype | Factor | Seaweed Block with `syncfs` | Factor with `syncfs` | +|---|---|---|---|---|---| +| `npm ci` (617 packages, offline) | 2.14 | 11.81 | 5.5× | 2.90 | 4.1× | +| `git clone` (Go 1.23 repository, local) | 7.10 | 37.09 | 5.2× | 8.01 | 4.6× | +| Untar 5,000 files | 0.31 | 19.28 | 62× | 1.07 | 18× | +| Untar a 100,000-file tree | 1.10 | 47.54 | 43× | 1.32 | 36× | +| 2,000 × create + write + `fsync` | 14.33 | 14.32 | 1.0× | 14.34 | 1.0× | + +- Metadata-heavy work was 4 to 36 times faster on the block disk with the final + flush included (5 to 62 times for the operation alone); `fsync`-bound work + took the same time on both. +- The cold `find` + `stat` row has no FUSE equivalent in this run (the FUSE + runs measured a first and a second pass instead), so it is left out. + **`fsync` after the group-commit fix** ([#173](https://github.com/seaweedfs/seaweed-block/pull/173); one bare-metal lab host; Firecracker guest; fio 4 KiB random write, one request at a time, `fsync` after every write, 60 s; median of 3 boots per setup): @@ -88,6 +111,22 @@ In the same proxy, a cut that writes 64 dirty chunks (256 MiB) took a median - Everything still referenced read back byte-identical, including the moved workspace's digest before and after GC. -These results cover the chunk path (`walstore-chunk`), which is a proof of -concept: not yet a default, a release claim or a production path. The +**Fault injection on the release candidate** (v1.0.0-rc.3, 2026-11-28; five +runs on one lab host, single-replica volumes, the same holder and object store; +each run injected a process kill during a snapshot, a kill during a write, and a +pause of the object store during a snapshot; process faults only, not a +power-loss test): + +- The durability checker judged 253 writes across the five runs: acknowledged + writes lost = 0, and writes of unknown outcome landing after a + later durable write = 0. +- Four of the five runs failed other checks: checks of operation outcomes + (snapshot, move and restore results), including a restore target that could + not be read and a restore whose outcome stayed unresolved. These are separate + from the write-loss check above and were not found to be write loss; for the + unresolved restore, the absence of loss was not established. + +The lifecycle run above predates v1.0.0. In v1.0.0 the chunk path +(`walstore-chunk`) is the supported single-replica configuration; see the +[v1.0.0 release note](releases/v1.0.0.md). The [agent workspace design](design/agent-workspace-design.md) describes how it works.