Files
Agent-System-Dev/tests/load/collaboration/README.md
T
weichen f705f99b8f Add U7 two-process acceptance, k6 load harness and release checklist
Why: collaboration storage U7 (proposal sections 3/5/7) requires two-process
HTTP-level acceptance over shared PG, a reproducible load-test entry honoring
the load contract, and an auditable pre-release checklist; capacity windows and
dual-host runs need user-scheduled resources, so the deliverable here is the
verifiable entry, not capacity claims.
Evidence: make test green (composite); make test-multi-instance green locally
against an isolated PG (five scenarios incl. crash-takeover and restart
invariants); run_load.sh --profile smoke end-to-end green (SSE probe p95~18ms,
zero seq duplicates, stack auto-recycled); backend pinned to feature branch
with the three cross-instance fixes.
Impact: new tests/integration/multi-instance (CI test-pg job step), new
tests/load/collaboration (k6 + SSE probe + run_load.sh), release checklist at
docs/release-multi-instance.md; no runtime behavior change in Dev repo itself.
Refs: backend PR #164; task card feature/u7-load-fault-release.
2026-10-12 02:31:35 +00:00

51 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 协作存储压测套件(U7)
方案 §3 负载合同 / §5 U7 的业务压测入口。**只打隔离栈**(自建 PG 实例 +
mock 模式 backend),绝不打生产服务;模拟模型(mock)用于容量基线,真实
模型的全链路验证按方案另行小流量执行。
## 组成
| 文件 | 职责 |
|---|---|
| `run_load.sh` | 编排入口:起隔离栈 → 引导账号 → k6 阶梯 → SSE 探针 → 不变量对账 → 回收 |
| `k6/collab_api.js` | 非模型普通 API 的混合读写负载(登录/项目/会话/卡片/设置/消息,requestId 幂等重放抽样;预期 409/429 单列计数) |
| `sse_probe/` | SSE 持久事件可见延迟探针(Go):k6 核心不支持 SSE 流式读取,P95≤1s 指标由此承担,含 seq 单调性断言 |
| `results/<ts>/` | 每次运行的原始输出:`k6-summary.json`、`k6-output.txt`、`sse-probe.json`、`invariants.txt`、`app.log` |
## 快速开始
```bash
# 冒烟(~2 分钟,无需 k6——缺失时自动跳过 k6 段并给出安装指引)
tests/load/collaboration/run_load.sh --profile smoke
# 阶梯(10→30→100 VU,~12 分钟;k6: brew install k6)
tests/load/collaboration/run_load.sh --profile ladder --users 30
# 长稳(60 分钟 / 2 小时混合,负载合同的两个正式窗口)
tests/load/collaboration/run_load.sh --profile sustained60m
tests/load/collaboration/run_load.sh --profile sustained2h
# 复用已有隔离 PG;保留栈便于复查
tests/load/collaboration/run_load.sh --dsn 'postgresql://…/agent' --keep
```
## 阈值与口径(负载合同,待实测校准)
- 非模型普通 API:读路径 P95≤300ms、P99≤1s(k6 threshold 按 `read` 组单列)。
- 非预期失败率≤0.1%(`http_req_failed<0.001`);预期拥塞(会话忙 409 /
队列满 429)记入 `expected_contention` 计数器,**不**计入失败。
- SSE 持久事件可见延迟 P95≤1s + seq 零乱序(探针退出码即断言)。
- 数据不变量零违反:events 每会话 seq 无重复(SQL 对账,违反即 exit 1);
各表计数与孤儿 run 报告落 `invariants.txt`。
## 边界(诚实声明)
- 首期为**单实例**压测(mock 模式、执行原语关闭);分布式限流窗口与双实例
放行指标在双栈就位后扩展(`--dsn` 复用 + 第二实例待加)。
- 容量数字(连接等待、CPU/内存/IO、pgbench 数据库基线)须绑定组件 SHA、
配置与数据集记录在结果目录;`pgbench` 只测数据库能力,不替代本套业务
验收(方案 §5 U7)。
- 正式 60min/2h 窗口的执行与双主机验证需要用户指定资源与时间;本仓提供
的是可复核入口,不预填容量结论。