Evidence
The online DAG serializes tenant QPS -> AK QPS -> product QPM -> model QPM -> AK TPM:
Realtime repeats the same checks sequentially for every generation. With Redis governance, each enabled check executes a separate command or script via governance.rs.
This is a static finding, not a production measurement. Five enabled checks cost roughly five serial Redis RTTs before the upstream call. Collapsing them to one would save approximately (N-1) * RTT: about 4 ms at 1 ms Redis RTT, or 12 ms at 3 ms.
Proposed scope
Add a structured Governance::admit(...) operation implemented by Redis as one Lua script. It should evaluate the enabled tenant, AK, product, model, quota, and TPM constraints and return a typed, deterministic denial reason.
Use the same operation from the REST DAG and realtime gate. Preserve the current fail-open policy for Redis outages and explicitly define whether denied requests consume earlier rate-window counters. Keep model-fallback resolution and cache lookup outside the aggregate where ordering requires it.
Document or guard Redis Cluster behavior: the script touches multiple logical keys and may require a deliberate hash-slot strategy.
Do not merely run the current checks concurrently; that would change denial precedence and counter-consumption semantics.
Acceptance criteria
- REST and realtime use the same aggregate admission implementation.
- Redis command tracing shows one admission round trip per admitted generation, excluding authentication/cache and settlement.
- Each limit returns the same user-visible denial precedence as today.
- A denial or Redis/script error leaves no leaked daily or TPM reservation.
- Memory and Redis governance pass a shared behavioral test suite.
- Benchmark all limits enabled with Redis at 0.2/1/3 ms injected RTT and report TTFT plus p50/p95/p99.
Evidence
The online DAG serializes tenant QPS -> AK QPS -> product QPM -> model QPM -> AK TPM:
nodes.rsdefault_layersRealtime repeats the same checks sequentially for every generation. With Redis governance, each enabled check executes a separate command or script via
governance.rs.This is a static finding, not a production measurement. Five enabled checks cost roughly five serial Redis RTTs before the upstream call. Collapsing them to one would save approximately
(N-1) * RTT: about 4 ms at 1 ms Redis RTT, or 12 ms at 3 ms.Proposed scope
Add a structured
Governance::admit(...)operation implemented by Redis as one Lua script. It should evaluate the enabled tenant, AK, product, model, quota, and TPM constraints and return a typed, deterministic denial reason.Use the same operation from the REST DAG and realtime gate. Preserve the current fail-open policy for Redis outages and explicitly define whether denied requests consume earlier rate-window counters. Keep model-fallback resolution and cache lookup outside the aggregate where ordering requires it.
Document or guard Redis Cluster behavior: the script touches multiple logical keys and may require a deliberate hash-slot strategy.
Do not merely run the current checks concurrently; that would change denial precedence and counter-consumption semantics.
Acceptance criteria