Apply optimized-http Cache

Source: Internet
Author: User
Tags header

One of the functional metrics of the application delivery device is the HTTP smart cache, which can be achieved in most brands of products. Apply the "full agent" mode of the delivery device so that the server's

HTTP response content can be cached in the application delivery device, and when the client initiates the request, the corresponding content is searched in the cache space first, the hit is responded by the cache, and the dead is forwarded to the source server for retrieval. The most important function of caching is to reduce the direct pressure of the client on the source server, because some of the requests have been answered by the application delivery device, and if the same content is frequently accessed, it can greatly improve the response speed of the client.

The application delivery device is cached using its own memory space, which is also called RAM cache. We know that the memory space is limited, can not like the hard disk array to store a large amount of data, so ramcache only for the reverse cache, that is, IDC's internal webserver implementation of content caching. If you need to do forward proxy caching, it is recommended to choose professional forward agent devices, those devices will generally configure the "T" level of storage space, can hold large amounts of data content. Since the application delivery device has limited cache space, it is necessary to know what is needed for caching, and what are the rules for caching? (Refer to the 13, 14 chapters of RFC2616, the specification has a very detailed description of the HTTP cache). The RAM cache caches the following:

1) 200, 203, 300, 301, 302 and 410 responses (if there is no Content-length header field in the response, no caching will be done);

2) The default response to only get method;

3 a specific URI or content type based on the policy definition, such as. css. jpg, etc.;

4 other HTTP methods defined based on the custom scripting policy;

Items that are not cached by RAM cache include:

1 The request contains the authentication information or has the Proxy-authorization header the not to make the cache, this kind of authentication content relates to the security;

2) response cache with vary header (except accept-encoding) in HTTP;

3) Response with Cache-control header and assigning value to No-cache, No-store, private and not for caching;

4) Response cache with pragma header;

5) response with Set-cookie or SET-COOKIE2 headers, because the cookie often carries the information of the end user;

6 If response belongs to the fin type, or does not carry Content-length, transfer-encoding:chunked property will not be cached

As an example above, both the pragma header and the Cache-control assignment are no-cache to see what the server responds directly to the response, and the qualifying content is returned directly by the cache (as shown below).

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.