Yahoo posted a list of rules for improving the performance of your web site, along with a new FireFox-based tool for diagnosing your site’s performance, called YSlow.
Their number one rule is to reduce the number of HTTP requests, and this only makes sense. I’ll bet most of us ASP.NET developers are well aware of output caching, and how to do this in code. But what about those static files, like images and scripts? Well, there is an IIS setting for that. It’s easy to do, and the payoff can be big if you have a very graphic-intense site. Here’s what you do for IIS 6:
- Open the IIS Management console
- Find the directory containing your images (static content only)
- Right click the directory, and choose Properties.
- Click the HTTP Headers tab.
- Check the Enable Content Expiration check box.
- Click the Expire After radio button, and choose an interval.
- Click the OK button. Done!
The downside is that you won’t get the payoff for the first time a user visits the site, but other pages using the same resources will be much snappier. Be aware that caching dynamically created content this way can cause some strange issues, so take care as to what you cache. As always, test it well before you release it and you will be rewarded.