How to speed up your most popular web page

What's your most popular web page?

I assume it is the default document of your web site, for example if a client requests www.mysite.com IIS would execute www.mysite.com/default.htm. Your default document list is easy to query:

C:\>%systemdrive%\inetpub\adminscripts\adsutil get w3svc\defaultdoc
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

defaultdoc                      : (STRING) "Default.asp,index.htm,index.html,iisstart.htm,default.aspx,Default.htm"

What happens for a request to www.mysite.com is actually pretty simple: 

IIS will read the default document list and check file for file if the document exists in the physical directory of your site or vdir. IIS executes the document as soon as it finds the first match. You can imagine that this is pretty expensive. In the above case, supposing default.htm is the only default document that exists in your sites root directory,  IIS would check five times until it finds default.htm. And this happens for every request!

The fixes for this problem are obvious:
1) trim down your default document list
2) put default documents that exist at the beginning of the list

Fix 2 has another huge benefit. IIS can put the first default document into the HTTP.SYS kernel-mode cache. It can stay there until IIS invalidates the cache, for example if the default document configuration changes. Kernel-mode caching is now possible because if an existing document is at the top of the list the existence of other default documents doesn't have to be checked anymore.

Stay tuned for my DefaultDocOptimizer script. I'm writing it tonight  :)

1 Comment

Comments have been disabled for this content.