The invention is related to the field of enterprise computer network systems, and methods of caching data elements that are transmitted from server to client on the network.
In an enterprise computer network, there may be several client computers (“clients”) connected to a server computer (“server”). As application programs (“applications”) executing in the clients request data elements, such as queries, content, and objects, from the server, the client must initiate many calls to the server in order to obtain the data elements that are needed by an application. The server must then handle all of the calls, and process and complete each one. The amount of data elements transferred from the server to the clients may create much traffic. The data elements that are transferred are then locally copied (“cached”) on the client computer for easy access. However, as the client's cache is filled up with other data, the data elements that were requested from the server are emptied from the cache and, if needed again, must be re-retrieved from the server. Throughout the course of a connection with the server, as the cache is emptied and re-filled, data elements necessary for the operation of a client application may be called and retrieved from the server many times, creating a significant slowdown in the client application.
Referring still to
This exemplary method of on-disk caching is also shown in the flowchart that is
On an enterprise network, client applications often request data elements from remote storage locations located on another computer, such as tables in a remote database. Such requests are first handled by the network server, which retrieves the data elements from the database and provides them to the client. An enterprise computer network, with a large number of clients may need to simultaneously handle a large number of such requests which can impact the performance of clients on the network, if not efficiently handled.
Consistent with the invention, there is provided a method for caching data elements on a client connected to a server through a network, wherein the data elements originate on the server, the method comprising selecting at least one data element from a plurality of data elements stored on the server; retrieving the selected at least one data element from the server; storing the selected at least one data element on a storage device, wherein the storage device is located on the client; defining a time period for which the stored at least one data element is considered coherent; and persisting the stored at least one data element in the storage device for at least the time period.
Also consistent with the present invention there is provided a system for on-disk client-side caching comprising a client connected to a server through a network; a database operatively connected to the server; a central processing unit (CPU) in the client which selects at least one data element stored in the database to be stored on a client storage device; retrieves the selected at least one data element and stores a copy of the selected at least one data element on the client storage device; defines a time period for which the copy is considered coherent; and persists the copy on the client storage device for at least the defined time period.
Further consistent with the present invention, there is provided a method of on-disk, client-side caching of data elements, wherein the client is connected to a server on a network, the method comprising selecting at least one data element out of a plurality of data elements stored on a database operatively connected to the server to be cached; defining a check period for the selected at least one data element; retrieving the selected at least one data element from the database; persistently storing a copy of the selected at least one data element in a client's on-disk cache, wherein the copy is considered to be coherent with the database for at least the check period; and determining whether the copy is coherent with the database when the check period expires, wherein if the copy is determined to not be coherent, deleting the copy from the on-disk cache; re-retrieving the selected at least one data element from the database; and persistently storing a coherent copy of the selected at least one data element in the on-disk cache.
Additionally consistent with the present invention, there is provided a method of on-disk, client-side caching of data elements, wherein the client is connected to a server on a network, the method comprising selecting data elements to be cached; defining a group of data elements comprising the selected data elements; defining a check period for the group of data elements; retrieving the group of data elements from the database; persistently storing copies of the data elements in the group in a client's on-disk cache wherein the copies are considered to be coherent with a database operatively connected to the server for at least the check period; and determining whether the copies are coherent with the database when the check period expires, wherein if the copies are determined to not be coherent, deleting the copies from the on-disk cache; re-retrieving the group of data elements from the database; and persistently storing coherent copies of the data elements in the group in the on-disk cache.
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the invention and together with the description, serve to explain the principles of the invention.
Reference will now be made in detail to the exemplary embodiments that are illustrated in the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings to refer to the same or like parts.
An embodiment consistent with the present invention enables and allows the persistent caching of selected data elements in the on-disk cache of a client, thus allowing rapid access to the selected data elements, and further reducing or eliminating the need for continuous retrieval of data elements from remote storage. Copies of the selected data elements may be persisted in the on-disk cache as long as they are coherent with the original data element stored in remote storage. An embodiment consistent with the present invention further provides a method for maintaining cache coherency, such that only cached copies of data elements that are valid and consistent with the original data elements are provided to a client application requesting the cached copies. An embodiment consistent with the present invention may further provide a means for the immediate retrieval and caching of all data elements flagged for persistent caching upon the connection of a client to the server.
Data elements 300 that may be frequently retrieved from database 302 can be marked, or “flagged,” for persistent caching in cache 308. When a data element 300 is flagged for persistent caching, a flagged data element 301 may remain, or “persist,” in cache 308 only as long as the cached copy is valid and consistent with the corresponding data element 300 in database 302. In other words, flagged data element 301 must be exactly the same as corresponding data element 300 stored in database 302. Flagged data elements 301 that are valid and consistent are considered to be “coherent.” It is noted again that data elements that are stored in cache 308, such as flagged data element 301, are copies of the original data element 300 stored in database 302.
To enable the persistent caching of data elements, a user may associate properties with data elements 300 that can be used to determine the coherency of the data elements. Properties may be associated by, for example, a user (such as a superuser or administrator) using an application 316 executing on CPU 304. Some examples of properties that may be associated with the data elements include a time period for which the server or the client will consider the data element to be coherent, a data element type, and a timestamp indicating when the data element was last checked or modified.
Referring again to
Ideally, cache 308 should be large enough so that it can persistently store copies of all of the data elements flagged for persistent caching. In certain embodiments consistent with the present invention, the configuration of cache 308 may be changed such that flagged data elements 301 are given preference over copies of data elements not flagged for persistent caching. For example, in certain embodiments, data elements not flagged for persistent caching will be deleted from cache 308 first.
In certain embodiments, the API also associates with the at least one data element a time period called the “coherency check period” (step 404). The coherency check period is a time period during which the stored copy is assumed to be coherent or “valid.” That is, if a client application requests a data element within its coherency check period, the client application will not check to see if the copy stored in cache is coherent with the corresponding original data element stored in the database but will assume coherency. Time periods associated with the data element may be set by a user, and ideally should be chosen such that there is a low probability that the data element will be changed during the time period. Coherency check periods may be defined by one or more numerical values or arguments.
In step 406, the at least one selected data element with an associated coherency check period is flagged for persistence in on-disk cache and a copy of the at least one selected data element is persistently cached. Client applications requesting a persistently cached data element will access the copy of the requested data element from the cache (step 408). On each access of a persistently cached data element, the client CPU will determine if the coherency check period for that requested cached data element has expired (step 410). If the coherency check period has not expired, then the copy of the requested cached data element stored in the cache is provided to the application that has requested access (step 418).
If the coherency check period has expired, a request will be sent to the server to determine if the requested cached data element is still coherent (step 412). After this request, the CPU on the server will execute instructions for comparing the requested cached data element with the original data element to determine if the requested cached data element is coherent (step 414). If associated properties of the requested cached data element match associated properties of the original data element, the requested cached data element will be determined to be coherent and will be provided to the client application (step 418).
If the requested cached data element is determined to be not coherent with the original data element, then the requested cached data element is deleted from the cache (step 416). A coherent copy of the original requested data element is retrieved from the server (step 402) and flagged for persistent caching in the on-disk cache where it is persisted until determined to be no longer coherent.
If, however, the requested cached data element has an associated coherency check period, the coherency check period may be a numerical value or an argument (step 502). If the coherency check period is a numerical value, the client CPU will determine if the coherency check period has expired (step 504). If the coherency check period has not expired, the requested cached data element is within its coherency check period, and is assumed to be coherent with the original data element. Thus, a coherency check is not performed (step 518), and the requested cached data element is provided to the client application (step 516).
If, however, a coherency check period associated with the requested cached data element is not a number, the coherency check period may be an argument defining a set of rules. For example, the coherency check period may be set to “check always.” As the name suggests, on each request of the cached data element, the requested cached data element is checked for coherency with the original data element. Alternatively, for example, the coherency check period may be set to “check never,” wherein the requested cached data element is never checked for coherence with the original data element. The coherency check period may alternatively be set to “check on first access,” wherein a request of the cached data element only triggers a coherency check on the first access of the requested cached data element.
Referring again to
Whenever it is determined that a coherency check must be made, the client will initiate a coherency check with the server (step 512). The CPU on the server will execute instructions for comparing associated properties of the requested cached data element with associated properties of the original data element to determine if the requested cached data element is coherent with the original requested data element (step 514). If the requested cached data element is determined to be coherent with the original data element, it will be provided to the requesting client application (step 516). If, however, the requested cached data element is determined to be not coherent with the original data element, the requested data element is deleted from the cache (step 520). As described above, a coherent copy of the requested data element will be retrieved from the database and persistently cached until it is no longer determined to be coherent.
Alternatively, if the requested cached data element is a query, when a coherency check is performed, a method consistent with the present invention may use a generated “hash” value to determine if the query is coherent. As is known to those skilled in the art, a hash value is a unique number generated from a set of input data by a hash algorithm or function. The query will be run, and the results of the query, and the query itself, are fed into a stream hash function. The stream hash function computes a hash value of each query run. The generated hash value is compared against the previous query execution to see if the last results are still coherent
The particular definition of the coherency check period is not limited to the above embodiments. Since the methods for retrieving objects and performing queries remain the same regardless of the coherency check period employed, the coherency check period may be an argument or numerical value, as described above. Alternatively, for example, the coherency check period may be defined by an algorithm, transparent to the user, that defines the period as an argument or numerical value, depending on whether the data element is an object or query.
Referring again to
The group object allows for the coherency of all of the cached data elements in the group to be determined based on a single call to the server initiating a coherency check for one data element in the group. If any of the cached copies of the selected data elements comprising the group of data elements is determined to not be coherent with the original data elements in the database, the entire group of cached data elements is subsequently deleted from the cache. The data elements comprising the group of data elements are retrieved from the database and copies are persistently cached until they are no longer determined to be coherent. The ability to group data elements together in the cache allows for a method of coherency checking that is more effective than checking each cached data element in the group individually. Moreover, the group of data elements may be considered not coherent as a whole, making it less likely that a client application accessing a data element in the group, or many data elements in the group, will encounter errors because it sees one coherent data element and another data element that is not coherent. The ability to check the coherency of a group of data elements as a whole is not limited to the particular embodiments disclosed herein, as the method could be used in other applications that utilize caching of static objects, for example, web browsers.
Referring again to
Referring again to
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
This application claims the benefit of priority of U.S. Provisional Application No. 60/584,766, filed Jun. 30, 2004, which is incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
60584766 | Jun 2004 | US |