Friday, April 18, 2008

YSlow: New Dimension to Web Application Performance

This blog explains the 5 rules I have implemented out of 14 Rules and improved the web application performance.

By implementing below rules my pages are coming as though they in my local system.
I am thrilled with the response.
Business Analyst asked if this was the prototype html? so that shows how fast web pages are served.
Now I have been assigned to improve other use cases :)

Below are the 14 YSlow rules:
1. Make Fewer HTTP Requests
2. Use a CDN
3. Add an Expires header
4. Gzip components
5. put stylesheet at the top
6. move the scripts to bottom
7. Avoid CSS expression
8. Make JS and CSS external
9. Reduce DNS Lookup
10. Minify JS
11. Avoid Redirects
12. Remove duplicate scripts
13. Configure ETags
14. Make Ajax cacheable

I have implemented 5 rules for the phase I in my module i,e
3. Add an Expires header :
Added the header as below :
int seconds=432000;
long now=System.getCurrentSystemMillis();
response.setDateHeader("Expires",now+seconds);
response.addHeader("Cache-Control","max-age=3600");

5. Put stylesheet at the top
6. Move the scripts to botton

10. Minify JS
Minify JS and HTML. Removed white spaces using the simple editor.

12. Remove duplicate scripts
Remove duplicate and unnecessary scripts,html.
Lot of times unnecessary/duplicate html and scripts may not show in jsps.
Specially with dynamic content in loops of jsp.
But look at when it turns to html you can see how much content it generates and some of the content from the loops can be removed or move out of the loops.

Conclusion : YSlow has definitely a new way of improving the performance of web applications at client side ,extending to the best practices of Server side.

More details in the video by Steve Souders


Which rule did you implement????

No comments: