This is the 27th day of my participation in Gwen Challenge
Following content and Server 1 (CDN, caching), we will continue to learn about other possible ways to speed up your website.
Other tips for speeding up your website:
The server
Gzip compresses the response content
In simple terms, it speeds up Http response time by compressing server response content.
The implementation mechanism is that the Web client, namely the browser request, in the request header add:
Accept-Encoding: gzip, deflate
Copy the code
When the server returns the response data, it compresses the response content in the appropriate way and adds:
Content-Encoding: gzip
Copy the code
Tell the browser that the content is Gzip compressed. Yahoo mentioned that with Gzip, the response size can be reduced by 70%.
Gzip encoding over THE HTTP protocol is a technology used to improve the performance of WEB applications. Generally for plain text content can be compressed to 40% of the original size.
Gzip is useful for text content such as HTML, JS, CSS, XML, JSON, etc. However, images, PDF and other related algorithms have been used to compress the content has no obvious compression effect.
Both Apache and Nginx support Nginx configuration.
Configure ETag Entity Tags
ETag is a tag used to determine whether the browser cache matches the one on the server.
As stated in Baidu Encyclopedia, the server response content is set as follows:
ETag:"50b1c1d4f775c61:df3"
Copy the code
When the browser requests it, it adds:
If-None-Match : W / "50b1c1d4f775c61:df3"
Copy the code
If the ETag does not change, the server responds 304, and the browser receives the response and loads the content from the cache.
HTTP status code 304: The server has performed GET, but the file has not changed.
As for ETag, I have never used it before, so I am afraid of making mistakes. If there are mistakes, but also hope to correct!
Flush the output buffer as early as possible
This, in a nutshell, means that js, CSS and other resource files are placed in the head of THE HTML. In the case that the whole HTML is not fully loaded and parsed, js and CSS resource files are downloaded synchronously in parallel.
Use GET to complete AJAX requests
The POST process is that the file header is sent before the data is sent. It takes two steps; GET sends only one TCP packet. However, if the URL length is too long, POST is required.
And “GET” means to GET data, and “POST” means to send data.
About the maximum length of get-URLS for each browser:
1, IE: 2083 (2K+53)
2, Firefox: 65536
3. Chrome: 8182
4, Safari: 80000
5, Opera: 190000
Avoid an empty Img SRC
An empty IMg-src will cause the browser to execute the following request:
-
IE: the directory that requests the corresponding page.
-
Chrome/Safari: Request the corresponding page itself.
-
Firefox: Same as Chrome/Safari before version 3.5; Later versions do not send requests.
-
Opera: Do – nothing.
-
Tips for speeding up your website
-
Suggestions for speeding up your Web site server part 1