Configuration Optimization in IIS 8.0

Posted: Mar 22, 2012  5 comments  

Average Rating

Tags
IIS 8.0 beta
IIS configuration
SMB
Windows Server 8 beta

Share this Post

One of the areas that we have optimized in IIS 8.0 beta is IIS configuration system.   There are many improvements that we have made in this area, but there is one simple change that has yielded a great result.   The change has not only improved the performance of IIS configuration system, but it has also helped with serving contents faster, especially when the contents are stored in a remote file server, by minimizing the "chattiness" between IIS and the file server.

So, what is this change, you may ask?

Well, to explain the change, I have to first explain the IIS configuration system a bit.   One of the complexities of IIS configuration system is that it has to merge and honor granular settings that may be scope to a site or an application.   In a nutshell, what this means is that the IIS configuration system has to look for an existence of web.config file at every URL namespace.   The IIS configuration system may or may not find the web.config, but it still has to try to open it in order to determine whether web.config exists or not.  This makes sense.   So far, so good.

However, as it turns out, IIS 7.0 and IIS 7.5 are looking for the existence of web.config where it clearly could not exist.   To demonstrate this, I have installed a WordPress on IIS 7.5 and configured it to use the contents from a remote file server.   Looking at the SMB2 communication between IIS 7.5 and the remote file server, the following is observed:

SMB2:C   CREATE (0x5), Sh(RWD), DHnQ+MxAc+QFid, File=wonyoo\wordpress\web.config@#281  
SMB2:R  - NT Status: System - Error, Code = (52) STATUS_OBJECT_NAME_NOT_FOUND  CREATE (0x5) , File=wonyoo\wordpress\web.config@#281 

So in above case, the IIS config system tried to look for web.config under \wonyoo\wordpress\ folder but did not find it.   This is fine.   However, further down, the following is observed:

SMB2:C   CREATE (0x5), Sh(RWD), DHnQ+MxAc+QFid, File=wonyoo\wordpress\index.php\web.config@#325  
SMB2:R  - NT Status: System - Error, Code = (58) STATUS_OBJECT_PATH_NOT_FOUND  CREATE (0x5) , File=wonyoo\wordpress\index.php\web.config@#325 

What do we have here?   In above example, the IIS configuration system is looking for web.config under another file, index.php, where web.config cannot possibly exist. 

And as you may have guessed by now, with IIS 8.0 beta, the IIS configuration system first checks to see if the corresponding URL namespace is a folder or a file.    If it is a folder, then we must check for the existence of web.config.  If it is a file, then we do not need to check.   Thankfully, IIS configuration has a good caching logic on IIS 7.0 and IIS 7.5, so that this inefficiency is somewhat mitigated.

Of course, above is just one simple example of the improvements that we made, but there are many more optimizations that we have done in IIS 8.0, ASP.net 4.5 and SMB 2.2 on Windows Server 8 beta.   You should try this for yourself.   Install a network monitoring tool (Microsoft Network Monitor is available for free), and compare the number of SMB packets between IIS 7.0/IIS 7.5 and a file server and IIS 8.0 and the file server.   You may be surprised.

Comments

Hello Won,

In IIS 7.0/7.5 there is a setting named allowSubDirConfig (msdn.microsoft.com/.../ms689463(v=vs.90).aspx) who controls whether or not look for web.config in every folder of file, by default this setting is true in IIS7, what about in IIS 8?

In my opinion, it's best to change it to false, in order to avoid stress in the file server. I think Microsoft should change this value to false by default, it took some time this setting was affecting a lot the performance of my web server, after upgrading my servers to IIS 8.

Regards,

Jose S. Oyervides.

Mar 23 2012 by josantia

Setting allowSubDirConfig to false, in some cases, is safe, but it breaks the configuration contract to honor web.config files.   So you will want to consider when it is appropriate to set this value to false.   By default, it is set to true, in IIS7.0 and IIS 7.5, as you've noted, and it will remain true in IIS 8.0.   The IIS configuration system is designed to be hierarchical.

Won

Mar 23 2012 by wonyoo

E,temos que gostar muito do que fazemos.

Apr 07 2012 by jose menezes dos santos

Temos que estar aptos pra fazer o que gostamos.

Apr 07 2012 by jose menezes dos santos

O nosso querer se espande quado gostamos.

Apr 07 2012 by jose menezes dos santos

Submit a Comment

  • Plain text is accepted.
  • URLs starting with http:// are converted to links.