What Is a Stale Cache?

By Dan Howard

Viewing a website in a browser is a slightly more complex procedure than it may seem. Your request to access the website is received by the site's host server, which processes the request and sends the desired information. In some cases, the request may also pass through a proxy server that your Internet provider uses to store and administer requested Web data. Each step in the flow of data introduces the possibility for errors or stale information to seep into the Web transmission process.

Definition

Many sites on the Web contain dynamic data that is updated several times a week, day or hour. Sometimes a proxy server, site host or other Web handler may deliver dynamic data that is stored locally on its server instead of reading and returning the most recent version of the data. When a server delivers outdated content in response to a Web request, the error is referred to as delivery of "stale cache."

Why Stale Cache Occurs

Many server administrators choose to cache retrieved content locally for a period of time. Caching pages and media files greatly improves the speed with which Web content is delivered to a user. When the data is stored in the cache, the time to delivery depends only on the connection between the user and the server, rather than the extra connection between the server and the content. This performance benefit comes at the cost of occasionally issuing stale content to the user.

Avoiding Stale Cache

An administrator can take several steps to avoid serving too much stale content to users. The most extreme step that an administrator can take is to eliminate cache handling altogether. When caching is turned off, the server always fetches the latest version of the requested content and delivers that version to the user. While this ensures that stale cache is never an issue, it comes at a steep benefit to performance, especially when the content comes from a relatively slow website. A more moderate approach is to cache dynamic content for a relatively short period, such as a few minutes. Such short-term caching allows for faster distribution of frequently accessed dynamic data with a small stale cache window. Even if stale cache is occasionally delivered, it is never more than a few minutes out of date.

Leveled Caching

Some Web server management applications provide for variable levels of caching. These applications allow administrators to specify which aspects of their Web content change dynamically and must be kept up to date and thus retrieved with each request. Other dynamic content that is less critical may be updated in the cache every few minutes, while content that is deemed to be static may be updated only infrequently. In such a leveled scheme, the actual number of levels and their cache specifications vary based on the specific needs of the website.