The original address: http://www.codinghorror.com/blog/2007/08/yslow-yahoos-problems-are-not-your-problems.html
Yslow: Yahoo's problems are not your problems
I first saw Yahoo's 13 simple rules for speeding up your web site referenced in a post on rich skrenta's blog in May. it looks like there were originally 14 Rules; one must have fallen off the list somewhere along the way.
For the first time, I saw 13 simple rules of Yahoo! To speed up your website in January May after referencing the rich blog of skrenta. It looks like there are 14 Rules, and there must be a list somewhere along the way.
- Few HTTP requests
- Use content transfer network
- Add an Expires header
- Gzip component
- Put the CSS at the top
- Place the script at the bottom
- Avoid CSS expressions
- Make JavaScript and CSS external
- Reduce DNS Lookup
- Reduced Javascript
- Avoid redirection
- Delete duplicate scripts
- Configure the etag
Its solid comments from the excellent kill Yahoo User Interface blog will be packaged into a similar excellent book. It can also be presented as a PowerPoint presentation at the Web 2.0 conference.
My role also includes similar ground to reduce the bandwidth usage of your website.
But before that, all Yahoo's solid opinions were run and implemented,Considering the audience. These rules are from Yahoo. According to AlexaTop 3 webpages in the world. Ricky's company, Dong Zheng, is not lazy-they are on top 2000. This is quite natural. Rich people know Yahoo's opinions and will be interested inMillions of unique users every day.
To help others implement the rules, Yahoo creates a firebug plug-in, yslow. This plug-in evaluates the current page, uses 13 Rules, and provides specific guidance on how to fix any problems it discovers. And all of the most important is that the tool has a scoring rateAnd page-! Score whether we love to exceed the complicated comments of boiled web pages and web pages to a simple number score. Here is meOfScore score from yesterday.
To understand the score, you must dissect the proportions of individual rules, like Simon chiaretta:
Weight 11 |
3. Add the Expires header 4. Gzip component 13. Configure the etag |
Weight 10 |
2. Use content transfer network . Placed on the top CSS 10. Reduced Javascript 11. Avoid redirection |
Weight 5 |
9. Reduce DNS Lookup 6. Bottom of Mobile Script 12. Delete duplicate scripts |
Weight 4 |
1. Few requests (CSS ) 1. Few requests (JS) |
Weight 3 |
1. Few requests (CSS background images) |
Weight 2 |
7. Avoid CSS expressions |
My 73 yslow rating is respectable, but I have made some changes to accommodate a large number of demands. In order to get some common website scoring ideas, Simon ran the number of blog yslow and recorded the results:
- Google: 1 (99)
- Yahoo Developer Network blog: (66)
- Yahoo! User Interface blog: (65)
- Scott watermasysk :( 62)
- Apple :( 61)
- David Shea's mezzoblue :( 60)
- Except for a list: F (58)
- Steve Hamman: F (54)
- Terrorism Code: Fax: (52)
- Haacked by Phil: female (36)
- Scott hanselman's computer Zen: F (29)
Yslow is a convenient tool,Whether it is online, it is very inefficient.The score of a webpage or something wrong. I will get it later.
The "Statistics" tab contains a summary, browser cache, and no footprint. The total size of the page you downloaded. One of the main results from Yahoo is 40% to 60%. Every day, visitors have an empty cache. Therefore, it is necessary to optimize the sizeEverythingInstead of saving it to you through the client browser cache.
Yslow is also broken through more detailed statistics on the component tab. Here you can see several key judgment criteria for the resources on each page...
- Does this resource have a clear expiration date?
- Is this resource compressed?
- Does this resource have an etag?
...... With the absolute size.
Yslow can be a useful tool, but it can be dangerous in the hands of criminals. Optimization that software developers love. Sometimes too many.
There are some good suggestions, but there are alsoA lot of opinions make sense. If you run a website, you get millions of uniqueEvery day. Are you running a website like this? If so, what are you doing instead of flying your private plane trophy wife to Bermuda for a vacation? For the rest, we should have a little more opinions, and we will be selective. To avoid the temptation, blindly apply these "Top (x) methods (y)" to list the popularity of Digg and other social websites. On the contrary, read suggestions, criticize and think about the consequences of implementing this suggestion.
If you cannot read Yahoo's opinion, you may make your websiteSlowPhil Chuck unfortunately found out. Although many of these rules are bread and cream HTTP optimization schemes, unfortunately, the highest weighting rules on some yahoo lists are very dangerous if notPlane. And when you define it as "smaller than Yahoo", this is... okay, almost everyone. Therefore, let's take a look at the most tricky weight comments on the Yahoo list.
Use Content Delivery Network (weight: 10)
If you want to ask how much a formal content delivery network will cost, you can't afford it. It is more effective to think of this "heavy" on your website-for example, you provide any media or image bulk-outsourcing much better equipped with external websites for processing. This is my opinion. The most important part is to reduce the bandwidth usage of your website. A cdn can use a reasonable Yahoo traffic volume below, which can even slow down your website.
Configure etag (weight: 11)
Etag is a service in the validation field and files on each server. If the resources on the server are different from those on the local Cache version, the client can tell you. Yahoo suggested turning to etag because they would lead to farm on the server due to issues with machine-specific tag generation methods. Therefore, unless you run a server farm, you should ignore this guidance. This will not only make your website poor, because the client will have a more difficult time determining whether its cache is stale or fresh. It can use the existing Last modified Date field for the client to determine whether the cache is stale, but the last modification is a weak verification program, while the entity tag (etag) is a powerful validators. Why is the trade strength weak?
Add an Expires header (weight: 11)
This is not a bad opinion, but it can cause a huge problem if you make a mistake. In Microsoft's IIS, for example, if the Expires header is always disabled by default, it may be for this reason ,. Set an Expires header for HTTP resources. Tell the clientNever check for new resourcesVersion-at least until the expiration date of the Expires header. When I say no, I mean-the browser doesn't evenRequirementsFor a new version, it only undertakes that its cached version is good to go, until the client clears the cache and the cache expires. Yahoo points out that they have changed the names of these resources when they need them to refresh.
You really save energy. Here, the client has pinged a new version of the server and a 304 header that cannot be modified. In general, the cost of resources has not changed. This is not a huge overhead, unless you are Yahoo. Of course, if you have an image or script, almostNeverThe change must be to use the client cache to open the cache-control header. The performance of caching to the browser is crucial. Every web developer should have a deep understanding of the HTTP cache. But there is only one procedure, and limited ways to use these specific folders or files can benefit. Otherwise, the risk is greater than the benefit. This is of course not what you want to change into a blanket. By default, it is the content of your entire website, unless you want to change the file name and change the content each time.
I don't mean to take any excellent guidance from Yahoo. The 13 simple yslow firebug plug-ins of Yahoo to speed up your website Rules and companions are excellent resources for the entire Internet. Read it by all means. Benefit from this. Implement it. I 've been hitting the benefits of gzip compression for years.
HoweverRealize that Yahoo's problem is not always yours. Is there anything like this as a perfect guide. Strive to firstUnderstandingAnd then implement the opinions to make your awareness of the specific situation.