Edge caching using HTTP headers

Disclosed is a program for pre-fetching resources. A computer, communicatively coupled to a plurality of client computers and a server computer, identifies a resource, through an examination of one or more HTTP server logs, that is cached on at least one of the plurality of client computers and has been validated by the server computer. The computer determines to pre-fetch the resource based on one or more predefined rules, at least one of the predefined rules including a threshold number of responses validating the resource that must be received by the computer. The computer pre-fetches and caches the resource from the server computer. The computer receives a request for the resource from a client computer that does not have the resource cached. The computer validates resource cached locally and sends the resource to the client computer from the local cache on the computer.

FIELD OF THE INVENTION

The present invention relates generally to the field of data transfer over a computer network, and more particularly to a technique for cache pre-fetching.

BACKGROUND OF THE INVENTION

The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed information systems and is the foundation of data communication for the World Wide Web. Caching HTTP objects (html files, video, audio, images, etc.) is a well known technique to improve performance of applications requesting the objects. The HTTP/1.1 protocol (and later) includes a number of elements intended to make caching work efficiently. The goal of caching is to reduce, wherever possible, the need to send requests, and when a request must be sent, to reduce the need to send full responses in reply. Reducing the need to send requests lowers the number of network round-trips required, and is typically accomplished through “expiration” mechanisms allowing the requesting application or computer to assume that a cached copy of a resource is current if within a specified validity period. Reducing the need to send full responses lowers the strain on network bandwidth, and is typically accomplished through “validation” mechanisms. When a cache has a stale entry that it would like to use as a response to an application's or client's request, it first has to check with the origin server (or possibly an intermediate cache with a fresh response) to see if the cached (stale) entry is still usable. This is known as “validating” the cache entry. Known methods of validation include the use of “last-modified dates” and “entity tag” (ETag) values included in HTTP headers.

Intermediate “caching” servers that can store resources locally so that subsequent requests for the resource can be returned directly from the intermediate server often have the capability to pre-fetch a resource in anticipation of the resource being requested by a client computer.

SUMMARY

Embodiments of the present invention disclose a method, computer program product, and computer system for pre-fetching content for an intermediate cache. A computer, communicatively coupled to a plurality of client computers and a server computer, identifies at least one resource, through an examination of one or more HTTP server logs, that is cached on at least one of the plurality of client computers and has been validated by the server computer. The computer determines to pre-fetch the at least one resource based on one or more predefined rules, at least one of the predefined rules including a threshold number of responses validating the at least one resource that must be received by the computer. The computer pre-fetches the at least one resource from the server computer. The computer caches the at least one resource locally. The computer receives a request for the at least one resource from a client computer, of the plurality of client computers, that does not have the at least one resource cached on the client computer. The computer validates the at least one resource cached locally, and sends the at least one resource to the client computer from the local cache on the computer.

DETAILED DESCRIPTION

Any combination of one or more computer-readable medium(s) may be utilized. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable tangible storage device, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java®, Smalltalk, C++or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on a user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). The terms “Java” and “Smalltalk” may be subject to trademark rights in various jurisdictions throughout the world and are used here only in reference to the products or services properly denominated by the marks to the extent that such trademark rights may exist.

The present invention will now be described in detail with reference to the Figures.FIG. 1illustrates a distributed data processing environment, generally designated100, according to one embodiment of the present invention.

In the illustrated embodiment, distributed data processing environment100depicts an exemplary networked environment where various client devices (client computers102,104and106) can access content from one or more content providers (server computers108,110, and112) through a series of networked connections. Requests from any of client computers102,104, and106are relayed through any number of intermediate computers, including edge caching server114, which, in one embodiment, provides forwarding of the requests (via network116) to the appropriate server computer through DNS mapping. The initial connection to edge caching server114can be provided through a standard network of wired and/or wireless components or, in another embodiment, through cellular transmission towers, as is common when a client device is a smart phone. In a scenario where the client devices communicate initially through a cellular tower, edge caching server114may be the nearest server computer to a radio network controller (RNC) handling transmissions from multiple towers.

Edge caching refers to the use of caching servers (intermediate or proxy computers) to store resources/content closer to end users. For example, if a client computer (an end user) accesses an origin server (e.g., a content server computer hosting a web site and/or providing other content) and downloads some static content that gets cached, each subsequent user (being routed through the caching server) will get served the content directly from the caching server until the content expires. The effectiveness of a caching server depends on the amount of data or content that can be served from its cache, achieved by a high rate of “cache hits.”

Edge caching server114may be any programmable electronic device capable of caching content and of routing content between any of the client computers102,104, or106and any of the server computers108,110, or112. In one embodiment, edge caching server114represents a computing system utilizing clustered computers and components to act as a single pool of seamless resources when accessed through a network.

Various techniques exist for determining what to cache and what not to cache. As a preliminary matter, caching servers typically store all allowable resources (e.g., resources where a cache-control directive in the HTTP header is “public”). Caching servers may also “pre-fetch” resources by requesting and receiving content before the content is requested by a client computer. Pre-fetching can be done based on an analysis of HTTP server logs, popularity of the content in content delivery networks (CDNs) or the Internet. Just as cache-control directives in an HTTP header can indicate that content may be cached, such directives can also indicate that content may not be cached. For example, while a “public” cache-control directive indicates that the response may be cached/stored by any cache, a “private” cache-control directive indicates that all or part of the response message is intended for a single user and must not be cached by a shared cache. This allows an origin server to state that the specified parts of the response are intended for only one user and are not a valid response for requests by other users. A private or non-shared cache (e.g., the client computer's cache) may cache the response. A “no-cache” cache-control directive allows caching by all computers, but forces caches (both of proxy computers and browsers/clients) to submit a request for validation before releasing a cached copy. HTTP provides a number of additional cache-control directive headers.

Embodiments of the present invention recognize that, especially in instances where a communication channel of a client computer has limited bandwidth (e.g., a smart phone or computer connecting to the Internet through a cellular tower connected to the core network using a radio link), HTTP directives that prevent caching can greatly impact performance of the network—especially when applications request high volumes of data (e.g., video streaming, etc.) Often content providers want to prevent network/edge caching to increase page hits at the origin server, which in turn increases advertising revenue. In an exemplary operation, client computer106, depicted inFIG. 1as a smart phone, makes an HTTP GET request for content such as one or more of html files, audio, images, or video from server computer112. The request is routed through edge caching server114. Server computer112returns the content with the HTTP header “Cache-control: private,” directing edge caching server114to not store the content in its local cache, cache storage118. Edge caching server114forwards the content to client computer106. Client computer106, as a private end-user computer, may store the content locally. If client computer106sends a subsequent conditional request with an “if-modified-since” or other validation header, the subsequent request cannot be validated by edge caching server114and the request is routed all the way back to server computer112, which may respond with either an updated copy of the content or a “not-modified” HTTP header, confirming the freshness of the content stored in the local cache of client computer106. Any time a different client computer, e.g., client computer102or104, requests the content, because the content was not cached at edge caching server114, or any other intermediate server, the content must be retrieved from server computer112.

HTTP header analyzer program120, residing on edge caching computer114, stores, or has access to, HTTP server logs122that track HTTP headers received from both client computer106and server computer112. In normal operation, any analysis of HTTP logs focuses on new requests and requests where any cached responses may be used (e.g., HTTP message type200response objects) for caching and pre-fetching. Embodiments of the present invention, additionally or alternatively, use HTTP header analyzer program120to track validation requests and/or validation responses to determine content that should be pre-fetched and cached. A validation request is any conditional request asking for a fresh copy of stored content if the content has been modified since it was originally cached. Typically, a conditional request contains an “if-modified-since” header. A validation response indicates that the content has not been modified and, typically, such a response contains an HTTP message type304“not-modified” response header. Analyzing validation requests/responses can be especially useful because consistent validation requests may be a strong indicator that content will be popular, and numerous “not-modified” responses indicate that the content tends to remain static, making it a good candidate for caching as the potential for the content to change is low.

Based, in part, on the validation requests/responses, HTTP header analyzer program120determines which content should be pre-fetched. In embodiments of the present invention, depending on the determined content, HTTP header analyzer program120may also have to set rules to allow caching where HTTP header directives seek to prevent it. HTTP header analyzer program120uses pre-fetch agent124to collect the determined resources. HTTP header analyzer program120may use stored caching policy and rules definitions126in conjunction with tracked validation requests/responses to determine the content to pre-fetch, and additionally may use stored caching policy and rules definitions126to store its own determined caching policies.

FIG. 2depicts the operational steps of HTTP header analyzer program120for determining resources to pre-fetch, in accordance with one embodiment of the present invention.

HTTP header analyzer program120analyzes HTTP server logs122to determine content most commonly seeking validation (step202). HTTP server logs122can, in one embodiment, be HTTP header logs tracking headers of all HTTP requests and responses, and HTTP header analyzer program120can search the headers to identify conditional requests for content (e.g., “if-modified-since” requests) and “not-modified” responses. In another embodiment, HTTP server logs122are separately created logs in which edge caching server114can separately store conditional requests for content and “not-modified” responses, thereby avoiding the necessity to parse out the validation requests/responses. Additionally, in a hierarchical caching network, the peer caching servers (server computers at the same level of the hierarchy) can exchange information. Thus, edge caching server114can, in one embodiment, gather and analyze HTTP server logs from all peer caching servers to obtain the most accurate information for determining which content to pre-fetch. If a new edge caching server is installed, it can similarly query its peer caching servers for their HTTP logs to pre-populate (through pre-fetching) the empty cache of the new edge caching server. This can be referred to as “warming up” the cache.

After determining the pertinent content, HTTP header analyzer program120applies predefined caching policy and rules definitions126to produce a list of resources to be pre-fetched (step204). One exemplary rule might state that any resource where validation has been requested more than a specified number of times, within a specified time period, and having a size greater than a specified threshold should be pre-fetched. Other exemplary rules might require that validation requests have been received from at least a specified number of client computers or that a predefined threshold of “not-modified” responses have been returned from the origin server computer. Such rules may indicate that the exact same content is being returned to multiple client computers and thus the prevention of caching is inefficient. Other rules might also limit the included resources to a top percentage of the resources meeting the criteria.

HTTP header analyzer program120moves to the first resource in the list (step206) and determines whether a header override will be required (decision208). For example, if responses to requests for the resource are received with “public” or “no-cache” headers, no special treatment will be required during a subsequent request for the resource. These are cacheable responses. However, responses having “private” headers indicate that the requested content should not be stored in edge caching server114and caching the response would require an override of the caching policy.

If a header override is required, HTTP header analyzer program120sets an override rule (step210). The override rule indicates that a response to a given request may be cached. In one embodiment HTTP header analyzer program120sets an internal flag associated with the request for the resource to indicate that the resource is cacheable.

HTTP header analyzer program120requests the resource (step212) and caches the resource in local cache storage (step214). If a header of the received resource indicates that the content is not cacheable, HTTP header analyzer program120checks a request of the received resource and compares the request to any flagged requests to verify that the resource may be cached. A person of ordinary skill in the art will recognize that determining if a header override is required and setting the override rule may be implemented after the resource is received and before the resource is cached. Pre-fetch agent124may perform the actual process of forwarding the request to server computer112and receiving the response.

HTTP header analyzer program120determines whether there are more resources in the list (decision216), and if so, moves to the next resource on the list (step218) to perform the same process.

Subsequent requests for a pre-fetched resource can now be handled by edge caching server114according to standard operation protocols allowing the cached resource to be served to the requesting client computer directly from edge caching server114. However, in a preferred embodiment, where a requested resource is cached on edge caching server114by virtue of a rule or policy overriding an HTTP caching directive, edge caching server114validates the cached resource prior to sending it to the client computer. In such a manner, the server computer may continue to get “page hits.” An exemplary process flow is illustrated inFIG. 3.

InFIG. 3, edge caching server114receives a request for a resource from a client computer (step302). If the request received is a conditional request, this indicates that the requesting client computer has its own cached copy and wants to validate the cached copy or receive a current copy of the resource. Normal operation relays the conditional request to server computer112and relays the response from server computer112back to the requesting client computer. No deviation from standard protocols is necessary. If the request is not conditional (the requesting computer must receive the resource) and the resources is not cached locally on edge server computer114, again, the request is relayed to server computer112and the resource is in turn relayed back the requesting client computer. No deviation from standard protocol is necessary. If the request is not conditional, and the resource is cached locally on edge caching server114, but the resource is cacheable without any special overriding policies or rules, edge caching server114treats the request and cached resource normally and can send the resource directly to the requesting client computer or validate the resource according to standard HTTP protocols. However, if edge server computer114determines that the request is not conditional (step304), and edge server computer114determines that the resource is cached locally (step306), and edge server computer114determines that resource is not typically cacheable on edge server computer114(step308), edge server computer114validates the resource (step310) with server computer112. This ensures that server computer112remains aware of all requests for resources not typically cacheable on edge server computer114. Subsequent to validating the resource, edge server computer114sends the resource from the local cache to the requesting client computer (step312).

FIG. 4depicts a block diagram of components of edge caching server114in accordance with an illustrative embodiment. It should be appreciated thatFIG. 4provides only an illustration of one implementation and does not imply any limitations with regard to the environment in which different embodiments may be implemented. Many modifications to the depicted environment may be made.

Memory406and persistent storage408are examples of computer-readable tangible storage devices and media. Memory406may be, for example, one or more random access memories (RAM)414, cache memory416, or any other suitable volatile or non-volatile storage device.

HTTP header analyzer program120and pre-fetch agent124are stored in persistent storage408for execution by one or more of the respective computer processors404via one or more memories of memory406. In the embodiment illustrated inFIG. 4, persistent storage408includes flash memory. Alternatively, or in addition to flash memory, persistent storage408may include a magnetic disk storage device of an internal hard drive, a solid state drive, a semiconductor storage device, read-only memory (ROM), EPROM, or any other computer-readable tangible storage device that is capable of storing program instructions or digital information.

The media used by persistent storage408may also be removable. For example, a removable hard drive may be used for persistent storage408. Other examples include an optical or magnetic disk that is inserted into a drive for transfer onto another storage device that is also a part of persistent storage408, or other removable storage devices such as a thumb drive or smart card.

Communications unit410, in these examples, provides for communications with other computers and devices. In these examples, communications unit410includes one or more network interface cards. Communications unit410may provide communications through the use of either or both physical and wireless communications links. HTTP header analyzer program120and pre-fetch agent124may be downloaded to persistent storage408through communications unit410.

I/O interface(s)412allows for input and output of data with other devices that may be connected to edge caching server114. For example, I/O interface412may provide a connection to external devices418such as a keyboard, keypad, a touch screen, and/or some other suitable input device. I/O interface(s)412may also connect to a display420.