Using IIS Warm-Up module to Load SSO & Configuration data

When the host instances/IIS is restarted or the application pools are recycled all the pre-loading execution is done on the first hit due to which the first hit of the web service can be really slow. Already in the BizTalk environment if the Host Instances are restarted/IIS Reset the first service hit is very slow.

Now you can leverage with the capabilities of ISS Warm Up module to run a pre-loading script. You can put all the code which is required to run your services. The loading of the SSO & configuration data into Windows AppFabric Cache can be a good candidate to get the benefit from IIS Warm Up module.

Let’s see what it has to offer and how it works.

Advantages:

1- With the IIS Application Warm-Up module, initialization occurs before the IIS application pool informs the WAS that it is ready to receive requests from the network. This means that even when the first request comes in the Warm Up module would have started executing.

2- During application pool recycling, the worker process that is shutting down continues to process requests until the new worker process has finished the warm-up stage and reported to the WAS that it is ready to receive requests. The WAS then shuts down the old worker process.

Installing the IIS Warm Up module:

You can download the IIS Module from here. Download the package and run it. Open the IIS manager and in any of the site/applications feature tab you will be able to see the Application Warm-Up.

Create, deploy and configure the Warm Up application:

I had to call two functions that Load all the SSO data and the Configuration data from a Sharepoint List into WAF Cache. I created a new ASP.NET project (WarmUpApp) and add the reference to the assembly containing the preloading methods and called them in the Page_Load event.

Deployed the application to the site in which my other WCF/BizTalk Orchestrations exposes as WCF services are running. Since my site and all the applications running under it run under the same application pool I will have the application deployed in this site.

Next create the application in the IIS.

After deploying the application it should be configured to be called from the warm up module when the Application Pool recycles/IIS resets.

1- Go to the application and in the features tab double-click the Application Warm-Up module.

2- Right Click the page and click Add Request or in the actions tab click Add Request.

3- Add the application URL relative to the application root. The page is on the root of application “WarmUpApp” so I will give the page path “/WarmUp.aspx”. Leave the status codes and the Request context parameter as it is.

Status code(s). You can define status code(s) that you expect in the response. If the response is outside the defined range, the IIS Application Warm-Up module logs this in the Application Eventlog and continues with the next request.

Request context parameter. You can define a string that will be added to the request as server variable; this lets you check for this request variable in your application code, which in turn lets you distinguish requests that were sent from the Warm-Up module from regular requests.

Request send mode. You can send requests either synchronously or asynchronously. The Warm-Up module processes requests by first sending all asynchronous requests (using separate threads) and then sending synchronous requests. The Warm-Up module waits for the responses from each synchronous request before it sends the next request. The Warm-Up module then waits for responses from outstanding asynchronous requests before returning control to the server.

Next Right click the request and click settings or Click settings from the actions pane. Click on the checkboxes Enable Application Warm-Up and Start Application pool “X” when the service restarts options. You will be able to see the applications that are running under this application pool.

That’s what is needed to deploy & configure the module for IIS Warm-UP module. I have put some logging in the Event Log to see when I manually recycle the application pool or run the iisreset command the warm up module is executed successfully.

I restarted the cluster to empty the cache contents and after resetting run the Get-CacheStatistics command to see if the script populated the cache successfully.

How does it help in the BizTalk Middleware scenario?

The orchestrations in BizTalk which are exposed as a WCF Service and the WCF services will benefit from the IIS Warm-Up module. When the application pool recycles/ IIS Resets the IIS Warm-Up module will run my “Storing SSO & Configuration data into WAF Cache” module. As I have mentioned in my previous post that by using WAF Cache it has no effect of restarting the host instances or even resetting the IIS. When the Distributed cache service is restarted the cache is cleared during that the services will retrieve data from the sources and will be populating the cache. Thus, a performance hit. In that situation recycling the pool manually or if the recycling interval is about to elapse the warm-up module will re-populate the cache.

Restarting the cache cluster manually would be rare but the cache is based on TTL (Time To Live) and will be expired after some time. I would use the warm-up module to re-populate the cache after it is expired. Therefore I will keep the TTL value (in seconds) in the cache configuration equal to the Application pool recycling interval (in minutes).

I still have to test this on UAT and measure the statistics but theoretically and ideally when the first service request comes in my SSO and Configuration data will already be in the cache so with WAF Caching and this Warm-Up module my applications will find their keys from the cache.

In my required scenario the administrators were asking that if the credentials changed/added in SSO or Sharepoint configuration list they would stop IIS and receive locations update SSO/Sharepoint List and start IIS. In this situation the cache would be re-populated in the WAF Cache Cluster.

You can feel free to put in any pre-configuration data in the warm up module and avoid them being loaded when the first hit comes in.

I have seen that and they have mentioned that it will come with some enhancements. I didn’t face any problems and we are using it on production although it was very simple. After installation it would show a feature of Warm-Up script in IIS and give a dialog to configure a URL (Warm up script), which would execute on IIS reset and App Pool Recycle.