Add load_distribution strategy (consolidate / spread) [port #1248] - #3
Open
Harishkrishna17 wants to merge 1 commit into
Open
Add load_distribution strategy (consolidate / spread) [port #1248]#3Harishkrishna17 wants to merge 1 commit into
Harishkrishna17 wants to merge 1 commit into
Conversation
Adds a `load_distribution` service config that controls how the affinity scorer routes egress jobs across server instances: - "consolidate" (default, unchanged behavior): packs jobs onto already busy servers, keeping idle servers free for heavier egress types (room composite, web). - "spread": routes each job to the server with the most available CPU, distributing load evenly. Recommended for track-only deployments. The spread strategy uses a new Monitor.AvailableCPURatio() as the affinity score, so the server with the most headroom wins each selection round. Defaults to "consolidate" when unset. (cherry picked from commit f2eee2f)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports upstream livekit#1248 (
load_distribution) into the Talview fork — the alternate spread implementation, sibling to theaffinity_modePR.Why
Same goal as the
affinity_modePR: stop the defaultconsolidatescorer from over-packing a track-only fleet. livekit#1248 exposes it under a different config key and computes the score from a newMonitor.AvailableCPURatio().Config
Commit
config: add load_distribution strategy (consolidate | spread)(cherry-picked from Add load_distribution strategy (consolidate | spread) livekit/egress#1248)Note on conflict resolution
One trivial adjacency conflict in
pkg/config/service.go:mainalready addedCpuKillGraceSec(its native graceful-drain) at the same struct location. Resolved by keeping both fields — no logic change.Relationship to the other spread PR
This and the
affinity_modePR (livekit#1209) are two implementations of the same idea.affinity_modeis what we validated in VR prod;load_distributionis offered so Talview can compare and pick one. They should not both be merged as-is (duplicate/competing scorers).Verification
pkg/config,pkg/server,pkg/statscompile clean. Fullgo testneeds gstreamer/cgo (CI/Docker only).