What is caching?
Caching is the temporary storage of content, such as HTML pages, images, files and web objects, for the benefit of offloading the origin web or application server and reducing the time required to deliver content to a client. There are two main forms of caching: forward-proxy and reverse-proxy. A forward-proxy cache is typically deployed at various points of the Internet, typically at ISPs (internet service provider) or as part of a CDN (content delivery network), far from the origin server. A reverse-proxy cache server resides in close proximity to one or more web or application servers and shields the origin server from client requests.
Its location in the datacenter makes it logical for reverse-proxy caching functionality to be integrated with load balancing technologies. Indeed, caching is considered a key functionality for next-generation load balancers, commonly referred to as application delivery controllers (ADCs).
How does caching work?
A reverse-proxy cache acts as a proxy for the server. To a client, the reverse proxy server appears like a web server. In this setup, the proxy server is configured with an Internet-routable IP address. Clients are directed to the proxy server based on DNS resolution of a domain name, and content is served directly from the cache server if the content has already been stored—a “cache hit.” If the content is not already stored in the cache, a “cache miss,” the request will be redirected to the origin server to retrieve the content and a copy of the content will be stored in cache. When a subsequent request is received for the same content, it will be served from the cache server. Both static and dynamic content can be cached. Policies can be configured to ensure that dynamic content is fresh and valid to prevent stale or invalid content from being served to a client.
What are the benefits of caching?
The primary benefits of caching are server offload and accelerated content delivery.
Accelerate Content Delivery:
Many reverse proxy software packages also enable traffic shaping by allowing modification of the http requests flowing though them. This can be very useful for things like redirects, rewrites or improving the cache-ability of unwilling web applications.
What can and cannot be cached?
Generally speaking, the vast majority of static content is cacheable. Static content is defined as content (such as a web page) that is delivered to the user exactly as stored. In contrast, dynamic web pages are generated by a web application. Dynamic content is that which has been prepared with fresh information (content or layout) for each individual request. It is not static because the content changes with time, user ID, user interaction or any combination thereof.
Dynamic content cannot always be cached, but may be if it is part of an HTTP application. Newer reverse-proxy caches use parameterized technology to determine whether or not content from a specific application can be cached and served to a user. Application content will be refreshed periodically using expiry methods, which are controlled by the administrator to ensure that the content is fresh and valid.
Advanced caching functionality: