"Power of Two Random Choices" option for node selection (#3785)

* Added optional "Power of Two Random Choices" algorithm for the node selector sort_by feature. The current, default behavior of picking the lowest-valued node remains.
This commit is contained in:
Alan Willard
2025-10-08 15:31:01 -07:00
committed by GitHub
parent a20bbe34fa
commit a8d4df66f4
14 changed files with 373 additions and 22 deletions
+2
View File
@@ -212,6 +212,7 @@ type TURNConfig struct {
type NodeSelectorConfig struct {
Kind string `yaml:"kind,omitempty"`
SortBy string `yaml:"sort_by,omitempty"`
Algorithm string `yaml:"algorithm,omitempty"`
CPULoadLimit float32 `yaml:"cpu_load_limit,omitempty"`
SysloadLimit float32 `yaml:"sysload_limit,omitempty"`
Regions []RegionConfig `yaml:"regions,omitempty"`
@@ -395,6 +396,7 @@ var DefaultConfig = Config{
SortBy: "random",
SysloadLimit: 0.9,
CPULoadLimit: 0.9,
Algorithm: "lowest",
},
SignalRelay: SignalRelayConfig{
RetryTimeout: 7500 * time.Millisecond,