
一台服务器上运行 60 个容器
一个裸金属服务器运行数十到数百个 Hoody 容器。KSM 和 BTRFS 去重使边际成本接近零。
你在跑一次八小时的迁移。五个人想知道状态,但又不想占用接收槽或打断数据流。在 pipe URL 后追加 ?progress。任何打开它的人都能看到一个实时 HTML 仪表盘——已传输字节、当前速度、ETA、状态切换。无论多少双眼睛在看,迁移都以全速运行。
?progress 是对 pipe 路径的另一次独立读取,它监听传输状态而不占用接收槽。迁移察觉不到它。浏览器看到的是 HTML 仪表盘;curl 看到的是干净的 SSE 流。
She pastes the pipe URL with ?progress into her phone browser. The HTML dashboard appears instantly — state: waiting, 0% — no install, no login, no receiver slot consumed.
SSE pushes a state: streaming event. The progress bar snaps to 22%, bytes tick up, MB/s settles at 118. The dashboard updates itself every 250 ms without a single page reload.
She closes the tab. Her spectator connection drops. The migration doesn't notice — it was never in the data path. The sender and its one real receiver carry on.
She reopens the URL at sunrise. The dashboard shows a done event: 7.6 GB transferred, 8h 2m, no errors. Server-side state survives the refresh — latecomers always see the final line.
She forwards the URL to the team Slack. Three engineers open it and see the same done state. No status thread to close, no Grafana panel to un-star. One URL, five witnesses, zero interruptions.
# 1. Sender — eight-hour migration. Same as always.
tar czf - /var/lib/postgres | curl -T - "$PIPE/api/v1/pipe/migration"
# 2. Receiver — the only client that matters for backpressure.
curl "$PIPE/api/v1/pipe/migration" | tar xzf - -C /restore
# 3. Boss opens the URL on her phone. HTML dashboard. No setup.
# => https://pipe.hoody.com/api/v1/pipe/migration?progress
# 4. You want SSE for a Slack bot? Same URL, different Accept.
curl -N -H "Accept: text/event-stream" \
"$PIPE/api/v1/pipe/migration?progress" \
| grep -E '^event: (progress|state|done)'
# event: state \n data: ["state":"streaming","receivers":1]
# event: progress \n data: ["bytes":5046464512,"mbps":118,"etaSec":840]
# event: done \n data: ["bytes":8160000000,"durationSec":28800]三种 SSE 事件类型。state 用于状态切换(idle → waiting → streaming → complete),progress 在字节流动时每 250ms 推送一次(bytesTransferred、speed、ETA),done 在结束时推送一次最终统计。每条路径最多五十名旁观者,连接 TTL 三十分钟,传输后保留三十秒以便后到的人看到成功的那一行。
同一个 ?progress 端点服务于浏览器标签页、curl 管道和后台轮询的状态页。它们都不会拖慢传输。
Bookmarks the URL on her phone. Checks twice a day.
HTML dashboard, no loginCurl SSE into a Slack webhook. One-liner status bot.
text/event-stream, same URLEmbedded in a public status page. Polls every 30 s.
0 receiver slots, full live stateWired to PagerDuty via the done event. Pings when finished.
event: done, one-shot trigger围观迁移本身就是一个 URL。迁移察觉不到。
每个团队都有一种回答“进度到哪了?”的方式。这些方式里,大部分都需要运行一个服务、接一个仪表盘、或照看一个聊天频道。在 pipe URL 上加一个查询参数则不需要其中任何一项。
发出 URL。停止发送状态更新。