Skip to content

Add load_distribution strategy (consolidate / spread) [port #1248] - #3

Open
Harishkrishna17 wants to merge 1 commit into
mainfrom
feat/load-distribution-spread
Open

Add load_distribution strategy (consolidate / spread) [port #1248]#3
Harishkrishna17 wants to merge 1 commit into
mainfrom
feat/load-distribution-spread

Conversation

@Harishkrishna17

Copy link
Copy Markdown

Ports upstream livekit#1248 (load_distribution) into the Talview fork — the alternate spread implementation, sibling to the affinity_mode PR.

Why

Same goal as the affinity_mode PR: stop the default consolidate scorer from over-packing a track-only fleet. livekit#1248 exposes it under a different config key and computes the score from a new Monitor.AvailableCPURatio().

Config

load_distribution: spread   # "consolidate" (default) | "spread"

Commit

Note on conflict resolution

One trivial adjacency conflict in pkg/config/service.go: main already added CpuKillGraceSec (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_mode PR (livekit#1209) are two implementations of the same idea. affinity_mode is what we validated in VR prod; load_distribution is 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/stats compile clean. Full go test needs gstreamer/cgo (CI/Docker only).

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant