10 秒级慢响应排查:把“模型快但端到端慢”拆成可测链路
场景:单独 API 测试很快,但在 OpenClaw 里回复需要 10+ 秒。前置:可查看 gateway 日志与运行版本。步骤:先确认版本与模型一致,再拆分 API 延迟/工具延迟/会话处理延迟,重点比对 durationMs 指标。关键命令:gateway status/restart 与日志采样。验证:定位瓶颈阶段并把端到端延迟降到可接受范围。风险:只测 API 不测全链路会误判。
GITHUBDiscovered 2026-02-15Author cytustse-cmd
Prerequisites
- You can access gateway/runtime logs including `durationMs` style timing entries.
- Model/provider config is known and reproducible across tests.
Steps
- Record a baseline: API-only latency vs OpenClaw end-to-end latency for the same prompt.
- Check runtime version and recent upgrades, then restart gateway to clear stale process state.
- Inspect logs for lane/task timing (`durationMs`) to locate where the extra seconds are consumed.
- Temporarily reduce tool/context load (shorter history, fewer tool calls) and re-test.
- Apply targeted fixes based on bottleneck stage and keep an after-change latency sample.
Commands
openclaw gateway statusopenclaw gateway restartopenclaw helpVerify
End-to-end latency improvement is visible in repeated test prompts and log timing lines.
Caveats
- Provider speed alone is not representative; queueing, tool runs, and context size may dominate.
- Different models may mask pipeline overhead; keep same model during diagnosis(需验证).
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