How a load balancer works depends on what rules you use. It is possible to create an unlimited number of rules on a single load balancer.
There's a restriction which prevents you from setting multiple rules on a single port of the load balancer.
Each single rule is made up by 4 parameters:
Algorithm
Indicates the standard used by the load balancer to manage the instances, that is the rule with which it chooses to send an instance to one server rather than another. It is possible to choose from two basic algorithms:
Leastconn
- This algorithm directs traffic to the available instance with the least number of active connections.
- The LeastConn algorithm is dynamic and therefore allows you to balance any workload on the servers in real time.
- It is recommended for persistent connections with HTTP and
HTTPS protocol.
- This algorithm cannot be used if the balanced machines or the client do not accept the cookies.
Source
- This algorithm directs traffic based on the hash of the IP address / source port value and is always mapped to the same server.
- It is recommended for persistent connections with TCP protocol.
- It is not recommended for persistent connections with HTTP and HTTPS protocol.
Protocol
Indicates which protocol has been used:
HTTP
TCP
Balancer port
Indicates the port of the load balancer that will receive the instance. For each single port of the load balancer it is possible to create only one single rule.
Machine port
Indicates the port of the server to which the load balancer will send the instance.