我们为何弃用 Cloudflare Durable Objects
Why we're moving off Cloudflare Durable Objects

原始链接: https://usewire.io/engineering/why-were-moving-wire-off-cloudflare-durable-objects/

Wire 是一个用于 AI 智能体“上下文容器”的平台,该平台近期重构了其底层运行时,以克服 Cloudflare Durable Objects 的结构性限制。尽管 Wire 在 API 和控制平面上仍与 Cloudflare 保持深度集成,但其数据平面已迁移至基于 Fly Machines 构建的自定义基础设施。 此次迁移解决了四个关键瓶颈: 1. **性能:** 将向量索引移至容器内部(使用 `sqlite-vec`),消除了高昂的网络跳转和状态同步问题。 2. **计算邻近性:** 将完整的检索流水线(包括融合和重排序)置于进程内处理,降低了延迟和波动。 3. **动态部署:** 新架构允许容器迁移至更靠近活跃智能体的位置,并为高阶客户提供专用隔离。 4. **自托管:** 脱离专有平台,使受监管的客户能够托管自己的基础设施。 迁移成果显著:工具调用的延迟趋于稳定,冷启动速度提升了超过 60%。为确保数据完整性,Wire 实现了持续的 WAL(预写日志)传输至对象存储。目前新运行时处于测试阶段,计划在迁移完成后将技术栈开源,以确保公司内部生产代码透明且可验证。

Hacker News 上的讨论聚焦于一篇解释 Wire 公司为何弃用 Cloudflare Durable Objects 的文章。 该讨论串呈现出褒贬不一的社区反应。一位用户虽然对 Wire 在处理大型文档嵌入和沙盒代理方面的潜力感到好奇,但也指出该产品仍处于初期且小众的阶段。 另一条更为严厉的评论强调了一个重大的架构转变:Wire 正在转向一种由每个组织依赖运行在 Fly Machines 上的单一“宿主进程”(Bun)的模式。评论者对这一选择表示怀疑,并引用了 Fly.io 在运行时间和可用性方面的历史问题。普遍共识是,相较于所提议的替代方案,社区更倾向于 Cloudflare Durable Objects,因为后者具有更优越的全局一致性和可靠性。
相关文章

原文

Wire is context containers for AI agents: isolated stores of processed knowledge (entries, embeddings, knowledge and provenance graphs) queried over MCP. Since day one, every container has been a Cloudflare Durable Object.

That is changing. We rebuilt the container runtime from the ground up, benchmarked it against the old one on identical data (same container, same questions, same judge), and the first workspaces have moved to a data plane we built ourselves. This is the story behind the benchmark.

This is not a “we left Cloudflare” post. I love Cloudflare and Wire stays on it everywhere it can: the API, the frontends, the control plane, and processing all still run on Workers. Durable Objects are close to a perfect fit for thousands of small, mostly idle stateful units, and I have not seen anything faster to build on. We left because of four structural limits, not reliability.

1. The vector index lived outside the object

Retrieval is the most important thing a container does, and the embeddings lived in Vectorize, a separate service. That is a network hop on the hottest path and a second copy of state that can drift. DO SQLite cannot load extensions, so the index could never come inside.

2. We wanted the compute next to the data

Retrieval is a multi-stage pipeline: hybrid candidate generation, fusion, query expansion, and a wide rerank. On Durable Objects only a thin slice of that could run where the data lives; the rest was exported to services around the object. Agents call containers inside tool loops, and every hop’s variance lands on the critical path.

3. Placement is creation-time only, and compute is always shared

Location hints exist at creation, but an object never moves afterward, so a container created from London serves an agent fleet in Virginia forever. And you cannot buy dedicated capacity for one tenant. We wanted placement that follows the callers, and isolation as a product tier: paid workspaces get their own process and machines.

4. You can’t self-host a Durable Object

Regulated teams keep asking to run containers on infrastructure they control. A runtime that only exists on Cloudflare can’t.

What we built

Each organization gets one host process (Bun) on Fly Machines for all its containers. A container is one SQLite file with the vector index embedded via sqlite-vec, so candidate retrieval runs in-process; the model calls, query embedding and the rerank, still go out to inference. Snapshots go to object storage, so a container rebuilds byte for byte anywhere. A per-region router places containers near the caller, and the control plane talks to the data plane via signed requests and never touches container content.

Warm tool calls hold roughly 0.3 seconds, steady, versus roughly 0.4 seconds with spikes past 2 seconds before. An idle container wakes in 1.4 seconds end to end versus 3.7. To be precise about that last number: it was never “Durable Object cold start,” isolates wake in milliseconds. The 3.7 seconds was our own stack reassembling itself.

Nothing changed at the surface. Same container URLs, same five MCP tools, same REST API, same response shapes. Agents keep calling the same address; requests to a migrated container are just answered by the new runtime.

Buying durability back

Durable Objects hand you durability and single-writer consistency for free, and leaving means buying them back. Cloudflare replicates every DO storage write before acking it. Our first cut was only “durable at next checkpoint,” and soak tests that kill machines under load showed exactly what that means: a handful of acked writes, gone. The real fix is continuous WAL shipping. A write does not ack until its WAL frame is in object storage; group commit keeps that to about 100 ms, and a dead machine cannot take acked writes with it.

If you do not need the four things above, stay on the platform.

The honest read on the numbers

The retrieval gains (recall@5 from 78.1% to 89.1%) are not all architecture; we also moved to a newer embedding model. What the architecture does is make the expensive parts cheap: in-process retrieval lets you over-fetch and rerank wide, and per-container indexes are small enough for exact nearest-neighbor search. The full before/after tables and methodology are in the benchmark write-up.

Where it stands

The new runtime is in beta: our preview environment plus opt-in production workspaces today, with full production migration following as our durability tripwires stay green. Once the cutover is done, we plan to open-source the container runtime. We should ship the code we actually run.

联系我们 contact @ memedata.com