On Warmup Scripts and HTTP Methods

So I’m rewriting our venerable GuyGarvie IIS warmup script at the moment. This script started life as a way to warm up a very big .NET application on IIS6 using a list of URLs. Guy would simply hit each URL in turn with a GET request, checking the status thereof and returning an error if a significant number returned a non-200 status.

But Guy is terribly slow. And his list of URLs is full of legacy pages, broken links, duplications and general horror. And the application he warms up has moved on.

For this reason, I’m in the throes of rewriting him, converting his URL list from XML to JSON, cleaning it up and trying to tweak his speed, maybe parallelising him a bit too. And I have called him LiamFray, for reasons explained in the footnote.

Anyway while I was tweaking for speed, I got to thinking. What if I were to issue a HEAD request instead of a GET request? Would the fact that the server doesn’t have to do a big old data transfer make things any quicker? Indeed, would .NET actually run the code in the background – which is the entire point?

Therefore, I did a little test.

I fired up a PowerShell window and typed this

And can you predict what happened?

Yep, the first iwr call returned a 500, as expected. But so did the second, implying that under the covers, IIS is executing the code. I kinda knew this was the case, but needed it confirmed before I wasted any significant time on the idea.

There’s more to do, but this is an interesting little titbit. It implies that I could at least save the transfer time when running these warmups, thus speeding things along and making life much nicer all round.

So I thought I’d post it here as a snippet, if only for my own note-taking.


 

Footnote: why is your warmup script called Guy Garvie, you idiot?

Well, way back in the mists of time a CMS vendor who shall remain nameless offered a warmup script to the place I was working at the time. This script was called “Genesis” and it was pretty damn expensive. So a colleague of mine rolled his own and called it, sensibly, Phil Collins.

Genesis -> Phil Collins. So far so good. Link established

When I came to Domain, I wanted something similar, so I re-implemented Phil with a few tweaks. I searched Google for “Who is the natural successor to Phil Collins?” and found a forum post, complete with typo, opining that Guy Garvey was in fact Phil’s inheritor.

So when it came to rewrite Guy I naturally did the same thing, asking who is the natural successor to Guy and found this post, explaining that Liam Fray had staked a claim on that very title.

So that’s why Liam is called Liam.

So the moral of this tale is: Don’t say you never get folklore at tech blogs, OK?

 

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">