Skip to content

P8:监控、限流、缓存、压测、Docker 部署与 CI;新增 README - #2

Merged
usercjr merged 4 commits into
mainfrom
feat/p8-ops
Oct 28, 2026
Merged

usercjr merged 4 commits into
mainfrom
feat/p8-ops

Conversation

@usercjr

@usercjr usercjr commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

P8 性能与运维,外加项目 README。

内容

  • 监控:路由级请求数、4xx/5xx、P50/P95/P99,错误码,LLM 调用 / token / 并发排队,缓存命中,熔断状态;/api/metrics(JSON 或 Prometheus 格式)与监控页 admin.html,需要 ADMIN_TOKEN 访问
  • 限流与过载保护:网关按 IP 令牌桶限流(429 + Retry-After);规划 / 聊天全局并发上限 8(503 SERVER_BUSY)
  • 缓存:检索结果缓存(线程安全的 LRU + TTL,重新入库时清空)
  • 压测:eval/load_test.py 使用模拟 LLM,报告见 eval/load_test.md
  • Docker:网关与 agent_service 镜像,Compose 编排三个服务并按健康检查控制启动顺序;agent 不对外暴露端口
  • CI:GitHub Actions 运行 Python / 网关测试,并检查两个镜像能否构建
  • 地图页高德 JS Key 改由 /api/config 下发,不再写死在页面里

修复(压测与容器实测中发现)

  • 熔断器拒绝被当成可重试错误、又退避重试了两次:熔断打开后的失败耗时 11.8s → 3375ms
  • Neo4j 服务端事务超时被当成内部错误:现在按“暂时不可用”降级,并计入熔断
  • requirements.txt 漏了 neo4j:所有依赖已固定版本

验证

  • pytest 68 个通过,网关 node:test 5 个通过
  • docker compose up 端到端:就绪检查全部通过,宿主机访问不到 agent 端口,监控接口不带 token 返回 403,真实图谱问题回答正常

🤖 Generated with Claude Code

Reyn and others added 2 commits October 13, 2026 19:39
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rieval cache, load test, Docker Compose, CI

- metrics: per-route counts and P50/P95/P99, error codes, LLM calls/tokens/queue,
  tool calls, cache hit rates, breaker states; JSON and Prometheus formats
- gateway: per-IP token-bucket rate limiting (429 + Retry-After) and a global
  in-flight cap for plan/chat (503 SERVER_BUSY); aggregated /api/metrics and
  admin.html behind ADMIN_TOKEN (loopback-only when unset)
- retrieval result cache (thread-safe LRU+TTL, cleared on re-ingest)
- load test with a mock LLM: capacity, overload, rate limit, circuit breaker
- fix: open-circuit rejections were retried with backoff (1-1.8s -> 33-75ms)
- fix: Neo4j server-side transaction timeouts now degrade instead of INTERNAL
- Docker images for gateway and agent_service, compose with health-gated
  startup; agent not published; GitHub Actions for tests and image builds
- map page loads the Amap JS key from /api/config instead of hardcoding it
- pinned requirements; neo4j was missing; training deps split out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@usercjr usercjr changed the title docs: 新增项目 README P8:监控、限流、缓存、压测、Docker 部署与 CI;新增 README Oct 28, 2026
Reyn and others added 2 commits October 28, 2026 23:39
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@usercjr
usercjr merged commit 89ce21a into main Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant