Use GTmetrix to optimize your web pages (integrated with YSlow, FireBug functions)

The URL is: http://gtmetrix.com/  , enter the link you need to analyze, wait a moment, there are two scores, one is the analysis score of YSlow, and the other is the analysis score of PageSpeed.

YSlow and PageSpeed ​​Score

 

For general Internet sites, the score should reach C (including A and B) or above, preferably B.

 

 

Inspection items of YSlow

Specific analysis of YSlow

 

As for the items with a YSlow score of F, I will briefly say

1、Add Expires headers

Adding expired headers generally refers to static files such as CSS, js , and pictures. The update frequency is relatively low, so the expiration time can be added.

 

2、Compress components with gzip

Use gzip to compress files, but pay attention, it is better to compress before deploying, instead of getting the current compression every time, it may take up a lot of CPU.

 

3、Use a Content Delivery Network(CDN)

That is, the program is deployed on different servers, and users in different regions and networks can access the fastest one.

 

4、Make fewer HTTP requests

Merge js and css files, which can be separated during development and merged with a merge tool during deployment. Reduce the number of requests.

 

5、Minify JavaScript and CSS

JS and CSS compression tools compress (remove spaces, replace long names with short names), etc. to reduce the file size.

 

6、Use cookie-free domains

It means that the cookie is set with a domain name such as: main.host.com, but some files that do not need cookies use another domain name: static.host.com, so that when the request is sent, there is no cookie header information in the Request. .

 

7、Put javascript to bottom

The loading and presentation sequence of the browser is: first static files, then css, display, then js, and then execute the content of js. Therefore, it is necessary to load the css first to facilitate display. Therefore, the css should be placed in the head, so that the user can see the page faster. The js file should be placed at the bottom, which can be loaded slowly, and then the content of the js is executed.

 

Check items for PageSpeed

Check items for PageSpeed

 

1. Combine external CSS merge CSS files

2. Combine external JavaScript Combine JavaScript files

3. Leverage browser caching uses browser Cache to add expiration time

4. Minify CSS Minify CSS, compress

5. Serve static content from a cookieless domain

6. Enable gzip compression Enable gzip compression

7. Specify a Vary: Accept-Encoding header If compressed, specify the Accept-Encoding header

8. Remove unused CSS

9. Use efficient CSS selectors

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326609261&siteId=291194637