Load Balancing - angelobreuer/Lavalink4NET GitHub Wiki
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.