Commit Graph
10 Commits
Author SHA1 Message Date
lukaszraczylo 6d1bc2cd33 perf(shared-state): scope decision breaker to decision providers
The decision breaker covered every provider id but a decider only queries its own router provider.
The breaker now covers the sorted, de-duplicated decision providers.
This cuts the refresh key count and the Redis read per tick.
2026-11-26 07:41:30 +00:00
lukaszraczylo ebe38e7527 fix(shared-state): count discovery failures per instance
With redis.sharedState on, every route instance added each failed
discovery refresh to one fleet count. One failed round across the
fleet could then open the discovery breaker.

Each instance now counts its own consecutive failures. Only the
instance whose own count reaches breaker.failureThreshold shares a
trip, and the fleet breaker opens on the first trip.
2026-11-26 06:21:10 +00:00
lukaszraczylo 0852e59c09 docs(shared-state): say long streams drop out of the in-flight count
The request timeout is progress-based, so a stream that keeps sending
data can outlive the in-flight read window. It then drops out of the
shared count. The count can only be too low for such streams.
2026-11-26 04:15:41 +00:00
lukaszraczylo 8e756c064d docs(shared-state): state what the discovery threshold counts
With sharedState on, breaker.failureThreshold counts failed refreshes
across all route instances and replicas. It no longer counts three in a
row on one instance. The README and the wiring comment now say so.
2026-11-26 04:15:29 +00:00
lukaszraczylo 367f3b60ff perf(shared-state): batch calibrator counters with the usage write
Each served request spawned a second async write for the calibrator
counters. They now ride the batch accountWith already sends, and only
when shared state is on and a store is configured.
2026-11-26 04:12:38 +00:00
lukaszraczylo e70eb32336 feat(router): share the token-size estimate through Redis
With redis.sharedState on, each observed sample also adds to day counters of prompt bytes, prompt tokens and sample count per model. The router-learning loop reads the counters of the routers' target models and keeps one fleet ratio per model. The estimate prefers that ratio once the fleet has the same minimum sample count as the local calibrator. Dropped counter writes only blur the estimate. With the switch off, the calibrator runs its local code only and makes no store call.
2026-11-26 03:32:03 +00:00
lukaszraczylo fe5e9afdc9 feat(router): share the decision breaker through Redis
The decision-model breaker now also reads and writes the fleet breaker when redis.sharedState is on. Routers that use the same decision provider share one key. A client cancel is still not a failure. With the switch off, the decider runs its local code only and makes no store call.
2026-11-26 03:29:55 +00:00
lukaszraczylo 0c2445cb1a feat(registry): share the discovery breaker through Redis
A provider whose discovery fails often enough now reads as unhealthy on every pod when redis.sharedState is on. The shared breaker uses the same threshold and open times as the local one. The discovered model sets stay local. With the switch off, the provider state runs its local code only and makes no store call.
2026-11-26 03:29:09 +00:00
lukaszraczylo a6c2821a29 feat(concurrency): share in-flight counts through Redis
In-flight counts and the learned limit now merge the fleet view when redis.sharedState is on. The load a pod reports to the router and the saturation downgrade is the larger of its own count and the fleet count. A 429 halves the fleet count, not only the local one. With the switch off, the learner runs its local code only and makes no store call.
2026-11-26 03:28:07 +00:00
lukaszraczylo a46058694b feat(failover): share the request breaker through Redis
The request breaker now also reads and writes the fleet breaker when redis.sharedState is on. A pod that sees enough failures opens the breaker for every pod after one refresh. A success on any pod closes it again. With the switch off, the tracker runs its local code only and makes no store call.
2026-11-26 03:26:39 +00:00