Resonate — 分布式 Async Await / Durable Execution
来源: https://github.com/resonatehq/resonate | ⭐623 | Rust
核心思想: 将”分布式 Async Await”作为核心抽象——一个函数可以运行几分钟、几小时、几天,即使进程重启也能继续执行。SDK (TypeScript/Python/Go) + Server(单二进制),Server 作为 supervisor 和 orchestrator。
为什么重要:
- Durable Execution 是一种新颖的架构模式(Temporal/Durable 同类)
- 与传统的 message queue + retry 不同,Resonate 持久化函数执行状态
- 函数内部可以
yield* context.run()和yield* context.sleep()——这些调用被 journaled,重启后自动重放 - 架构简洁:一个 server 二进制 + SDK,SQLite 后端(也可 PostgreSQL)
技术要点:
- Generator 函数模型:
function*() { yield* context.run(...); yield* context.sleep(...); } - 执行状态持久化:SQLite,重启后恢复
- HTTP Push Auth:支持 GCP ID token / bearer token
- Metrics:prometheus 端口 9090
→ 对我有什么用:
- 对 Hermes cron-scheduler 的启发:可以将长时间运行的任务包装为 durable execution
- 对 minions/manas 架构的影响:NATS 消息传递 + Resonate 持久化执行 = 可靠的 agent 工作流