H3C 802.1x client uses client-side caching to optimize the Web site 1th/2 page

Source: Internet
Author: User
Many people first want to start to optimize the program from the server cache, many different server caches have their own characteristics, such as I have been involved in some projects, according to the cache hit rate of different use of com+/enterprise libiary caching/ Windows services, static files and other ways of server-side caching and HTTP compression technology, but the client cache is often ignored, even if the server's cache to make your page access is very fast, but she still need to rely on the browser download and output, and when you join the client cache, will bring you a lot of benefits. Because she can cache the most frequently accessed pages in the site to maximize the throughput of the WEB server (typically in the number of requests per second) to improve application performance and scalability.
An online shopping survey shows that most people are willing to queue up in stores but are reluctant to wait while shopping online. Websense survey said up to 70% of internet users said they were reluctant to read pages for more than 10 seconds. More than 70% of people will cancel the current order because of the slow speed.
Basic knowledge
1) What is "last-modified"?
When the browser requests a URL for the first time, the server-side return status is 200, the content is the resource you requested, and there is a last-modified attribute that marks the last time the file was modified at the end of the service period, similar in format:
Last-modified:fri, 2006 18:53:33 GMT
When the client requests this URL for the second time, according to the HTTP protocol, the browser transmits the If-modified-since header to the server, asking if the file has been modified after that time:
If-modified-since:fri, 2006 18:53:33 GMT
If the server-side resource does not change, the HTTP 304 (not Changed.) Status code is returned automatically, and the content is empty, which saves the amount of data transferred. When the server-side code changes or restarts the server, the resource is re-emitted, similar to when the first request is returned. This ensures that the resources are not duplicated to the client, and that the client is able to get the latest resources when the server changes.
2) What is an "Etag"?
The HTTP protocol specification defines the etag as the entity value of the requested variable (see-section 14.19). Another argument is that the ETag is a token that can be associated with a Web resource. A typical web resource can be a Web page, but it may also be a JSON or XML document. The server is solely responsible for judging what the token is and what it means, and transmitting it to the client in the HTTP response header, which is the format returned by the server side:
ETag: "50b1c1d4f775c61:df3"
The client's query update format is this:
if-none-match:w/"50b1c1d4f775c61:df3"
If the etag does not change, it returns the status 304 and does not return, which is the same as last-modified. I test the etag is mainly in the breakpoint download is more useful.
How do last-modified and etags help improve performance?
Smart developers will use the HTTP header for Last-modified and ETAGS requests, which can take advantage of caching by clients such as browsers. Because the server first generates the LAST-MODIFIED/ETAG tag, the server can later use it to determine if the page has been modified. Essentially, the client requires the server to validate its (client) cache by passing the token back to the server.
The process is as follows:
1. The client requests a page (a).
2. The server returns page A, and adds a last-modified/etag to a.
3. The client presents the page and caches the page along with Last-modified/etag.
4. The Customer requests page A again and passes the Last-modified/etag that the server returned on the last request to the server.
5. The server checks the last-modified or ETag, and determines that the page has not been modified since the last client request, directly returning response 304 and an empty response body.
The following example describes how to use server-side code to manipulate the client cache:

Current 1/2 Page 12 next page

The above describes the H3C 802.1x client using client-side cache to optimize the Web site analysis of the 1th page 2, including the H3C 802.1x client side of the content, I hope that the PHP tutorial interested friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.