Hosting Tutorial & Guide

ASP.NET Web Hosting Performance Tuning

updated on Oct 13, 2016
ASP.NET Web Hosting Performance Tuning Google claims that their goal is to help users find most relevant web content with a great user experience. They think the fast websites not only significantly increase user satisfaction but also improve the overall quality of the web. Many people consider the good architecture, optimized algorithm, the fast network and powerful web server are the key factors of an ASP.NET website performance. But there is one important factor missed by most of them. It's very easy to implement but it can effectively improve your website performance.

It's IIS optimization. Before Windows 2008, the users nearly cannot control anything about the web server in shared web hosting. As IIS 7.0 integrated with Windows 2008, we can easily improve the ASP.NET websites by web.config. The tutorial as below introduces how to performance tuning your ASP.NET websites hosted in IIS 7.0 step by step.

3 months after your website been indexed by Google, you can see the performance overview of your website considered by Google in Google webmaster tool, under Labs\Site Performance. If you're told that the website is slower than XX percent of sites in the Internet, it's the time for you to optimize the performance. This may increase your Google ranking significantly in a short time.

At first, you should download Page Speed which is an extension to Chrome can help you analyze the website performance bottleneck. After your run page speed analysis, Page Speed displays the list of detected performance issues with best practices sorted by importance or priority for this page. If the page speed score is less than 80, it indicates there is a large space for your to improve on your website.

Typically, there are three major issues, Compression, Enable Keep-Alive, and Leverage browser caching as the above screenshot.
  • Enable Compression, usually enable GZIP compression can reduce the transfer size by up to 1 mega bytes. For the sample website in the screenshot, it can save by 674KB (78% reduction) for only JS and CSS files. You only need to edit your web.config file and find <system.webServer /> section to enable GZIP compression for both dynamic and static content.
  <urlCompression doDynamicCompression="true" doStaticCompression="true" />
  <httpCompression dynamicCompressionEnableCpuUsage="80" />
    <remove fileExtension=".js" />
    <mimeMap fileExtension=".js" mimeType="text/javascript" />
  • Enable Keep-Alive can significantly save round trip time (RTT) for a client to send requests and the server to send responses over the network. And it can also minimize DNS lookups and avoid bad requests. For more information about why to enable keep alive, please read the introduction from google here. You can simply enable it by the following code snippet in web.config.
  <httpProtocol allowKeepAlive="true" />
  • Leverage browser caching, by default, the expiration of static content cache of ASP.NET websites is not specified. As suggested by Google, it's better to set the expiration to be one week at least. It can maximum instruct the browser to load previously downloaded resources from local disk rather than over the network. Add the following code snippet in the web.config,
      <add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
      <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
      <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
      <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
      <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" />
    <clientCache cacheControlMaxAge="7.00:00:00" />
After the above 3 steps in minutes, I have improved the score from 42 to 82/100 and save 820KB per request. Now there is only one high priority task "Combine images into CSS sprites". As it needs more development works but cannot contribute the significant improvement as another three, I think it's an optional work. From my truly experience by following these three actions, my website has been grown from "faster than 51% websites" to be "faster than 61% websites".

If you're looking for an ASP.NET web hosting, I recommend top web hosts based on Windows 2008 and SQL Server 2008 for you as following,
  1. Host4ASP.NET - their ASP.NET web hosting plan provides rich features and the latest technologies. There are sufficient SQL Server databases, disk storage and bandwidth. Their ASP.NET Trust Level is full trust which provides you the best flexibility to run your websites. It's only pricing at $2.95/month because they're offering a special discount for those going from BestHostingSearch. Read Host4ASP.NET review and discount.
  2. Hostgator has very good reputation in web hosting industry especially in North America. Their technical support, customer service, and web host reliability are indisputable. The ASP.NET Trust Level there is Medium which provides you with a balance between flexibility and web hosting security. Their starting plan is pricing at $4.16/month without free domain and only limiting 1 hosting domain. It's more expensive than Host4ASP.NET but it's your choice if you're more sensitive on the brand, customer service and performance. Read more about Hostgator Windows Web Hosting.