Keep website and webservices warm with zero coding

If you want to keep your websites or webservices warm and save user from seeing the long warm up time after an application pool recycle, or IIS restart or new code deployment or even windows restart, you can use the tinyget command line tool, that comes with IIS Resource Kit, to hit the site and services and keep them warm. Here’s how:

First get tinyget from here. Download and install the IIS 6.0 Resource Kit on some PC. Then copy the tinyget.exe from “C:Program Files (x86)IIS ResourcesTinyGet” to the server where your IIS 6.0 or IIS 7 is running.

Then create a batch file that will hit the pages and webservices. Something like this:

SET TINYGET=C:Program Files (x86)IIS ResourcesTinyGettinyget.exe

"%TINYGET%" -srv:dropthings.omaralzabir.com -uri:http://dropthings.omaralzabir.com/ -status:200
"%TINYGET%" -srv:dropthings.omaralzabir.com -uri:http://dropthings.omaralzabir.com/WidgetService.asmx?WSDL - status:200

Save this in a batch file and run it as a scheduled task at some interval like 10 minutes and your website will always remain nice and warm.

First I am hitting the homepage to keep the webpage warm. Then I am hitting the webservice URL with ?WSDL parameter, which allows ASP.NET to compile the service if not already compiled and walk through all the operations and reflect on them and thus loading all related DLLs into memory and reducing the warmup time when hit.

Tinyget gets the servers name or IP in the –srv parameter and then the actual URI in the –uri. I have specified what’s the HTTP response code to expect in –status parameter. It ensures the site is alive and is returning http 200 code.

Besides just warming up a site, you can do some load test on the site. Tinyget can run in multiple threads and run loops to hit some URL. You can literally blow up a site with commands like this:

"%TINYGET%" -threads:30 -loop:100 -srv:google.com -uri:http://www.google.com/ -status:200

 

Tinyget is also pretty useful to run automated tests. You can record http posts in a text file and then use it to make http posts to some page. Then you can put matching clause to check for certain string in the output to ensure the correct response is given. Thus with some simple command line commands, you can warm up, do some transactions, validate the site is giving off correct response as well as run a load test to ensure the server performing well. Very cheap way to get a lot done.

 

9 thoughts on “Keep website and webservices warm with zero coding”

  1. Of course, IIS 7.1 with Windows Server 2008 R2 comes with a new feature in web.config to keep apps alive without needing this – you should mention that.

    Thanks,

    Dave

  2. Hi Omar,

    No, it will actually bring the site alive automatically. In other words after an app pool recycle, IIS restart or windows restart it will immediately load your app without a need to hit a page first. Check out ScottGU’s blog:
    http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx

    The main limitation is it does not only require .NET 4, but also IIS 7.5 and thus Windows Server 2008 R2 x64 bit.

    Because I am still on 32 bit, I am using a similar solution to what you presented in your blog, but using wget with a scheduled task. However I cannot wait to move to R2 as we will no longer need these types of ‘hacks’. Again – see Scott’s blog for more details. This is a really nice feature of R2 I cannot wait to use when I next upgrade our servers.

    Regards,

    David

  3. Tinyget can run in multiple threads and run loops to hit some URL,can it run a test on parellel hits/intercurrent hits? if not, could you list some tools to test the performance after parellel /intercurrent requests?

Leave a Reply to Green Cancel reply