Using a BIG-IP®
Local Traffic Manager system that includes the Link Controller, you can configure session persistence. When you configure session persistence
, the BIG-IP system tracks and stores session data, such as the specific pool member that serviced a client request. The primary reason for tracking and storing session data is to ensure that client requests are directed to the same pool member throughout the life of a session or during subsequent sessions.
In addition, session persistence can track and store other types of
information, such as user preferences or a user name and password.
The BIG-IP system offers two types of session persistence, each one
designed to accommodate a specific type of storage requirement for session data. The type of persistence that you implement depends on where and how you want to store client-specific information, such as items in a shopping cart or airline ticket reservations.
For example, you might store airline ticket reservation information in a
back-end database that all servers can access, or on the specific server to which the client originally connected. When you enable persistence, returning clients can bypass load balancing and instead connect to the server to which they last connected in order to access their saved information.
The primary tool for configuring session persistence is to configure a
persistence profile and assign it to a virtual server. If you want to enable persistence for specific types of traffic only, as opposed to all traffic passing through the virtual server, you can write an iRule.
A persistence profile
is a pre-configured object that automatically enables persistence when you assign the profile to a virtual server. By using a persistence profile, you avoid having to write a program to implement a type of persistence.
Each type of persistence that the BIG-IP system offers includes a
corresponding default persistence profile. These persistence profiles each contain settings and setting values that define the behavior of the BIG-IP system for that type of persistence. You can either use the default profile or create a custom profile based on the default.
Instead of configuring a persistence profile, which enables a persistence
type for all sessions passing through the virtual server, you can write an iRule, which enables a persistence type for particular requests (for example, for HTTP traffic that includes a certain cookie version only).
The remainder of this chapter focuses on enabling persistence using
persistence profiles. For information on enabling persistence by writing an iRule, see the F5 Networks DevCentral web site http://devcentral.f5.com
Chapter 18, Writing iRules
You can configure persistence profile settings to set up session persistence
on the BIG-IP system. You can configure these settings when you create a profile or after profile creation by modifying the profiles settings. For specific procedures on configuring a profile, see Chapter 13, Understanding Profiles
| || |Destination address affinity persistence
Also known as sticky persistence, destination address affinity persistence supports TCP and UDP protocols, and directs session requests to the same server based solely on the destination IP address of a packet.
| || |Source address affinity persistence
Also known as simple persistence, source address affinity persistence supports TCP and UDP protocols, and directs session requests to the same server based solely on the source IP address of a packet.
Regardless of the type of persistence you are implementing, you can specify
the criteria that the BIG-IP system uses to send all requests from a given client to the same pool member. These criteria are based on the virtual server or servers that are hosting the client connection. To specify these criteria, you use the Match Across Services
, Match Across Virtual Servers
, and Match Across Pools
profile settings. Before configuring a persistence profile, it is helpful to understand these settings.
When you enable the Match Across Services
profile setting, the BIG-IP system attempts to send all persistent connection requests received from the same client, within the persistence time limit, to the same pool member only when the virtual server hosting the connection has the same virtual address as the virtual server hosting the initial persistent connection. Connection requests from the client that go to other virtual servers with different virtual addresses, or those connection requests that do not use persistence, are load balanced according to the load balancing method defined for the pool.
For example, suppose you configure virtual server mappings where the
virtual server v1:http
has persistence enabled and references the http_pool
(containing the nodes n1:http
) and the virtual server v1:ssl
has persistence enabled and references the pool ssl_pool
(containing the nodes n1:ssl
Suppose the client makes an initial connection to v1:http,
and the load balancing algorithm assigned to the pool http_pool
as the node. If the client subsequently connects to v1:ssl
, the BIG-IP system uses the persistence session established with the first connection to determine the pool member that should receive the connection request, rather than the load balancing method. The BIG-IP system should then send the third connection request to n1:ssl
, which uses the same node as the n1:http
node that currently hosts the client's first connection with which it shares a persistent session.
If the same client then connects to a virtual server with a different virtual
address (for example, v2:ssl
), the BIG-IP system starts tracking a new persistence session, using the load balancing method to determine which node should receive the connection request. The system starts a new persistence session because the requested virtual server uses a different virtual address (v2
) than the virtual server hosting the first persistent connection request (v1
Important: In order for the Match Across Services
setting to be effective, virtual servers that use the same virtual address, as well as those that use TCP persistence, should include the same node addresses in the virtual server mappings.
You can set the BIG-IP system to maintain persistence for all sessions
requested by the same client, regardless of which virtual server hosts each individual connection initiated by the client. When you enable the Match Across Virtual Servers
setting, the BIG-IP system attempts to send all persistent connection requests received from the same client, within the persistence time limit, to the same pool member. Connection requests from the client that do not use persistence are load balanced according to the currently selected load balancing method.
When you enable the Match Across Pools
setting, the BIG-IP system can use any pool that contains a given persistence record. The default is disabled (cleared).
You can optimize your server array with destination address affinity
persistence. Destination address affinity persistence, also known as sticky persistence,
directs requests for a certain destination IP address to the same server, regardless of which client made the request.
This type of persistence provides the most benefits when load balancing
caching servers. A caching server intercepts web requests and returns a cached web page if it is available. In order to improve the efficiency of the cache on these servers, it is necessary to send similar requests to the same server repeatedly. You can use the destination address affinity persistence type to cache a given web page on one server instead of on every server in an array. This saves the other servers from having to duplicate the web page in their cache, wasting memory.
To implement destination address affinity persistence, you either use the
profile or create a custom profile. Table 15.1
shows the settings and their values that make up a Destination Address Affinity profile.
Source address affinity persistence
, also known as simple persistence, tracks sessions based only on the source IP address. When a client requests a connection to a virtual server that supports source address affinity persistence, the BIG-IP system checks to see if that client previously connected, and if so, returns the client to the same pool member.
Persistence settings apply to all protocols. When the persistence timer is set
to a value greater than 0
, persistence is on
. When the persistence timer is set to 0
, persistence is off
The persistence mask feature works only for virtual servers that implement
source address affinity persistence. By adding a persistence mask, you identify a range of source IP addresses to manage together as a single source address affinity persistent connection when connecting to the pool.
Understanding Source Address Affinity
persistence profile settings
To implement source address affinity persistence, you can either use the
profile or create a custom profile. Table 15.2
shows the settings and values that make up a Source Address Affinity profile.