Skip to content

[P3][performance][debt] Agent 日志内存预算应配置化并清理已删除节点 #324

Description

@XiNian-dada

现状

AgentLogStore 已有全局保护,但仍存在低内存部署和生命周期清理问题:

  • nodelite-server/src/agent_logs.rs:9-13:最多 10,000 条、估算 8MiB。
  • forget_missing() 已实现,但标记为 dead code。
  • Registry reload 会清理 History 节流状态,但没有同步清理已删除节点的日志 buffer。

因此日志活跃实例最多会额外常驻约 8MiB;节点从 registry 删除后,其日志可能继续保留到全局预算驱逐。

建议

  • 将日志总条数和估算字节预算配置化,低内存默认可选 2-4MiB。
  • Registry reload/删除节点时调用 agent_logs.forget_missing()
  • Prometheus 导出当前 entries、estimated bytes、evictions 和预算。

验收

  • 日志预算可配置且有合理上下限。
  • 删除节点或 registry reload 后对应日志被清理。
  • 默认和低内存配置均有测试。
  • 日志满载 RSS 不超过配置预算加合理结构开销。
  • 丢弃/驱逐行为在日志和 metrics 中可见。

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Nice to have / cleanupcan-wait应该修,但可以排期处理debt工程债务与结构整理performanceThroughput / latency / footprint

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions