Draining connections from services in a Netscaler 9.1 load balanced virtual server

It took me a while to figure this one out. In order to safely and effectively drain connections from a service or services on a Netscaler virtual server, follow this procedure.

Two default settings on LB services and virtual servers to note are 'Down state flush' on the Advanced tab and the 'Weight' value on the LBVS Services tab.
Disabling 'Down state flush' on a service and/or LBVS allows active sessions to remain active in the event that a service is in the 'out of service' state. The default for the Netscaler is to enable (check) this option. If enabled, all sessions to a service are severed if it is out of service. Unchecking this option will allow active sessions to timeout before being kicked. When this option is not enabled and you disable a service, you will be prompted to specify a timeout in seconds. The service will be set to 'Out of service' at which time subsequent sessions are created on the higher weighted service in the LBVS.


This is not 100%, but it is better than kicking all active sessions and allows you to at least have the fewest possible sessions once a service goes down. Remember that a higher value weight gets more connections than a lower value. Depending on which method you are using (least connection, round robin, etc.) connections will be sent using the Netscaler's algorithm; the higher value will get a higher percentage of connections, but not all of them.



Weight!!!

  1. Load Balancing -> Services:
    • Uncheck the 'Down state flush' option in the Advanced tab of the services assigned to your load balancing virtual server.
  2. Load Balancing -> Virtual Servers:
    • Open the LBVS that contains the services from step 1.
      • In the Services tab, set the weight of the service to disable to 1 and the weight of the service to remain in the pool to 100, then OK to save the config.
      • In the Advanced tab, uncheck the 'Down state flush' option.
  3. Load Balancing -> Services:
    • Right-click the service you want to disable and click Disable.
    • Enter the time in seconds before the service goes down, then click Enter.
Once you click Enter the service should show as 'Out of service'. Sessions will begin to drain from it as they time out and the service weighted 100 should begin to accept more connections.


Set weight values. Higher values get higher priority for connections.
Disable 'Down state flush'
Set desired time in seconds before service is disabled.

Comments