Microsoft App-V 5.0 – Streaming via HTTP

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

<serverRuntime />

with

<serverRuntime frequentHitTimePeriod="00:00:01" frequentHitThreshold="1" />

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

applicationHost.config_thumb[1]

 

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

 

.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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