The Dispatcher affinity feature maps a client IP address
to a back-end server. Affinity is established once 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.
This approach has the advantages of providing
a hard affinity and of being more efficient for Load Balancer. The
affinity method that is used decreases memory and CPU utilization
as compared to connection forwarding.
Avoid trouble: The removal of an affinity record also breaks connections,
so when you migrate from Load Balancer for IPv4 to Load Balancer for
IPv4 and IPv6, the value you have set for maximum staletimeout setting
should be used as the value for stickytime setting for Load Balancer
for IPv4 and IPv6.
gotcha
Choose a selection algorithm based
on how Load Balancer should route connections. You can choose the
following selection algorithms:
- 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:
- 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.
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: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.
- connection+affinity
- 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 behaviour
for the connection+affinity 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.