Real-Redis integration gate: 200 concurrent Checks against RPM 100 admit exactly 100 / reject exactly 100 at every hierarchical tier, plus BenchmarkStageRateLimit regression pin and Phase 2 proxy p99 < 20ms.
Milestone 4.B.3 — Rate Limit Load & Correctness Benchmark
Status: Completed
Goal: Track B — Rate Limiting & Quota Enforcement
Phase: 4 — Operator Platform & Multi-Provider
Estimated effort: 1 day
Track: Track B — Rate Limiting & Quota Enforcement
Why This Milestone Exists
A permanent regression gate proves the Lua hierarchical limiter is atomic under concurrency — the property the Phase 1 soft slider could not guarantee. The proof is binary: 200 concurrent Checks against RPM 100 must admit exactly 100 and reject exactly 100 (maxAdmitOvershoot=0) at every binding tier.
Non-Goals
- New PR-gating k6 scenario or
<5msstage SLA - testcontainers-go / Makefile target /
ci.ymlRedis for the coverage job - Token-spend / month_tokens (#806)
- Redis Cluster hash tags (#803)
Shipped surface
Real-Redis correctness
packages/ratelimit/hierarchical_integration_test.go (//go:build integration):
- Per-tier exact admit (agent / org / global): binding tier RPM=100, others high; 200 concurrent
Checks; exactly 100 allowed / 100 denied;DeniedTiermatches. - Same-agent different-orgs independence under real Redis.
- One case seeds the binding limit via
ApplyOrgOverrides(DB-override path from 4.B.2). - Joins existing
make test-integration→go test -tags=integration ./...with defaultREDIS_URL=redis://127.0.0.1:6380/14(compose-test host mapping). - CI permanent gate: job
ratelimit-hierarchical-integration(wired intoci-gate-go) runsinfra/scripts/ratelimit-hierarchical-integration-ci.sh, which Ping-fails closed and rejects anyt.Skip.
Latency baseline + gate
BenchmarkStageRateLimit(miniredis +NewHierarchicalLimiter, huge RPM) unchanged harness.baseline.jsonfieldsynthetic_rate_limit_us+regression_gate.py%Δ ≤ max_regression_pct(20%).- Full proxy path remains
policy.max_proxy_overhead_p99_ms: 20.
Fail-open
Unchanged: TestSecurity_SEC4_6_RedisFailOpen builds hierarchical via mustProxyLimiter, closes miniredis, middleware still admits (fail-open). Package unit TestHierarchical_Check_redisError covers the error return.
Success signals
- Real-Redis 200/100 zero over-admission at agent, org, and global tiers (+ ApplyOrgOverrides path)
- Same-agent different-orgs independent under real Redis
-
BenchmarkStageRateLimitpinned assynthetic_rate_limit_uswith 20% regression gate - Phase 2 proxy p99 < 20ms policy unchanged (no sketch
<5msk6) - Fail-open covered by SEC-4.6 (no new case)
- Permanent gate via CI job
ratelimit-hierarchical-integration(fail-on-skip) + localcompose-test-up/make test-integration(REDIS_URLdefaults to6380/14)
Local verification
make compose-test-up— Redis on host 6380 (prints the defaultREDIS_URL).make test-integration— exportsREDIS_URL=redis://127.0.0.1:6380/14when unset; hierarchical 200/100 tests run (not skip).- Or CI-equivalent:
REDIS_URL=redis://127.0.0.1:6380/14 bash infra/scripts/ratelimit-hierarchical-integration-ci.sh
Prerequisites
- M4.B.1 Lua limiter merged
- M4.B.2 config /
ApplyOrgOverridesmerged
Last updated on