YSlow performance challenge

by Mads Kristensen 7. August 2007 05:27

Yesterday, Simone wrote a post about the YSlow Firebug extension where he listed different websites and their YSlow performance ranking. My website was one of the sites he compared and as you can see from his list, it didn’t do all that well with a score of 52. It was actually 56, but I think he made a typo. There was only one thing to do and that was to do everything I could to improve my rank. I’m competitive, what can I say?

It really doesn’t make sense to be competitive with this, because YSlow suggest things that makes no sense for a regular website or blog, but I’ve managed to ignore common sense before so this was up my ally.

The work

Some of the things YSlow mentioned was the missing expire header on the WebResource.axd. I quickly wrote that into my HTTP compression module. Also, the CSS file needed HTTP compression, so I added that to the CSS HttpHandler I use. Then I improved the use of the ETag header as well along with optimizing the number of HTTP requests on the page.

After fiddling for a long time with compressing the WebResource.axd handler I gave up. I’m not sure it can be done in a simple manor, but if I find out it will be the first thing I’ll add as well.

The reward

The result was pleasant. I went from a ranking of 56 to 71. That’s an improvement of 27%. If you look at Simone’s list you’ll see that I now rank second just after Google and thereby beating the rest of the sites on the list. Ohh, I love the smell of victory in the morning (it is actually 11pm but it doesn’t have the same ring to it).

The challenge

Since Simone also wrote a list of the various blog platforms and their ranking, in which BlogEngine.NET was near the bottom based on my site alone, I have decided to take off my gloves and challenge him to a friendly duel. Since the fixes I did will benefit all BlogEngine.NET users, I want the good name of BlogEngine.NET redeemed. It is actually now at the very top of his list beating the competition (if one such exists in the open source world?).

So, Simone, consider you challenged to beat my YSlow ranking of 71. I used 4 hours on my fixes, including hitting a dead end on WebResource.axd compression, so I think it is fair that you cannot use more time than that either - a gentleman agreement. And remember that you also represent SubText since you are on the dev team. Good luck.

UPDATE: Simone just accepted my challenge. Check out the comments.

* Only $4.95/month ASP.NET & Windows 2008 + IIS 7 Hosting! FREE SQL Included

Tags: ,

BlogEngine | Client-side | ASP.NET

Comments

8/7/2007 6:26:30 AM #

Phil Scott

I downloaded your recent changes you pushed up to the codeplex site and got a 91 for the weblog I set up internally for our developers using BlogEngine.Net. It complained about the ETags and Expires header with image.axd so fixed up ImageHandler.cs and this bumped me up to a 95. Not too shabby. I did disable things like commenting and the such, so this probably helps out a bit with performance. Right now I'm looking at A's in everything but "Use a CDN" (not going to happen for obvious reasons), and the Gzipping WebResource.axd

Compressioning WebResource.axd is a pain. We are using Ben Lowery's compression code for our control panel, and I ran into a world of hurt when 2.0 was published. It took me far too long to figure out that WebResource.axd just doesn't like to be compressed. It seems Rich Crane found the solution (blogs.msdn.com/.../542872.aspx) but his gotdotnet site looks to be dead.

Phil Scott United States |

8/7/2007 6:30:39 AM #

Mads Kristensen

That's awesome Phil. I totally forgot about the image.axd. I'll take care of correcting it tomorrow. I've looked at Rich Crane's solution, but it is way to complex for my taste. Simplicity or not at all Smile

Mads Kristensen Denmark |

8/7/2007 10:30:45 AM #

Haacked

Simone, just steal his code since it's open source. ;)

Haacked United States |

8/7/2007 2:30:52 PM #

Mads Kristensen

Of course, it's what developers do so feel free Simone Smile

Mads Kristensen Denmark |

8/7/2007 10:54:08 PM #

Simon Philp

Is it just me or in I.E 6 css just doesn't exist on Mads site?  FF looks ok though Smile

Simon Philp United Kingdom |

8/7/2007 11:05:23 PM #

Dotnetshadow

Hi there,

Firstly as for the Richard Crane compression library, I have this if anyone wants it I managed to download it before gotdotnet went away. Basically works well just gotta disable a few things when using with asp.net ajax can't use their internal compression tag in web.config since this library compresses everything.

Secondly I noticed you guys know how to fix the etags? Can you please explain how you did that? Is it an IIS thing or do you have to do something in code?

Regards Dotnetshadow

Dotnetshadow Australia |

8/7/2007 11:25:52 PM #

Simone

It's unfair to challenge me while I'm on flight.. not London Heathrow...
2 hour of delay, missed my plane, have to wait till tonite at 22

Simone Italy |

8/7/2007 11:28:13 PM #

Simone

And furthermore, my blog uses Feedburner, so I've 10 external JS that I cannot touch...
I'll try removing them just for the purpose of this challenge Smile

Simone Italy |

8/7/2007 11:32:25 PM #

Mads Kristensen

Simone, you're a sport accepting the challenge. Just for the fun of it and we probably learn something both of us. Good luck

Mads Kristensen Denmark |

8/7/2007 11:41:22 PM #

Mads Kristensen

DotNetShadow, I also have Richard Cranes project. I found it somewhere on the web, but don't remember where.

Regarding the ETags; you can't change the ETags on file types the IIS doesn't map to the ASP.NET ISAPI filter. All my images is using the wrong ETag according to YSlow and there is nothing I can do about it because my site is hosted - I don't have access to the IIS.

