The Content Based Router (CBR) 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
Specify affinity for the CBR component
as active cookie, passive cookie and URI, as follows:
- Active cookie
- Enables load-balancing Web traffic with affinity to the same server
based upon cookies generated by Load Balancer. When a rule has been
enabled for active cookie affinity, new client requests are load-balanced
using standard CBR algorithms, while succeeding requests from the
same client are sent to the initially chosen server. The chosen server
is stored as a cookie in the response to the client. As long as the
client's future requests contains the cookie, and each request arrives
within the stickytime interval, the client will maintain affinity
with the initial server.
Making a rule sticky would normally be
used for CGI or servlets that store client state on the server. The
state is identified by a cookie ID (these are server cookies). Client
state is only on the selected server, so the client needs the cookie
from that server to maintain that state between requests.
- Passive cookie
- Enables load-balancing Web traffic with affinity to the same server
based upon self-identifying cookies generated by the servers. When
passive cookie affinity is enabled, Load Balancer will choose the
server based on the cookie name in the HTTP header of the client request.
The
first time Load Balancer finds a server whose cookie value contains
the client's cookie name, Load Balancer chooses that server for the
request. If the cookie name in the client request is not found or
does not match any of the content within the servers' cookie values,
the server is chosen using existing server selection or the weighted
round-robin technique.
- URI
- URI affinity allows you to load-balance web traffic to Caching
Proxy servers which allow unique content to be cached on each individual
server. As a result, you will effectively increase the capacity of
your site's cache by eliminating redundant caching of content on multiple
machines. This is useful in scenarios wherein your Web site supports
a moderate volume of client traffic to very diverse content and you
prefer to have a larger cache spread across multiple servers.
The
default for the affinity option is none.