The Citrix NetScaler initially selects a server by using a load balancing method. With persistence configured, enabling the NetScaler to send any subsequent client requests to the selected server, the server can access state information for that client. If persistence is configured, it overrides the load balancing methods once the server has been selected. If the configured persistence applies to a service that is down, the NetScaler uses the load balancing methods to select a new service, and the new service becomes persistent for subsequent requests from the client. If the state of the selected service is “out of service”, it continues to serve the outstanding requests, but it does not allow new requests or connections. After the shutdown period elapses, no new requests or connections are directed to the service and the existing connections are closed.
The NetScaler maintains persistence based on the contents of the matched rule. This persistence type requires configuration of a classic expression that evaluates the request payload or a policy infrastructure expression that evaluates requests or responses. For example, you can configure persistence based on application session information in a response cookie or header. You can configure persistence rules using classic or advanced expressions.
If a request matches the criteria in the expression, a persistence session is created and subsequent client requests are directed to the previously selected server. To configure rule-based persistence, use the parameters described in the following table.
Parameters for Rule-Based Persistence
|Rule||Value used to set the RULE persistence type. The value can
be an existing rule name, or it can be a classic or advanced
expression. The default value is none. The maximum
length is 14999.
The rule evaluates either requests that are directed to the
load balanced servers or responses from the servers.
|Response Rule||Value used to set the RULE persistence type. The response
rule evaluates responses from the load balanced servers.
The value is an advanced expression. The default value is
none. The maximum length is 14999. Response rule is not
supported for 9.2 nCore.
Example: Classic Expression for a Request Payload
The expression, “httpheader user agent contains MyBrowser” directs any client requests containing, “user agent: MyBrowserV1.1” to the initially selected server.
Example: Advanced Expression for a Request Header
The expression, “HTTP.REQ.HEADER (“user agent”).CONTAINS (“MyBrowser”) directs client requests containing, “user-agent: MyBrowserV1.1” to the initially selected server.
Example: Advanced Expression for a Response Cookie
The expression, “HTTP.RES.HEADER(“SET-COOKIE”).VALUE(0).TYPECAST_NVLIST_T(‘=’,’;’).VALUE(“server”)” examines server responses containing “server” cookies to the initially selected server.
To configure persistence based on user-defined rules by using the command line At the NetScaler command line, type:
To configure persistence based on user-defined rules by using the GUI configuration utility
- In the Persistence list, select RULE.
- To configure a rule that analyzes requests, click the Configure button next to the Rule field. To configure a rule that analyzes responses from the server, click the Configure button next to the Response Rule field.
- Select Classic Syntax or Advanced Syntax, and configure the rule.
Get the most powerful Persistence Load Balancer here.