The .js and .css files I run through an HttpHandler which I can control, so that's no problem. For all the files you can control, you can access the ETag like so:

Response.Cache.SetEtag( "some value" )

Mads Kristensen Denmark |

8/8/2007 3:20:48 AM #

Michael Schwarz

Well, what you could do is run all images over an ASHX HttpHandler like you are doing with .js and .css.

Michael

Michael Schwarz Germany |

8/8/2007 3:25:06 AM #

Mads Kristensen

I could, but that would just be adding overhead to the server for no sensible reason.

Mads Kristensen Denmark |

8/8/2007 3:29:55 AM #

Michael Schwarz

Yes, of course. But why are you using ETag only for .js and .css?

Michael Schwarz Germany |

8/8/2007 3:36:17 AM #

Mads Kristensen

Actually I'm not. The YSlow recommends using the Expires header instead of the ETag for various reasons. I've thought about adding an Expires header to the aspx pages as well, because that would greatly improve performance, but there are some caveats. The recent comments and other widgets will not be updated.

Mads Kristensen Denmark |

8/8/2007 4:49:46 PM #

DotnetShadow

Thanks for the infor Mads, I understand how you set the ETag for js and css, but if you did have access to an IIS how would you do it? I ask because I'm developing on windows xp pro with IIS 5.1 and I can't find anything that relates to Etag hence my confusion how this could be setup on IIS

Regards DotnetShadow

DotnetShadow Australia |

8/8/2007 4:52:26 PM #

DotnetShadow

Also just as a sidenote which I forgot to mention, I can't seem to download your samples within firefox, it opens an IE window and just displays the file rather than saving the file? The other thing is some of the links for example to httphandler don't exist anymore referring to: madskristensen.dk/.../...42-a198-6adc2a24a4d3.aspx etc?

Thanks once again
Regards DotnetShadow

DotnetShadow Australia |

8/8/2007 4:58:56 PM #

Mads Kristensen

I've closed my old blog so the link you are looking for no longer exists. I haven't had the time to update all my links, but I will. What file do you wan't to download?

You can find some info about the ETag in IIS here developer.yahoo.com/performance/rules.html#etags

Mads Kristensen Denmark |

8/8/2007 5:36:17 PM #

Leigh

DotnetShadow: I've been looking for Richard Crane's compression module since GotDotNet went down. Is there any chance you could email it to me or upload it somewhere?

Leigh United Kingdom |

8/8/2007 11:19:54 PM #

Simone

Here I'm, after 15hours of sleep to recover from the JetLag Smile
When I finish all the laundry and cleaning stuff I'll try to improve the results a bit (anyway I got a 67, not 71 on your homepage Wink)

Simone Italy |

8/9/2007 12:09:56 AM #

Mads Kristensen

The YSlow extension just got updated today, and after I installed it I saw that I went down from 71 to 69. I've fixed it and now I'm back up at 71. I think you use an old beta version if you see 67 Smile

Mads Kristensen Denmark |

8/9/2007 6:19:17 AM #

Leigh

I get 67 here too (with YSlow 0.7.1).

Leigh United Kingdom |

8/9/2007 6:23:15 AM #

Mads Kristensen

Leigh, it seems that you have some problems with your YSlow installation just like Simone Smile

Mads Kristensen Denmark |

8/9/2007 7:23:40 PM #

DotnetShadow

Hi there,

Leigh: I got the code not sure how I can email it to you? I can't find your email address?

Mads: I looked at the link and although it talks about how you can remove an eTAg the link that it links too actually doesn't tell you how to do this. Basically I just need to know if it's a setting in IIS or what you have to do to make the eTag get removed or changed? I know I can expire content does that mean it modifies the ETag automatically, I'm a bit confused.

Also I wanted to see how your httphandler was for .js and .css that's why I tried to open the link to the old blog.

Regards DotnetShadow

DotnetShadow Australia |

8/9/2007 7:26:56 PM #

DotnetShadow

Mads: I also forgot to mention I found code for IIS that can remove an ETag not sure if this helps
blogs.msdn.com/.../543176.aspx

Basically I thought if there is no setting in IIS to control ETags since I haven't been able to find this yet, then at least I could remove them?

Regards DotnetShadow

DotnetShadow Australia |

8/16/2007 3:26:18 AM #

trackback

Trackback from CodeClimber

Dissecting YSlow

CodeClimber |

8/24/2007 8:15:22 PM #

Miron

Hi Mads,
I'm big fun of you! The BlogEngine.NET is awesome!
Two questions,
First, I wonder, if there is any reason why you are not compressing javascript files ?
Second, about the BlogEngine.NET. Will Owners of BlogEngine.NET version 1.1 be able
to upgrade it easily to new versions?
Thanks,
Miron

Miron Israel |

8/24/2007 8:37:53 PM #

Mads Kristensen

The Javascript files are served by the webresource.axd handler and I haven't yet been able to compress it. To upgrade the 1.1 version to the new one is very simple. No worries.

Mads Kristensen Denmark |

9/5/2007 12:08:56 PM #

Miron

Hi,
Fill free to try my compressor to compress WebResource.axd files and increase your
score in YSlow  Wink
Good luck in the challenged !
http://www.mironabramson.com/blog/

Miron United States |

Comments are closed

About the slave

Mads Kristensen Mads Kristensen
Web developer at ZYB and founder of BlogEngine.NET. More...

LinkedIn ZYB Facebook Last.fm Twitter View Mads Kristensen's profile on Technorati

The Lounge

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008