-
-
Notifications
You must be signed in to change notification settings - Fork 27
Load Balancing
MrCakeSlayer edited this page Sep 24, 2022
·
1 revision
Lavalink4NET Clusters support load balancing:
The score load balancing strategy will calculate a rating for each node and favors the node with the highest. (default)
The round robin load balancing strategy favors the node that has not been used the longest.
The load-balancing strategy that uses the node that has the least-playing player.
The load load-balancing-strategy favors the node with the least node process CPU usage.
namespace [...]
{
using System;
using Lavalink4NET.Cluster;
/// <summary>
/// Provides a set of load balancing strategies.
/// </summary>
public static class LoadBalacingStrategies
{
private static readonly Random random = new Random();
/// <summary>
/// This load balancing strategy uses a random player.
/// </summary>
public static LoadBalacingStrategy MyLoadBalancingStrategy { get; } = (cluster, nodes) =>
nodes[random.NextInt(nodes.Count)];
}
}
The above example will choose a random node.
Lavalink4NET Wiki - Licensed under MIT