ASP.NET Google SPDY Tweaks
Google recently introduced the SPDY initiative where they are working toward making the web twice as fast.
If you have a public facing web site that is commercial in nature, speed has always been a factor that will drive sales, sign-ups, etc. But we very rarely pay any attention to this, even though the solutions are relatively simple.
Now that Google is on a quest for a faster web, they have a number of ways they can achieve this. One of those is by telling us that they will give bonus points to sites that are fast. And that’s exactly what they’ve done.
While page title, relevant content, and links to a page will still be the primary components of search engine ranking, it won’t hurt to make your pages load as fast as they can. So what can we do as programmers to make our sites faster?
Use the Page Cache directive
This is probably the easiest “fix” to site speed that you can implement. If your page is essentially a static page, or at least “static” for several hours at a time, use the cache directive to prevent it from re-computing every time it is requested.
Cache your User Controls
You are using User Controls on your site, right? Did you know you could put the output cache directive in the User Control too? So maybe all your pages really are dynamic at some place. But I bet a significant number of your user controls are pretty static. Cache them.
Cache your data
Did you know that you don’t need to retrieve your data from your data store every time you render the page? The ObjectDataSource has several properties that control this: EnableCaching, CacheDuration, CacheExpirationPolicy, and CacheKeyDependency. Check it out.
Consider Using the Substitution Control
If you only have one small part of your page that is changing, you could cache the entire page and use the substitution control to fill in the section that needs to change every time the page is loaded.
Reduce the number of files any one page needs.
While having a lot of little CSS files makes the project easier to manage, the down side is that loading 4 different CSS files on one page will make the page load more slowly. I generally try to have one site-wide CSS file and, if necessary, one page-specific CSS file. No more.
Don’t go crazy with the graphics
Turn on static file compression.
Go into IIS and make sure that it is set to compress all of your static files.
Be intelligent about ViewState
I know a lot of people are saying “just turn the darn thing off.” But that’s not the solution. It may in fact make more sense to use ViewState than to make another trip to the database. There is also the problem of caching stuff you have no reason to cache. Did you know that 99% of the time a TextBox and a Label control’s cache will have absolutely no impact on the functionality of your code? Yet they will use up space. Know why you are using ViewState if you are using it at all and I bet your page size will shrink quite a bit.
I’m sure there are other things you could do, but if you just start with this list you’ll be well on your way to a well optimized site.
Other post in Seach Engine Optimization
- Programming SEO – Tags and Keywords - May 28th, 2009
- Programming SEO – Cross Linking - June 3rd, 2009
- Google NOFOLLOW Change (and why this isn’t news) - July 16th, 2009
- Programming SEO – Cross Linking Titles - August 13th, 2009
- ASP.NET Google SPDY Tweaks - November 17th, 2009