Speeding Up Tekpub with Sam Saffron
- Monday, July 02, 2012
Just pushed the latest drop for Tekpub - Speed: ASP.NET MVC Edition with Sam Saffron. I had a lot of fun doing this production and it's made a massive impact on our site.
Long story short: like many, I put off "optimizations" to Tekpub as I focused on other things. It's easy to not pay attention to these things - the mantra usually being something like "is anyone complaining? Then it's not a problem I need to fix right now".
That's sort of true... sort of not. As Kenobi says:
you will find that many of the truths we cling to depend greatly on our own point of view
Is there a problem if no one's complaining? Sherice Jacob (writing for KissMetrics) says YES:
According to surveys done by Akamai and Gomez.com, nearly half of web users expect a site to load in 2 seconds or less, and they tend to abandon a site that isn’t loaded within 3 seconds. 79% of web shoppers who have trouble with web site performance say they won’t return to the site to buy again and around 44% of them would tell a friend if they had a poor experience shopping online.
So, from this "certain point of view" Tekpub.com's 6 second initial page load was indeed a very big problem. Return visitors faced a 4 second load!
That's a problem.
The time had come to fix this mess, so I called one person who knows a lot about this kind of thing, and has been living/breathing it on a daily basis at StackOverflow: Sam Saffron (Sam recently left StackOverflow to eat more waffles).
I figured the first thing we would do is look at how I was (mis)using ActiveRecord, or how I could improve various routines in my app's Ruby code - but that's not at all what happened.
Sam's entire focus was on Page Load (or responsiveness). Once we fixed that, the site became much, much faster.
Of course, I recorded all of it. Including my utter humilation at being a dope.
Rails or ASP.NET MVC?
I wanted to focus this production on ASP.NET MVC. Tekpub.com runs on Rails (we'll do a Rails edition of all this soon) so ... what were we to do?
My goal is to commit the changes back to the project. It's put out under MS-Pl, so we'll see if some of this effort works its way back in.
You Should Know This Stuff
By the time we finished I was amazed at 1) how simple it all was and 2) just how lame I was for never doing any of the things I did (concatenation/minification, CDNs, Image Optimization, Script Load Audit, etc). I know you know these things - I knew these thigs!
But for some reason I never did it. Maybe because I didn't understand the impact it has on my users.
Now I do - and hopefully so will you. I hope you enjoy it.