Kieran Jacobsen

Kieran Jacobsen

He/Him. Microsoft MVP and GitKraken Ambassador. 🌏 Poshsecurity.com. 🏳‍🌈 Gay. 🐱 Cat owner.

Web Application Warming

Original Issue: Web application is a bit unstable, restarting IIS seems to resolve issues for a few days.

Solution to original issue: Powershell script to restart application components including IIS in early hours of morning.

... A few weeks go by ...Users happy that application is significantly more stable during the day, however a small group of users complain about the performance of the application. Why is the performance suddenly dropping for those users?

First look at users issues: These users are always the first in the office, some appear not to sleep and decide to go to work at very early hours.

Root Cause: Now that we are restarting IIS, ASP.NET is recompiling the dynamic code when it is accessed for the first time, thus causing performance issues for first user hitting each part of the web site.

Solution 1: Use the Microsoft Web Application Warm up tool

Problem with Solution 1: Microsoft pulled the tool from their site

Solution 2: Write a script to handle this issue!

 

Writing a script for this solution was pretty easy:

  1. Get listing of all web pages which form application, put in file of format:
    index.aspx
    contact/contact_us.aspx

    The reason to do this is the application resides in multiple SDLC environments with different base URLs but the same relative paths
  2. Put the list from step 1 into a file
  3. Get the wget.exe from the gnuwin32 project. Why this and not the .net framework? Simply, put, from my experience the wget.exe was better at forcing all of the content to be loaded correctly in a manner a browser would. Go here for more info on the gnuwin32 project http://gnuwin32.sourceforge.net
  4. Based on the usual template:

Physical Disks, SMART and PowerShell

Testing Ports are up