Microsoft App-V 5.0 – Streaming via HTTP

Written by Ingmar Verheij on October 25th, 2013. Posted in Microsoft App-V

Microsoft App-V 5.0With Microsoft App-V 5.0 virtual application packages (or sequences) can be streamed to the client with two delivery methods: SMB or HTTP. With SMB being the easiest one (all you need is a file share), the HTTP delivery mechanism is IMO more scalable.

The ability to stream via HTTP is natively built-in in the App-V client, no configuration is required. All that is needed to publish the application via HTTP is to specify the URL instead of the UNC location at the Management Server. Unfortunately Microsoft doesn’t provide us with a description on how to built a Microsoft IIS Web Server to enable it to stream App-V packages.

 

MIME type

The first (and most simple) thing you need to configure is to add the file extension .appv as a MIME type. You can achieve this by following these steps:

  1. Open the Internet Information Services (IIS) Manager
  2. Select the (Default) Web Site (the site where you’re publishing the content)
  3. Click on IIS \ MIME Types
  4. Click on Add
    • File name extension: .appv
    • MIME type: application/appv

Internet Information Services (IIS) ManagerEdit MIME Type

 

Virtual directory

Next you might want to create a virtual directory that points to a folder shared on the network containing your virtual application packages. These are again a number of easy steps:

  1. Open the Internet Information Services (IIS) Manager
  2. Right-click on the (Default) Web Site (the site where you’re publishing the content) and click on Add Virtual Directory
  3. Specify an Alias and the physical path to the share
  4. Click on Connect as and specify the credentials to connect to the network share (or you can choose to enable anyonymous authentication)

Add Virtual Directory

 

Caching

Like I wrote in the beginning of the article using a webserver to stream virtual application packages to clients is more scalable. The reason for this is that the webserver can cache files in memory, relieving the fileserver. Especially when you’ve got thousands of clients you don’t want them all to connect directly to the fileserver but spread them across a number of webservers using a load balancer.

Microsoft App-V 5 streaming via HTTP

 

 

Web Service Cache

Microsoft IIS has a number of built-in caching mechanisms to accelerate the delivery of web content which can be monitored with the Performance Monitor. All related information is collected in counter category Web Service Cache. While you might expect this works out of the box, it doesn’t (well it does but only for very tiny applications).

 

File Cache Memory Usage

After downloading an App-V package (of 250Mb) twice using a browser the File Cache Memory Usage is still 0 (and File Cache Misses is 2). As a result the virtual application file is retrieved from the file server for each client, making the webserver no more than a proxy (kinda useless right?).

Web Service Cache - Default

As a result both the send and received usage of the Ethernet adapter is ~100 Mbps.

Ethernet usage - Default

.
 
Tuning

The reason for this is that the maximum size of a cached object is 256 KB. So unless your App-V package is 1/4 MB, it’s not cached. Fortunately this can be changed using the registry key:

HKLM\System\CurrentControlSet\Services\InetInfo\Parameters\MaxCachedFileSizeInMB (REG_DWORD)

I’ve changed this value to 4096 (4GB) so IIS will cache all files smaller then 4GB. IIS manages the available memory and will a scavenger each 120 seconds. If you want to keep your files caches longer then 2 minutes you can increase the ObjectCacheTTL value to a higher number.

HKLM\System\CurrentControlSet\Services\InetInfo\Parameters\ObjectCacheTTL (REG_DWORD)

I’ve changed this value to 600 seconds so App-V clients get the virtual application package from the memory of the webserver instead fileserver if it’s downloaded within 10 minutes.

MaxCachedFileSizeInMBObjectCacheTTL

IIS  uses an algorithm to determine if files should be cached, by default IIS only caches files that are requested twice within ten seconds. As with the MaxCachedFileSizeInMB parameter this makes sense for websites, but not when caching virtual application packages. The following two parameters can be configured in the <serverRuntime> section of the file %windir%\system32\inetsrv\config\applicationHost.config (see Microsoft)

  • frequentHitThreshold: How many times should the same file be requested, before it’s cached
  • frequentHitTimePeriod: Time interval in which the same file should be requested {frequentHitThreshold} times, in order to be cached.

I’ve replaced the default value in applicationHost.config

with

As a result files are cached when it is downloaded once within a time period of one second, effectively always.

applicationHost.config

 

After changing the values you need to restart Microsoft IIS service (by executing iisreset).

 

Proof of the pudding

