Protecting the Content Switching Setup against Failure
Content switching may fail when the content switching virtual server goes DOWN or fails to handle excessive traffic, or for other reasons. To reduce the chances of failure, you can take the following measures to protect the content switching setup against failure:
Configuring a Backup Virtual Server
If the primary content switching virtual server is marked DOWN or DISABLED, the Citrix ADC appliance can direct requests to a backup content switching virtual server. It can also send a notification message to the client regarding the site outage or maintenance. The backup content switching virtual server is a proxy and is transparent to the client.
When configuring the backup virtual server, you can specify the configuration parameter Disable Primary When Down to ensure that, when the primary virtual server comes back up, it remains the secondary until you manually force it to take over as the primary. This is useful if you want to ensure that any updates to the database on the server for the backup are preserved, enabling you to synchronize the databases before restoring the primary virtual server.
You can configure a backup content switching virtual server when you create a content switching virtual server or when you change the optional parameters of an existing content switching virtual server. You can also configure a backup content switching virtual server for an existing backup content switching virtual server, thus creating cascaded backup content switching virtual servers. The maximum depth of cascaded backup content switching virtual servers is 10. The appliance searches for a backup content switching virtual server that is up and accesses that content switching virtual server to deliver the content.
Note
If a content switching virtual server is configured with both a backup content switching virtual server and a redirect URL, the backup content switching virtual server takes precedence over the redirect URL. The redirect is used when the primary and backup virtual servers are down.
To set up a backup content switching virtual server by using the command line interface
At the command prompt, type:
set cs vserver -backupVserver -disablePrimaryOnDown (ON|OFF)
Example
set cs vserver Vserver-CS-1 -backupVserver Vserver-CS-2 -disablePrimaryOnDown ON
To set up a backup content switching virtual server by using the configuration utility
- Navigate toTraffic Management > Content Switching > Virtual Servers, configure a virtual server and specify the protocol as MYSQL.
- InAdvanced Settings, selectProtection, and specify aBackup Virtual Server.
Diverting Excess Traffic to a Backup Virtual Server
The spillover option diverts new connections arriving at a content switching virtual server to a backup content switching virtual server when the number of connections to the content switching virtual server exceeds the configured threshold value. The threshold value is dynamically calculated, or you can set the value. The number of established connections (in case of TCP) at the virtual server is compared with the threshold value. When the number of connections reaches the threshold, new connections are diverted to the backup content switching virtual server.
If the backup content switching virtual servers reach the configured threshold and are unable to take the load, the primary content switching virtual server diverts all requests to the redirect URL. If a redirect URL is not configured on the primary content switching virtual server, subsequent requests are dropped.
To configure a content switching virtual server to divert new connections to a backup virtual server by using the command line interface
At the command prompt, type:
set cs vserver \ -soMethod \ -soThreshold \ -soPersistence \ -soPersistenceTimeout \
Example
set cs vserver Vserver-CS-1 -soMethod Connection -soThreshold 1000 -soPersistence enabled -soPersistenceTimeout 2
To set a content switching virtual server to divert new connections to a backup virtual server by using the configuration utility
- Navigate toTraffic Management > Content Switching > Virtual Servers, configure a virtual server and specify the protocol as MYSQL.
- InAdvanced Settings, selectProtection, and configure spillover.
Configuring a Redirection URL
You can configure a redirect URL to communicate the status of the Citrix ADC appliance in the event that a content switching virtual server of type HTTP or HTTPS is DOWN or DISABLED. This URL can be local or remote.
Redirect URLs can be absolute URLs or relative URLs. If the configured redirect URL contains an absolute URL, the HTTP redirect is sent to the configured location, regardless of the URL specified in the incoming HTTP request. If the configured redirect URL contains only the domain name (relative URL), the HTTP redirect is sent to a location after appending the incoming URL to the domain configured in the redirect URL.
Citrix recommends using an absolute URL. That is, a URL ending in /, for example www.example.com/ instead of a relative URL. A relative URL redirection might result in the vulnerability scanner reporting a false positive.
Note
If a content switching virtual server is configured with both a backup virtual server and a redirect URL, the backup virtual server takes precedence over the redirect URL. A redirect URL is used when the primary and backup virtual servers are down.
When redirection is configured and the content switching virtual server is unavailable, the appliance issues an HTTP 302 redirect to the user’s browser.
To configure a redirect URL for when the content switching virtual server is unavailable by using the command line interface
At the command prompt, type:
set cs vserver \ -redirectURL \
Example
set cs vserver Vserver-CS-1 -redirectURL http://www.newdomain.com/mysite/maintenance
To configure a redirect URL for when the content switching virtual server is unavailable by using the configuration utility
- Navigate toTraffic Management > Content Switching > Virtual Servers, configure a virtual server and specify the protocol as MYSQL.
- InAdvanced Settings, selectProtection, and specify a Redirect URL.
Configuring the State Update Option
The content switching feature enables the distribution of client requests across multiple servers on the basis of the specific content presented to the users. For efficient content switching, the content switching virtual server distributes the traffic to the load balancing virtual servers according to the content type, and the load balancing virtual servers distribute the traffic to the physical servers according to the specified load balancing method.
For smooth traffic management, it is important for the content switching virtual server to know the status of the load balancing virtual servers. The state update option helps to mark the content switching virtual server DOWN if the load balancing virtual server bound to it is marked DOWN. A load balancing virtual server is marked DOWN if all the physical servers bound to it are marked DOWN.
When State Update is disabled:
The status of the content switching virtual server is marked as UP. It remains UP even if there is no bound load balancing virtual server that is UP.
When State Update is enabled:
When you add a new content switching virtual server, initially, its status is shown as DOWN. When you bind a load balancing virtual server whose status is UP, the status of the content switching virtual server becomes UP.
If more than one load balancing virtual server is bound and if one of them is specified as the default, the status of the content switching virtual server reflects the status of the default load balancing virtual server.
If more than one load balancing virtual server is bound without any of them being specified as the default, the status of the content switching virtual server is marked UP only if all the bound load balancing virtual servers are UP.
To configure the state update option by using the command line interface
At the command prompt, type:
add cs vserver \ \ \ \ -stateUpdate ENABLED
Example
add cs vserver csw_vserver HTTP 10.18.250.154 80 -stateupdate ENABLED -cltTimeout 180
To configure the state update option by using the configuration utility
- Navigate toTraffic Management > Content Switching > Virtual Servers, configure a virtual server and specify the protocol as MYSQL.
- InAdvanced Settings, selectTraffic Settings, and then selectState Update.
Flushing the Surge Queue
在将一个物理服务器接收到的请求s, it becomes slow to respond to the clients that are currently connected to it, which leaves users dissatisfied and disgruntled. Often, the overload also causes clients to receive error pages. To avoid such overloads, the Citrix ADC appliance provides features such as surge protection, which controls the rate at which new connections to a service can be established.
设备之间的连接多路复用clients and physical servers. When it receives a client request to access a service on a server, the appliance looks for an already established connection to the server that is free. If it finds a free connection, it uses that connection to establish a virtual link between the client and the server. If it does not find an existing free connection, the appliance establishes a new connection with the server, and establishes a virtual link between client and the server. However, if the appliance cannot establish a new connection with the server, it sends the client request to a surge queue. If all the physical servers bound to the load balancing or content switching virtual server reach the upper limit on client connections (max client value, surge protection threshold or maximum capacity of the service), the appliance cannot establish a connection with any server. The surge protection feature uses the surge queue to regulate the speed at which connections are opened with the physical servers. The appliance maintains a different surge queue for each service bound to the virtual server.
The length of a surge queue increases whenever a request comes for which the appliance cannot establish a connection, and the length decreases whenever a request in the queue gets sent to the server or a request gets timed out and is removed from the queue.
If the surge queue for a service or service group becomes too long, you may want to flush it. You can flush the surge queue of a specific service or service group, or of all the services and service groups bound to a load balancing virtual server. Flushing a surge queue does not affect the existing connections. Only the requests present in the surge queue get deleted. For those requests, the client has to make a fresh request.
You can also flush the surge queue of a content switching virtual server. If a content switching virtual server forwards some requests to a particular load balancing virtual server, and the load balancing virtual server also receives some other requests, when you flush the surge queue of the content switching virtual server, only the requests received from this content switching virtual server are flushed; the other requests in the surge queue of the load balancing virtual server are not flushed.
Note
你不能冲涌队列缓存redirection, authentication, VPN or GSLB virtual servers or GSLB services. Do not use the Surge Protection feature if Use Source IP (USIP) is enabled.
To flush a surge queue by using the command line interface
The flush ns surgeQ command works in the following manner:
- You can specify the name of a service, service group, or virtual server whose surge queue has to be flushed.
- If you specify a name while executing the command, surge queue of the specified entity will be flushed. If more than one entity has the same name, the appliance flushes surge queues of all those entities.
- If you specify the name of a service group, and a server name and port while executing the command, the appliance flushes the surge queue of only the specified service group member.
- You cannot directly specify a service group member (
and ) without specifying the name of the service group ( ) and you cannot specify without a . Specify the and if you want to flush the surge queue for a specific service group member. - If you execute the command without specifying any names, the appliance flushes the surge queues of all the entities present on the appliance.
- If a service group member is identified with a server name, you must specify the server name in this command; you cannot specify its IP address.
At the command prompt, type:
flush ns surgeQ [-name ] [-serverName ].
Examples
1. flush ns surgeQ –name SVC1ANZGB –serverName 10.10.10.1 80 The above command flushes the surge queue of the service or virtual server that is named SVC1ANZGB and has IP address as 10.10.10 2. flush ns surgeQ The above command flushes all the surge queues on the appliance.
To flush a surge queue by using the configuration utility
Navigate toTraffic Management > Content Switching > Virtual Servers, select a virtual server and, in the Action list, selectFlush Surge Queue.