Uh oh!
There was an error while loading. Please reload this page.
feat(routing): consistent_hash strategy + priority tiers; fold weighted into round_robin - #997
Conversation
…ed into round_robin Load-balancing taxonomy rework (AISIX-Cloud#1206), aligned with the APISIX balancer model: weight and priority are per-target attributes available under every strategy, and consistent hashing is a strategy of its own rather than a flag on another one. - targets[].priority (i32, default 0, higher preferred, negatives for backups): targets partition into tiers; the strategy orders each tier independently (per-tier balancer state); tiers concatenate, so a lower tier only receives traffic when every higher-tier target failed or was health-filtered. max_fallbacks caps the concatenated walk. - strategy consistent_hash: ketama-style ring (160 points x weight units, FNV-1a + splitmix64 finalizer), keyed by the hash_on source chain (header / cookie / api_key / client_ip; default = x-aisix-routing-key header, then the caller's API key id). A key's ring order doubles as its failover order, so a failed target's keys spread to their ring successors and every other key keeps its mapping. - round_robin is now smooth WEIGHTED round-robin (the nginx algorithm); equal weights keep the old declaration-order cycle exactly. - least_busy now scores (1 + in-flight) / weight. - REMOVED: the weighted strategy (fold into round_robin) and the sticky flag (superseded by consistent_hash). The enum value now fails row-level in the lenient loader; declarative configs must migrate (weighted -> round_robin keeping weights; weighted+sticky -> consistent_hash). The control plane migrates stored rows in the companion PR. Fixesapi7/AISIX-Cloud#1206
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in:5 minutes Limit details: You’ve used all 2 included reviews currently available. Your 58 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. You can run this review on demand instead of waiting. On-demand reviews are free until September 18, 2026. After that, they cost $0.25 per reviewed file.
How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (21)
Comment |
Uh oh!
There was an error while loading. Please reload this page.
`add_variant_titles` still assigns titles by position, and that is deliberate — but it leaves one edit uncovered, so cover it where it matters. Positional title assignment is safe for the edits that actually happen. `title_schema_variants` bails on a length mismatch, so adding or removing a kind makes every title in that family disappear and `openapi_titles_schema_variants_for_redoc_tabs` fail loudly; replacing a variant in place edits the same line the title sits beside. The record bears this out: #799 inserted a guardrail kind and updated the titles correctly while silently breaking the descriptions (#1037), and #997 swapped `weighted` for `consistent_hash` with the titles staying right. The descriptions had no such forcing function, which is the whole reason the two tables diverged. That leaves a length-preserving reorder as the only silent edit. The two families that grow now pin their titles by discriminator in tests — the guardrail kinds already did; the exporter kinds do now. Verified by reordering two exporter titles: the new assertion names the offending kind while `openapi_titles_schema_variants_for_redoc_tabs` stays green, which is exactly the window being closed. The remaining families are small, stable string enums, plus `Model`, whose branches are mutual-exclusion shapes carrying no discriminator to key on at all. Converting those would split `add_variant_titles` into two mechanisms for a reorder that has never happened, and whose result is self-contradictory on sight — the tab would read `Lakera Guard` over a branch whose `kind` says `openai_moderation`, since kinds and descriptions no longer travel by position.
What
Load-balancing taxonomy rework for model groups (the AISIX-Cloud#1206 requirement), aligned with the APISIX balancer model: weight and priority are per-target attributes available under every strategy, and consistent hashing is a strategy of its own rather than a flag on another one.
The driving scenario: two pools of direct models A & B — all traffic on A while any A member is healthy, spill to B only when the whole A pool is down, consistent-hash distribution inside both pools:
Changes
targets[].priority(i32, default 0, higher preferred, negatives for backups): targets partition into tiers; the strategy orders each tier independently — per-tier balancer state, mirroring APISIX's per-priority pickers; tiers concatenate, so a lower tier only receives traffic when every higher-tier target failed or was health/cooldown-filtered.max_fallbackscaps the concatenated walk, and the first request that discovers a fully-dead active tier still succeeds (in-request tier spill).strategy: consistent_hash: ketama-style ring (160 points × weight units, capped; FNV-1a + splitmix64 finalizer — FNV alone clusters badly onname\0indexinputs), keyed by thehash_onsource chain (header/cookie/api_key/client_ip; default preserves the existing extraction chain byte-for-byte). A key's ring order doubles as its failover order: a failed target's keys spread to their ring successors, every other key keeps its mapping, and a recovered target takes its keys back.round_robinis now smooth weighted round-robin (the nginx algorithm): exact proportions, interleaved, and equal/absent weights reproduce the old declaration-order cycle exactly.least_busynow scores(1 + in-flight) / weight(the APISIX least_conn formula).failover/least_cost/least_latencyacceptweightbut do not use it (documented in the schema).weightedstrategy (folded intoround_robin) and thestickyflag (superseded byconsistent_hash). The retired enum value fails row-level in the lenient loader — a stale row cannot silently change meaning; declarative configs migrateweighted→round_robin(weights kept) andweighted+sticky→consistent_hash. The control plane migrates stored rows and re-projects in the companion CP PR.Breaking change (release notes)
strategy: weightedandrouting.stickyare gone. Managed deployments are migrated by the CP automatically; self-hosted declarative configs must be updated as above. Sticky cohort assignments re-shuffle once when moving toconsistent_hash(different hash construction).Tests
consistent-hash-routing-e2e, 6 cases): key affinity + spread; cookie→api_keyhash_onchain; backup tier idle while active healthy; fully-down active tier spills in-request with affinity inside the backup pool; cooldown recovery hands traffic back; single-member failure redistributes within its tier only.Fixes api7/AISIX-Cloud#1206
🤖 Generated with Claude Code