Load Balancer > The rules associated with a load balancer

02 The rules associated with a load balancer

The load balancer works according to the rules configured. There is no predefined limit to the number of rules you can create on a load balancer: the number is determined by the possible combinations of the four available parameters.
 
You cannot configure multiple rules on the same load balancer port.

Each rule consists of 4 parameters:
  • Algorithm
    Defines the criteria used by the load balancer to route traffic to the instances, i.e. how it chooses which machine to forward a request to. You can choose between two main algorithms:
    • LeastConn
      • Directs traffic to the available instance with the fewest active connections.
      • It is a dynamic algorithm designed to balance the workload across machines in real time.
      • It is suitable for persistent connections using HTTP and HTTPS.
      • It cannot be used if the machines or clients do not accept cookies (required for session tracking).
    • Source
      • Routes requests based on a hash of the source IP address and port, ensuring that the same client is always mapped to the same machine.
      • It is suitable for persistent connections using TCP.
      • It is not recommended for HTTP/HTTPS, as it does not ensure optimal distribution for web sessions.
  • Protocol
    Specifies the communication protocol to be handled:
  • Balancer port
    The port on which the load balancer receives incoming requests: only one rule can be defined for each load balancer port.
  • Machine port
    The port on the machine to which the load balancer forwards the request.