Many years ago (early 1990's) when I lived in New Orleans, I remember walking into a resourceful and offbeat audiophile establishment where my friend and I were browsing some rare vinyl, and at the small check-out desk stood a small but well written sign. "Cash Is King! We accept cash only for payment!" This struck me as an interesting proclamation, and I am sure it has been in the vernacular for a long time, but I liked it -- at the time it implied a certain rebelliousness. Turns out that the small establishment was not in business long, but the "Cash Is King" decree has stuck out forever in my mind, and that phrase is the inspiration for the title of this piece, "Cache is King". Website cache that is! This post is a high-level overview of website caching, and it will be followed-up with several more posts that delve deeper into the inner workings of website cache and administration for your organization.
Have you ever heard the catch phrase made popular by Steve Souders, "The fastest HTTP request is the one not made"? It makes perfect sense that any webpage that is cached would not need to be requested again, making it appear to load faster.
In his book High Performance Web Sites: Essential Knowledge for Front-End Engineers, Souders delivers 14 specific rules that he says can cut your webpage load time by 25% to 50%, and he has distilled the rules onto his High Performance Web Sites page, including links to online examples. Several other rules include "Making Fewer HTTP Requests", "Use a Content Delivery Network", and "Add an Expires Header", just to reference a few of the tenets.
Why cache your website?
Web cache lies between the web servers and the clients and waits for HTTP requests including pages, images, files, or any object, for that matter, and then saves a copy. As other requests are made for the same objects, the cache will use the stored copy, sidestepping the web server of origin. Caching your websites improves the overall perceived performance for the clients and users. Three main reasons to add caching for your websites are to reduce latency, reduce network traffic, and reduce server load. A request from cache will be closer to the client as opposed to the original server, assisting the reduction of load times to display content, which in turn, makes the website appear to be more responsive, and keeps expectancy at a minimum.
Bandwidth consumption is reduced when a website's presentation is reused; therefore, calling the cached version eliminates the need to refresh the original website, which reduces overall network traffic. And lastly, fewer requests made to the web server means less load to serve the web pages and other associated files and objects.
What are the types of website cache?
There are three primary types of website caching: client browser cache, proxy web server cache, and web server-side cache, and each type of caching technology has its benefits and weaknesses, depending on the type of implementation.
Client Browser CacheChrome displayed in Figure B above.
Proxy Server Cache
Server-side cache reduces the load on the web server by creating a cached copy of dynamically generated pages on the server itself. Retrieving a webpage from the web server-side cache can save the time needed to serve a fresh page dynamically on the fly. However, if the data that makes up the webpage has changed, the page which has been served from the web server-side cache won't be as fresh. For instance, configuring an Apache web server for more efficient caching would include control rules for <meta> tags, including a <meta http-equiv="Expires"...>, programmatically setting the HTTP headers using CGI scripts or other means, and through your web configuration files such as the httpd.conf file.
As a website stakeholder within your organization, how do you control who gets to view the latest content updates, and when the website and webpage cache is refreshed? You don't want all your visitors to view stale or outdated content, right? Striking a satisfactory balance between getting your web pages to load faster for client requests, and the number of pages and content objects that are cached is the key to good caching policies and administration. Subsequent pieces on the website caching topic will explore web caching administration, including policies, solutions, techniques, technologies, applications, and products that aid the organizational stakeholders and website administrators to manage their website's content delivery.
Ryan has performed in a broad range of technology support roles for electric-generation utilities, including nuclear power plants, and for the telecommunications industry. He has worked in web development for the restaurant industry and the Federal government.