YSlow and ASP.NET: 100 points "A" grade year 2012

Almost three years ago I wrote an original YSlow and ASP.NET: 100 points "A" grade is possible article. Since then I changed couple hosting providers, made numerous updates and converted my blog project to .NET 4.0. Today I decided to revise my blog to see if it still has 100 yslow points with final "A" grade.

First surprise, as of January 29, 2012, YSlow addon doesn't work in FireFox 9. However YSlow is now available for Google Chrome, Opera, Safari. It has bookmarket version and even command line version. I installed Google Chrome Yslow extension and began investigation. Right out of the box most of sections still had A grade. About a week ago I switched from Google App Engine "CDN" to true CDN Amazon CloudFront. Some files were not in CDN, so I had to take care of those. In general I highly recommend Amazon CloudFront. It is easy to setup and cost just a few bucks a month based on your traffic usage. Amazon CloudFront mimics your local file settings, so you need to make sure that you have compression, expire header and Etags taken care of. I use IIS7 compression instead of a compression module recommended by me in my previous article. Out of the box IIS7 compression doesn't work with AWS CloudFront, so you need to modify C:\Windows\System32\inetsrv\config\applicationHost.config file on your server to include following:

<serverRuntime enabled="true" frequentHitThreshold="1" frequentHitTimePeriod="00:00:20"/>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" noCompressionForHttp10="False" noCompressionForProxies="False">
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
  <dynamicTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </dynamicTypes>
  <staticTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </staticTypes>
</httpCompression>

 

Also I modified my cache module to have ETags clean up:

public void Init(HttpApplication context)
{   
    ...                 
    context.PostReleaseRequestState += new EventHandler(application_PostReleaseRequestState);
}
 
void application_PostReleaseRequestState(object sender, EventArgs e)
{
    HttpContext.Current.Response.Headers.Remove("Server");
    HttpContext.Current.Response.Headers.Remove("X-AspNet-Version");
    HttpContext.Current.Response.Headers.Remove("ETag");
}

 

YSlow added new section "Use Cookie-free Domains". My blog completely failed this one, since google analytics left cookies in top level karpach.com domain. I modified google analytics init script to have: _gaq.push(['_setDomainName', 'www.karpach.com']), so google cookies set for www.karpach.com instead of top level karpach.com. Then subdomain cdn.karpach.com, which points to Amazon CloudFront, became cookieless. Finally I am back to 100 YSlow points. Run Yslow on no externals version of karpach.com to see it yourself.


Posted on Sunday, January 29, 2012 by | Add Comment

New Comment

Your Name:
Email (for internal use only):
Comment:
 
Code above:

Categories

Recent Tweets

  • Simon Ince's Blog: Hierarchies with HierarchyID in SQL 2008 http://t.co/xSDwiF6rRS.
  • Visual Studio 2010 WAS painfully slow - CodeProject http://t.co/Usba1x6CZy

Valid HTML5