Optimize connections with client-to-server affinity for the Dispatcher component
The Dispatcher affinity feature maps a client IP address to a back-end server. Affinity is established after a packet's destination IP address matches the cluster, the destination port matches the Load Balancer port, and the source IP address matches.
About this task
When affinity is established, subsequent packets are sent to the same back-end server. When affinity is broken, due to a server down or a server removal, all affinity and thus connections to that server are broken. Also, there is no "connection" information reported in the command line or GUI clients. Only the number of active affinity records are used.
- affinity
- Specifies that when a subsequent packet arrives from the same client as a previous packet, the
request will be directed to the same server as the previous packet. Over time, the client will
finish sending packets, and the affinity record will go away.Each affinity record lives for the stickytime value, which is in seconds:You can use the quiesce command to take a server offline. The server is not taken down until after the staletimeout value expires. This is an example of the quiesce command:
- If a subsequent connection is received within the interval of the stickytime value, the affinity record is still valid and the request will go to the same server.
- If a subsequent connection is not received within the interval for the stickytime value, the record is purged. Load Balancer will select a new server for a connection that is received after the stickytime value has expired.
dscontrol manager quiesce server - connection
- Specifies that when a new TCP connection is received from a client, Load Balancer will choose the server at that moment in time, and forwards the packets to it. If a subsequent connection comes in from the same client, Load Balancer treats this connection as an unrelated, new connection and choose an appropriate server at that moment.
- conn+affin
- The conn+affin selection algorithm combines the connection and affinity selection algorithms.
Specifies that when a packet arrives from an existing connection, it is forwarded to the server
which was chosen for that connection. If the packet does not belong to an existing connection, but
the packet arrives from the same client, then Load Balancer selects the same server that was chosen
for the previous connection.
The behavior for the conn+affin algorithm is similar to the affinity algorithm, but the timeout value for affinity is calculated from start of every connection. That means that if the time between the start of two connections from the same client is less than the stickytime value, then both connections will be forwarded to same server.