YSlow, it's like a Scantron machine for web pages

Posted 8 years ago by Jim Ciallella

YSlow Add-on Example
Example of the YSlow Add-on

What we have here is an overview of the YSlow performance tool and some website performance best practices.

Executive Summary

The YSlow FireFox Add-on provides a performance scorecard and details about the components and load times for web pages. OC runs YSlow checks against our projects because it gives a quick overview of how the site is performing and an easy way to understand what needs to be improved.

The YSlow's Help page already beat me too explaining why these are best practices. However, in some cases the "how to fix it" or "why'd I get an F" is generic or absent. This post covers some practical insights and lays the groundwork for future performance related posts.

The Circuitry

The YSlow add-on analyzes 13 performance rules and spits out a letter grade for each factor, plus an overall page score. Most of the rules are aimed at reducing the number, size, or time of transfers between the server and browser.

The goal should be to score A's or B's. Yahoo's help site explains each of the rules in some detail, plus additional best practices, for a total of 34 performance measures in 7 categories.

In my experience, the CDN is an expected "F" because it's neither free nor necessary in most cases. The rules for duplicate scripts, avoid redirects, CSS expression, and DNS lookups are usually easy A's.

The position of CSS and Javascript within the page should be pretty simple A's and Yahoo provides some good guidance on minifying CSS and JS files to remove unnecessary white space.

Reducing the number of CSS file transfers isn't always a snap when you're using modular code. Enter CSS aggregation, which isn't explicitly mentioned, but is built into some CMSs like Drupal.

The low-hanging fruit on the web server side include Gzip, expires headers, and Etags. These can be set by adding appropriate directives into the web server's configuration files. I intend to provide samples and guidance on this in the future.

Of course, there will be instances where pages require a lot of file transfers and cause a noticeable lower score. Remember, YSlow is just a guide. The important thing is to at least understand the best practices and know when/why rules are passed or violated.

7 Comments

Tom Sherman ~ 8 years ago

Having engaged in a lot of work at, uh, work to improve our performance, I can say that the YSlow recommendation to put all javascripts before </body> should not be followed slavishly, as it can lead to errors for functions/objects not created, especially in IE6.

Overall, a very useful tool, but not perfect.

Sean Gaffney ~ 8 years ago

Congrats on the breaking the double-digit entry barrier, Jim.

P.S. - why doesn't OC4 remember my comment posting credentials?

Jim Ciallella ~ 8 years ago

Not sure. I'm not 100% if it's using cookies to store that info for the forms or not, since I'm always logged in. Plus, most browsers would/should cache form values via auto-fill even if not set via cookies. I think the cookies default to expire in two weeks, so that might also be an issue.

I'll add to the to-do list to take a look. Thanks. Jim

Jim Ciallella ~ 8 years ago

We've loaded the Comment Info module for Drupal 5. It should do the trick for remembering your anonymous commenting name and email. This comment remembering functionality made it into the core of Drupal 6.

Sean Gaffney ~ 8 years ago

Thanks Jim!

Although I hope you didn't spend your 4th of July fixing this... I'll feel terrible.

Daniel Martin ~ 7 years ago

Has anyone used Google's `Page Speed'? How do you think it compares to YSlow?

~ 7 years ago

Daniel, I just learned about Google Page Speed last night via the O'Reilly Radar RSS.

I installed the Firefox 3 / Firebug extension and tested against the OrangeCoat site. It seems to do some more in depth analysis in certain areas. In particular, I it's grading the quality of the CSS on a per rule basis. I'll have to talk to our front-end guys about some of it's "very-inefficient" findings.

For reservations, call office(800) 890-1702. Send fan mail to our work location at 101 N Main Street, Third Floor, Greenville, SC 29601 USA 34.850823 -82.398746
Lovingly crafted by orangecoat with some rights reserved, and a promise not to spam you.

Back to top