Merge pull request #161 from seaweedfs/docs/readme-agent-workspace-disks

docs: README leads with agent workspace disks
This commit is contained in:
Ping Qiu authored and GitHub committed 2026-11-16 09:43:08 -08:00
commit ba3bbfe25b
2 files changed
+243 -14

No files matched your search

+153 -14
View File
@@ -1,17 +1,152 @@
# Seaweed Block (Alpha)
# Seaweed Block
<p align="center">
<img src="docs/assets/seaweed-block-hero.svg" alt="Seaweed Block alpha architecture: Kubernetes PVC to CSI, blockmaster, blockvolume, iSCSI, and WAL-backed recovery" width="100%">
<img src="docs/assets/seaweed-block-agent-workspace.svg" alt="Seaweed Block agent workspace disks: a local-speed disk per agent microVM, incremental snapshots to SeaweedFS, fork and resume on any host" width="100%">
</p>
Seaweed Block is an experimental Kubernetes block storage service built around:
Seaweed Block is a block storage service written in Go. It has two uses:
- normal Kubernetes PVC workflow,
- a CSI driver,
- Seaweed block components,
- read-only operations evidence.
1. **Agent workspace disks (new).** Each agent sandbox or microVM gets a
local-speed block device. Snapshots, forks and host moves are cheap because
the data is stored as content chunks in [SeaweedFS](https://github.com/seaweedfs/seaweedfs).
2. **Kubernetes block volumes (alpha).** PVC-backed volumes through a CSI driver,
with RF=3 replication, iSCSI or NVMe/TCP, and read-only operations evidence.
See [Kubernetes block storage](#kubernetes-block-storage-alpha).
The current alpha is focused on one user-visible loop:
## Agent workspace disks
An agent sandbox needs a disk that works like a laptop disk (`npm ci`,
`git clone`, compilers, SQLite), and it also needs snapshot, fork, rollback and
restore-on-another-host. Seaweed Block gives each workspace:
- **A local-speed disk.** The volume runs next to the VM. The guest sees a
plain virtio block device through NVMe/TCP loopback or a ublk device. Writes
and `fsync` complete against a local write-ahead log, and nothing waits on
the network.
- **Durable, incremental snapshots in SeaweedFS.** A cut uploads only the 4 MiB
chunks changed since the last cut. Chunks are immutable. The volume's state
is a small HEAD manifest, a root of about 2 KB that points at segment
manifests, and every publish is a fenced, conditional update of that root.
- **Cheap snapshot and fork.** A snapshot or fork copies only the HEAD root;
chunks are shared. Unreferenced chunks are reclaimed by a two-phase, graced
GC.
- **Move to any host.** Detach on one host. Another host takes over with a
higher epoch, starts from the HEAD alone and fetches chunks lazily on first
read. A stale holder cannot publish after takeover, because every HEAD
update is conditional on `{gen, epoch}`.
- **Single replica by design.** Workspaces run with one local replica, and
durability comes from SeaweedFS snapshots, so there is no synchronous
replication on the write path. Losing a host loses at most the writes since
the last cut. Cut on semantic points: after an agent step, before a risky
command, on detach.
```text
agent microVM ──virtio-blk──> blockvolume (local WAL + extent)
│ cut: changed chunks only
▼
SeaweedFS (immutable chunks + HEAD manifest)
│ snapshot / fork = copy HEAD root
▼
another host: take over HEAD (epoch+1), lazy-load chunks
```
### Measured
The workload and lifecycle numbers come from lab runs with Firecracker
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):
| 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 |
- Metadata-heavy agent workloads run at local-disk speed, because the guest
kernel absorbs metadata and the block device only sees batched writes.
- Every guest `fsync` was verified to reach the backend sync: about 2 NVMe
flushes per `fsync`, and zero in an unsafe-cache control.
- The cost today is `fsync` latency, about 7 ms against 3 ms local. Work in
progress to close that gap: the ublk frontend, group commit, and a per-stage
`fsync` latency breakdown (`/status` histograms).
- The same comparison on an Azure `D16s_v5` nested-virtualization host gives
the same picture.
**Snapshot and fork cost** (a 10 GiB volume written as 2,560 chunks of 4 MiB;
median of 3). This is a host-side proxy, not a guest or network run: chunks are
local files on a native Linux host, and filer metadata calls use a
deterministic model, so network latency, guest `fsync` and the block frontend
are excluded.
| | Flat manifest | Two-level manifest (current) |
|---|---|---|
| HEAD size | 261,531 B | 2,172 B |
| Snapshot | 5.79 ms | 0.18 ms |
| Fork | 10.67 ms | 0.29 ms |
In the same proxy, a cut that writes 64 dirty chunks (256 MiB) took a median
624 ms with one upload at a time and 434 ms with 8 parallel uploads.
**Workspace lifecycle on two hosts** (Firecracker VMs, SeaweedFS chunk backend):
- 35 of 35 checks passed:
- create;
- write;
- snapshot S1 and S2;
- fork from S1, which is independent of its parent;
- a clean move to the second host;
- a stale-holder replay, which is refused;
- delete the fork and S1, then GC.
- GC reclaimed 38 of 38 candidate chunks, and every reclaimed chunk returns 404.
- Everything still referenced read back byte-identical, including the moved
workspace's digest before and after GC.
### Try the chunk lifecycle
The `sw-block ops chunk` commands drive the workspace lifecycle against a
running blockmaster and blockvolume (`--durable-impl=walstore-chunk`,
`--chunk-filer <filer>`):
| Command | What it does |
|---|---|
| `sw-block ops chunk cut` | Publish the changed chunks and advance HEAD |
| `sw-block ops chunk snapshot` / `snapshots` | Name a snapshot / list snapshots |
| `sw-block ops chunk fork` | Create a new volume from a snapshot (root copy only) |
| `sw-block ops chunk detach` | Final cut and release, ready to resume elsewhere |
| `sw-block ops chunk volume-delete` | Delete a volume; refused while it is attached or has snapshots |
| `sw-block ops chunk gc` | Preview or apply two-phase GC of unreferenced chunks |
The chunk path (`walstore-chunk`) is a proof of concept. It is not yet a
default, a release claim or a production path.
### Correctness work
- **Formal models.** The chunk lifecycle, host takeover, and WAL crash
recovery protocols are model-checked with TLA+ and TLC. Counterexamples found
this way became fixes and regression tests, for example the persisted-tail
WAL reuse fix and last-writer-wins recovery replay.
- **Fail closed.** Recovery reports typed reasons such as `wal_corrupt` and
`io_error` instead of serving uncertain data.
### Not claimed yet
- Production readiness, SLOs, or a published performance claim.
- `fsync` parity with local disk. That is work in progress, as described above.
- 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.
- Multi-replica workspaces combined with chunk snapshots.
## Kubernetes block storage (alpha)
The Kubernetes path is focused on one user-visible loop:
```text
install on Kubernetes
@@ -24,7 +159,11 @@ install on Kubernetes
This is an **alpha** product path for supported lab clusters, not production.
## Feature & Status
<p align="center">
<img src="docs/assets/seaweed-block-hero.svg" alt="Seaweed Block alpha architecture: Kubernetes PVC to CSI, blockmaster, blockvolume, iSCSI, and WAL-backed recovery" width="100%">
</p>
### Kubernetes feature & status
| Feature | Status | Feature | Status |
|---|---|---|---|
@@ -41,7 +180,7 @@ This is an **alpha** product path for supported lab clusters, not production.
| Backup/snapshot/restore | Planned | NVMe/RDMA failover or performance SLO | Not claimed |
| Production SLO/performance claims | Not claimed | Hosted production UI | Not claimed |
## What You Can Do Today
### What You Can Do Today
- Install Seaweed Block through Helm on a supported Kubernetes/k3s lab.
- Create and mount PVC-backed block volumes through normal Kubernetes PVCs.
@@ -99,7 +238,7 @@ This is an **alpha** product path for supported lab clusters, not production.
These are narrow alpha claims tied to documented gates. See
[release notes](docs/releases/README.md) for exact run evidence.
## What You Should Not Expect Yet
### What You Should Not Expect Yet
- Production readiness or production SLOs.
- A production-grade operator or broad mutating admin workflow. The current
@@ -123,7 +262,7 @@ These are narrow alpha claims tied to documented gates. See
- Upgrade or rollback execution. The status layer can report install drift, but
it does not run Helm or kubectl mutations.
## Five-Minute Quick Start
### Five-Minute Quick Start
From the repository root:
@@ -176,7 +315,7 @@ and `seaweed-block-csi` images are published and pass the NVMe release smoke.
Mutable `:alpha` is a smoke/demo tag only; it can drift from the source tree.
## Operations
### Operations
Port-forward blockmaster when reading live cluster state:
@@ -215,7 +354,7 @@ The status surface is negative-first. If evidence is missing or stale, the
system reports `Ready=Unknown` / `EvidenceStale=True` rather than claiming a
false ready state.
## Cleanup
### Cleanup
```bash
helm uninstall sw-block --namespace kube-system
@@ -0,0 +1,90 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="560" viewBox="0 0 1200 560" font-family="Inter, Segoe UI, Helvetica, Arial, sans-serif">
<title>Seaweed Block agent workspace disks: local-speed disk per microVM, incremental snapshots to SeaweedFS, fork and move to any host</title>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
<path d="M0,0 L10,5 L0,10 z" fill="#475569"/>
</marker>
<marker id="arrowG" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
<path d="M0,0 L10,5 L0,10 z" fill="#0f766e"/>
</marker>
</defs>
<rect width="1200" height="560" rx="18" fill="#f8fafc"/>
<text x="40" y="52" font-size="26" font-weight="700" fill="#0f172a">Seaweed Block · agent workspace disks</text>
<text x="40" y="80" font-size="15" fill="#475569">Local-speed disk per agent VM · incremental snapshots to SeaweedFS · fork and resume on any host</text>
<!-- Host A -->
<rect x="40" y="110" width="420" height="300" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
<text x="60" y="138" font-size="15" font-weight="700" fill="#0f172a">Host A</text>
<rect x="60" y="154" width="170" height="70" rx="10" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
<text x="145" y="184" font-size="14" font-weight="600" fill="#312e81" text-anchor="middle">agent microVM</text>
<text x="145" y="204" font-size="12" fill="#4338ca" text-anchor="middle">/dev/vda · ext4</text>
<rect x="270" y="154" width="170" height="70" rx="10" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5"/>
<text x="355" y="184" font-size="14" font-weight="600" fill="#312e81" text-anchor="middle">agent microVM</text>
<text x="355" y="204" font-size="12" fill="#4338ca" text-anchor="middle">/dev/vda · ext4</text>
<line x1="145" y1="226" x2="145" y2="262" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
<line x1="355" y1="226" x2="355" y2="262" stroke="#475569" stroke-width="1.6" marker-end="url(#arrow)"/>
<text x="250" y="250" font-size="11.5" fill="#64748b" text-anchor="middle">virtio-blk (ublk / NVMe-TCP loopback)</text>
<rect x="60" y="266" width="380" height="122" rx="10" fill="#f1f5f9" stroke="#94a3b8" stroke-width="1.5"/>
<text x="80" y="292" font-size="14" font-weight="700" fill="#0f172a">blockvolume (one per workspace)</text>
<text x="80" y="316" font-size="12.5" fill="#334155">• fsync completes on the local WAL</text>
<text x="80" y="338" font-size="12.5" fill="#334155">• dirty-chunk tracking since the last cut</text>
<text x="80" y="360" font-size="12.5" fill="#334155">• single local replica; durability from snapshots</text>
<text x="80" y="380" font-size="12.5" fill="#334155">• epoch-fenced HEAD ownership</text>
<!-- SeaweedFS -->
<rect x="560" y="160" width="300" height="250" rx="14" fill="#ecfdf5" stroke="#10b981" stroke-width="1.5"/>
<text x="580" y="188" font-size="15" font-weight="700" fill="#065f46">SeaweedFS</text>
<rect x="580" y="204" width="260" height="56" rx="8" fill="#ffffff" stroke="#34d399"/>
<text x="710" y="228" font-size="13" font-weight="600" fill="#065f46" text-anchor="middle">HEAD root (~2 KB)</text>
<text x="710" y="247" font-size="11.5" fill="#047857" text-anchor="middle">conditional update on {gen, epoch}</text>
<rect x="580" y="272" width="260" height="56" rx="8" fill="#ffffff" stroke="#34d399"/>
<text x="710" y="296" font-size="13" font-weight="600" fill="#065f46" text-anchor="middle">snapshots · forks</text>
<text x="710" y="315" font-size="11.5" fill="#047857" text-anchor="middle">copy the root only · chunks shared</text>
<g>
<rect x="584" y="342" width="36" height="24" rx="4" fill="#a7f3d0"/>
<rect x="626" y="342" width="36" height="24" rx="4" fill="#a7f3d0"/>
<rect x="668" y="342" width="36" height="24" rx="4" fill="#a7f3d0"/>
<rect x="710" y="342" width="36" height="24" rx="4" fill="#6ee7b7"/>
<rect x="752" y="342" width="36" height="24" rx="4" fill="#a7f3d0"/>
<rect x="794" y="342" width="36" height="24" rx="4" fill="#6ee7b7"/>
</g>
<text x="710" y="392" font-size="11.5" fill="#047857" text-anchor="middle">immutable 4 MiB chunks · two-phase graced GC</text>
<line x1="442" y1="300" x2="556" y2="270" stroke="#0f766e" stroke-width="2" marker-end="url(#arrowG)"/>
<text x="500" y="262" font-size="12" font-weight="600" fill="#0f766e" text-anchor="middle">cut</text>
<text x="500" y="314" font-size="11" fill="#0f766e" text-anchor="middle">changed chunks only</text>
<!-- Host B -->
<rect x="940" y="110" width="220" height="300" rx="14" fill="#ffffff" stroke="#cbd5e1" stroke-width="1.5"/>
<text x="960" y="138" font-size="15" font-weight="700" fill="#0f172a">Any other host</text>
<rect x="960" y="154" width="180" height="70" rx="10" fill="#eef2ff" stroke="#6366f1" stroke-width="1.5" stroke-dasharray="5 4"/>
<text x="1050" y="184" font-size="14" font-weight="600" fill="#312e81" text-anchor="middle">resumed / forked VM</text>
<text x="1050" y="204" font-size="12" fill="#4338ca" text-anchor="middle">boots from HEAD</text>
<rect x="960" y="266" width="180" height="122" rx="10" fill="#f1f5f9" stroke="#94a3b8" stroke-width="1.5" stroke-dasharray="5 4"/>
<text x="980" y="292" font-size="13" font-weight="700" fill="#0f172a">take over</text>
<text x="980" y="314" font-size="12" fill="#334155">• epoch + 1</text>
<text x="980" y="334" font-size="12" fill="#334155">• fetch chunks lazily</text>
<text x="980" y="354" font-size="12" fill="#334155">• old holder fenced:</text>
<text x="992" y="372" font-size="12" fill="#334155">cannot publish</text>
<line x1="862" y1="280" x2="956" y2="300" stroke="#0f766e" stroke-width="2" marker-end="url(#arrowG)"/>
<text x="908" y="272" font-size="12" font-weight="600" fill="#0f766e" text-anchor="middle">resume</text>
<!-- Footer metrics -->
<rect x="40" y="440" width="1120" height="92" rx="14" fill="#0f172a"/>
<text x="70" y="474" font-size="14" font-weight="700" fill="#e2e8f0">Measured on lab hosts: workloads in Firecracker microVMs; snapshot/fork in a host-side proxy (not an SLO)</text>
<text x="70" y="502" font-size="13" fill="#cbd5e1">npm ci · git clone · untar · find+stat: same as a local disk</text>
<text x="560" y="502" font-size="13" fill="#cbd5e1">snapshot 0.18 ms · fork 0.29 ms (10 GiB volume) · two-host lifecycle 35/35</text>
<text x="70" y="522" font-size="12" fill="#94a3b8">fsync: ~7 ms vs ~3 ms local today; ublk frontend and per-stage breakdown in progress</text>
</svg>

After

Width:  |  Height:  |  Size: 6.5 KiB