Load balancing App-V with Netscalers

Recently I was asked to assist in setting up a Citrix Netscaler to load balance two App-V servers. Having had no hands on experience with a Netscaler before, I jumped on the net to see what information I could find. Very little specific information came up and so I’ve detailed how I got the load balancing working:

Equipment / Config :

App-V Management Servers x2
Citrix Netscaler x1
RTSP Protocol

 Quick Steps:

  • On the Netscaler create a VIP that is associated with the two App-V servers based on TCP across all ports. Two Services should be created with RTSP monitors. Persistence should be set to SourceIP and Redirection Mode should be MAC based.
  • Add a loopback adapter on the App-V servers; configure the IP to be the same as your VIP and enable forwarding.
  • Configure the APP-V client to use the VIP. A restart of the service will be required.
App-V Netscaler Visual Layout
Visual Layout

Detailed Steps

Configuring the Netscaler

  1. Log into the Netscaler and expand the “Load Balancing” or “Virtual Servers and Services” folder.
  2. Click on the Monitors node and then Add to begin creating an RTSP monitor for the first App-V server. Set the Name of this Monitor (APPV_RTSP1) and set the Type to RTSP.
  3. Set the Destination IP and Port (554 for RTSP) with the settings corresponding to your first App-V server, leave the remaining options as default.
  4. Switch to the Special Parameters tab and set the RTSP Request to “OPTIONS *” and set a response code of 401. Click Create to finish the creation of the Monitor.
  5. Repeat steps 2 to 4 to create another monitor (APPV_RTSP2) for your second App-V server.
  6. Once all your monitors have been created, click on the Virtual Servers node in the left hand pane and then right click Add.

    RTSP Monitor
    RTSP Monitors
  7. Set the Name (VIP_APPV) of this load balancing Virtual Server and its corresponding Virtual IP address. Select a protocol of ANY and a port of *.
  8. To create the Services click on the Add button and you’ll be presented with a new dialog box.
  9. In the Create Service dialog box enter a Service Name (SV_APPV1). You will need to create a new service for each App-V server, so select a name that helps differentiate between your App-V servers.
  10. For Server, enter the IP address of your first App-V server. Protocol should be set to ANY and port should be *.
  11. From the Monitors/Available selection box, highlight the monitor that corresponds to this App-V server and then click on Add to move it to the right hand side. Policies and Advanced tabs can be left as default. Click Create to finish.
  12. Repeat steps 8 to 11, enter the information corresponding to your second App-V server.
  13. Once the Services have been created, ensure they are Active by checking their corresponding check boxes, and then move to the Method and Persistence tab.
  14. Choose your Load Balancing method, I selected Least Connection.
  15. Persistence should be set to SourceIP, time out can be left as default and Persist-Netmask should be set to 255.255.255.255.
  16. Move to the Advanced tab and set the Redirection Mode to MAC Based.
  17. Click on Create to finish the setup.

If you have a working setup the State and Effective State should both indicate UP on the Virtual Servers node. Both services should also indicate UP on the Services node. Experiment by stopping the App-V services and checking their status via the Netscaler. Note that it might take a few moments for the Netscaler to report changes in state (in particular from DOWN to UP)

If you open the services node, select a particular service and highlight the monitor you can see the return response from the App-V server to the request that was sent. You will see that the response code is 401 which corresponds to Unauthorized. I’m taking this as a positive response as the App-V server is up and able to return a response, if the sever was down, this would not have been returned.

Monitor Responses
Response from RTSP Monitor

The App-V servers must now be configured with a Loopback adapter.

  1. Open Device Manager, select the machine name, right click and select Add Legacy Hardware
  2. When the wizard opens, click on Next, choose Install hardware manually and then Next
  3. Select Network Adapters, Microsoft and then select Loopback Adapter and then Next
  4. Open up Network Connections from Control Panel and rename the newly created Loopback adapter to “MS Loopback”
  5. Open CMD as an Administrator
  6. In the CMD type “netsh interface ipv4 add address “MS Loopback” ip-address” where ip-address is your virtual ip address
  7. In the CMD type “netsh interface ipv4 set interface “MS Loopback” forwarding=enabled”
  8. In the CMD type “netsh interface ipv4 set interface “Local Area Connection” forwarding=enabled”

Finally, the App-V clients must be reconfigured to use the newly created Virtual Server. Note that after setting the new hostname a restart of the local App-V service will be required.

Resources:

http://forums.citrix.com/message.jspa?messageID=1455525

http://blogs.technet.com/b/appv/archive/2011/06/08/app-v-fix-streaming-rtsp-may-fail-with-the-citrix-netscaler-load-balancer.aspx

http://www.citrix.com/netscaler/tryit

http://www.appvirtguru.com/viewtopic.php?f=19&t=3670

5 Comments


  1. // Reply

    Hi,

    We have discovered that after a reboot the Application Virtualization Management Server service will not start. The issue appears to be an issue connecting to the the sql database which is hosted on another server. If we disable the loop back adaptor the service starts successfully.
    Any ideas why this might be occurring?

    Thanks!



  2. // Reply

    Fixed (i believe). Added default gateway to loopback adaptor.



Leave a Reply

Your email address will not be published. Required fields are marked *