Now if I download the same App-V package (250Mb) twice using a browser (again) the File Cache Memory Usage is still indeed 250Mb, the file cache had one miss (the first download) and one hit (the second download).

Web Service Cache - Tuned

The Task Manager shows that the resource usage of the background process IIS Worker Process is now +- 250Mb and the Ethernet adapter still sends around 100Mbps (to the client) but no longer downloads the virtual application package from the file server.

IIS Worker Process - TunedEthernet usage - Tuned

 

 

Load balancer

If you’re load balancing your HTTP request using a load balancer you might want to consider caching the App-V sequencers there. I wrote an article about how to achieve this using a Citrix NetScaler: Citrix NetScaler: Cache Microsoft App-V sequences

 

PowerShell

Patrick Seymour (@PaScoSey) wrote a PowerShell script that configures the IIS server with the settings provided above. He provided the script to me and I’m more then happy to share it with you:  Configure-IISForApp-V.ps1.

The script performs the following actions:

Use of this script (or any setting provided in this article) is at your own risk.

 

.

Ingmar Verheij

At the time Ingmar wrote this article he worked for PepperByte as a Senior Consultant (up to May 2014). His work consisted of designing, migrating and troubleshooting Microsoft and Citrix infrastructures. He was working with technologies like Microsoft RDS, user environment management and (performance) monitoring. Ingmar is User Group leader of the Dutch Citrix User Group (DuCUG). RES Software named Ingmar RES Software Valued Professional in 2014.

More Posts - Website

Follow Me:
TwitterLinkedInGoogle Plus

Tags: , , ,

Trackback from your site.

Comments (13)

  • 26 October 2013 at 00:24 |

    What makes the SMB method unstable? Given that authentication must still happen and then SMB is probably used for the virtual directory access, I haven’t seen this being a problem in my environments. http being more flexible, yes, but more stable?

    • Tim Mangan
      26 October 2013 at 00:26 |

      But otherwise, good info on the caching part!

    • Ingmar Verheij
      26 October 2013 at 11:07 |

      Hi Tim. The SMB delivery method is not unstable, HTTP is just more scalable. I haven’t seen any stability problems due to SMB (or HTTP).

      (Although I do have a customer who’s fileserver is near its limit and becoming unstable, using HTTP I’ve prevented this.)

  • 30 October 2013 at 14:20 |

    Great blog post Ingmar, very useful information around the IIS caching settings!

  • Alex M
    23 January 2014 at 19:51 |

    Hi Ingmar, great article, thanks! Quick question – would you combine Publishing Server role with Streaming server role? For example, I have two App-V 5.0 Publishing Servers behind NetScaler and was wondering if they can serve as Streaming Servers as well. Thanks!

    • Ingmar Verheij+
      24 January 2014 at 11:03 |

      Hi Alex. Glad you like it.
      Yes I would combine the two roles on the same machine. The Publishing Server generates a little amount of load/traffic and have the same communication characterics as the Streaming Server: “all” clients connect to the same server.
      Cheers!

      • Alex M
        24 January 2014 at 21:16 |

        Thank you, Ingmar.

  • joel.dizon
    9 April 2014 at 05:58 |

    Hi Ingmar, I have a customer who would want to switch to App-V 5.0 (currently design is in 4.6). Currently I have 3 Mgmt Server behind BigIP and FS as content share. Given same number of server. Is it possible to combine all the roles (Mgmt Server, Pub Server, Reporting Server) in one server x 3 for HA? Can you point me in the right direction? Thanks.

    • 9 April 2014 at 09:40 |

      Hi Joel,

      Combining the publishing and streaming server on the same host makes sense since they’re both serving HTTP. In a large environment I wouldn’t combine them with the Management server as it serves a different purpose. The Management server is nothing more then a broker to the database (as is the reporting server). Only publishing servers (and the management console) connect to the Management server, so the load is minimal. The publishing servers can function without the Management server so your HA requirements are different.

      With more clients the load increase on the:
      – Publishing Server
      – Reporting Server (optional component!)
      Either
      a) Streaming Server (when streaming via HTTP)
      b) File server (when streaming via CIFS)

      Additionally I would recommend looking at the “App-V Scheduler” as it reduces the complexity of your App-V infrasstructure:
      http://bramwolfs.com/2014/03/31/app-v-scheduler-2-0-release/

      Cheers Ingmar

Leave a comment

*

Donate

%d bloggers like this: