Expanded Diagram + Splitter Example
%%{init: {'securityLevel':'loose', 'flowchart': {'htmlLabels': true}}}%%
flowchart LR
%% IDs with labels in brackets for v11 safety
subgraph ingress["Ingress"]
A["Field Job Emitter
(Producer)"] --> B["Job Normalizer
(calc request tokens, route by model)"]
B --> Bm["Model Stats Lookup
(resp_tokens_est, cap)"]
end
subgraph qf["Queueing & Fairness (BEAM cluster)"]
B --> C["Per-Client Queues
(FIFO per client × model; stream keys)"]
C --> D["Fair Scheduler
(DRR core)"]
subgraph drra["DRR Mechanics"]
D --> Qsplit["Quantum Splitter
(burst/strict; Q)"]
Qsplit --> Deficit["Client Deficit
(tokens)"]
Qsplit --> Reserve["Head Reserve
(ρ·Q while sealed)"]
Deficit --> Sel["Eligibility Check
(fits deficit & buckets)"]
Reserve --> Sel
Sel -->|eligible| D
end
subgraph ratelimit["Rate Limiting & Token Accounting"]
D --> E["Provider-Model Gate
(HTB + SWR windows)"]
E --> SWR["SWR 60s
(per-second bins)"]
E --> HTB1["Hour TB"]
E --> HTB2["Day TB"]
E --> F["Token Ledger
(append-only events)"]
end
end
subgraph egress["Egress"]
E --> G["Executor Hand-off
(HTTP/gRPC to Tool Runner)"]
G --> H["Completion Hook
(actual response tokens)"]
H --> F
H --> C
H --> Bm
end
%% (Note) Mermaid v11 does not support applying classes to subgraphs. Removed
%% classDef/class rules that targeted subgraph IDs to avoid "Syntax error in text".
Notes: Quantum Splitter divides Q into spendable deficit and head reserve when a head is sealed; eligibility requires both client budget and bucket headroom. Completion updates the ledger, unseals streams, and feeds estimator stats.
Skip-with-Seal Timeline (Sequence)
sequenceDiagram
autonumber
participant C as Client Queue
participant S as DRR Scheduler
participant R as Reserve and Deficit
participant G as Provider Gate HTB and SWR
C->>S: Head H 8k and Tail T 2k
S->>R: Add Q and split into Q head and Q free portions
S->>G: Can H run with buckets and budget
G-->>S: No (too big)
S->>C: Seal H and mark head needed as 8k
S->>R: Accrue head reserve plus Q head and deficit free plus Q free
S->>G: Can T run from deficit free
G-->>S: Yes
S->>C: Dispatch T consume deficit free
loop Next rounds
S->>R: Accrue Q head to head reserve and Q free to deficit free
alt head reserve exceeds head needed and buckets OK
S->>C: Dispatch H consume head reserve
C-->>S: H done (unseal stream)
else continue accumulating
end
end
This sequence shows why the head cannot starve: a dedicated head_reserve accrues every round and is not spendable by tails; once sufficient and buckets permit, the head must run.