1. Field of Invention
The present invention relates generally to prefetching and page replacement. More specifically, the present invention is related to a novel method for prefetching and page replacement based upon grouping nodes of hierarchical data into a plurality of regions.
2. Discussion of Prior Art
In transactional systems, finite amounts of pages (free pages) are allocated from memory to hold data from disks. When all free pages are used, that is when all pages contain valid data; when more pages are needed, then certain pages are chosen for replacement. The module that determines which pages to be replaced is the bufferpool component. The bufferpool component tries to keep frequently used pages in memory while replacing others by using well-known protocols. For example, it can try to replace the pages lease recently used in the system (LRU) or the pages most recently used in the system (MRU).
Bufferpool managers currently use a number of techniques in deciding which pages to replace in the system. One way, as shown in
Another technique, as shown in
The following references provide for a general teaching with regard to page replacement, but they fail to provide for the claimed invention's robust method and system of page replacement in ordered nodes wherein the nodes are ordered into isolated regions.
U.S. patent application publication 2003/0018876 A1 provides for virtual memory mapping using region-based page tables, wherein a region register file provides a region identifier for a virtual address in a virtual memory space. The virtual address includes a virtual region number and a virtual page number. A virtual page table look-up circuit is coupled to the region register file to generate a page table entry (PTE) virtual address from virtual address parameters. The virtual address parameters include the virtual address.
U.S. Pat. No. 6,496,912 discloses a system, method, and software for memory management with intelligent trimming of pages of working sets. The computer system has memory space allocatable in chunks, known as pages, to specific application programs or processes. Also disclosed is a trimming method that estimates numbers of trimmable pages for working sets based upon a measure of how much time has elapsed since the memory pages were last accessed by the corresponding application program.
U.S. Pat. No. 6,473,840 discloses a data processing system having a network and method for managing memory by storing discardable pages in a local paging device. A discardable page that is to be removed from the memory is identified. A determination is made as to whether performance will increase by storing the discardable page in a paging device located within the data processing system. If it is determined that performance will increase, the discardable page is marked as a paged discardable page and stored in the paging device locally, wherein this page may be retrieved from the paging device. The paging device may take the form of a paging file, such as a swap file. If space is unavailable within the paging device, the discardable page may be discarded. These processes may be implemented in a network computer.
U.S. Pat. No. 6,408,368 discloses an operating system page placement to maximize cache data reuse. The operating system designates one or more pages containing critical data, text, or other digital information as hot pages within a physical system memory in the computer system and prevents replacement during execution of various application programs of these hot pages when cached. The operating system inhibits allocation of the conflict pages that would map to cache locations occupied by a cached hot page, thereby preserving the hot page within the cache memory. The conflict pages are placed at the bottom of a free list created in the system memory by the operating system. The operating system scans the free list using a pointer while allocating free system memory space at run-time. The system memory pages are allocated from the free list until the pointer reaches a conflict page. This allows the operating system to prevent the conflict pages from getting cached to the hot page location within the cache memory.
U.S. Pat. No. 6,408,364 describes an apparatus and method for implementing a least recently used (LRU) cache replacement algorithm with a set of N pointer registers that point to respective ways of an N-way set of memory blocks. One of the pointer registers is an LRU pointer, pointing to a least recently used way and another of the pointer registers is a most recently used (MRU) pointer, pointing to a most recently used way. For a cache fill operation in which a new memory block is written to one of the N ways, the new memory block is written into the way (wayn) pointed to by the LRU pointer. All the pointers except the MRU pointer are promoted to point to a way pointed to by respective newer neighboring pointers, the newer neighboring pointers being neighbors toward the MRU pointer.
U.S. Pat. No. 6,347,364 discloses schedulable dynamic memory pinning. An application submits a request for pinning its memory for a certain duration. As compensation, the application may offer other currently mapped pages for replacement. The request may also include the number of pages and the duration of time. The request is granted with the constraint policies which the application is to follow. Such constraint policies include number of pages and length of time the pages may remain pinned in memory. When compensation pages are offered, those pages are replaced in place of the pages which are granted the privilege of being pinned.
U.S. Pat. No. 5,897,660 discloses a method for managing free physical pages that reduces trashing to improve system performance, wherein the claimed invention overcomes the drawbacks of conventional operating system implementations of virtual to physical memory address mapping by providing a method for free physical page management and translation of virtual addresses to physical addresses that increase the effectiveness of the cache memory by reducing the thrashing caused by unfavorable mapping of virtual to physical addresses.
U.S. Pat. No. 5,809,563 discloses a method and apparatus for translating a virtual address into a physical address in a multiple region virtual memory environment. A translation lookaside buffer (TLB) is configured to provide page table entries to build a physical address. The TLB is supplemented with a virtual hash page table (VHPT) to provide TLB entries in the occurrence of TLB misses.
Transaction systems prefetch pages in anticipation of these pages being referenced in the future. Current systems would prefetch pages that are in some multiple of pages adjacent to the current one being processed. Other mechanisms include using an index which forms an ordered list of page references, which can be used to prefetch pages to be examined. The following references provide for a general teaching with regard to prefetching, but they fail to provide for the claimed invention's robust method and system of prefetching in ordered nodes wherein the nodes are ordered into isolated regions.
U.S. patent application publication 2002/0103778 discloses a method and system for adaptive prefetching. A cache server may prefetch one or more web pages from an origin server prior to those web pages being requested by a user. The cache server determines which web pages to prefetch based on a graph associated with a prefetch module associated with the cache server. The graph represents all or a portion of the web pages at the origin server using one or more nodes and one or more links connecting the nodes. Each link has an associated transaction weight and user weight.
U.S. patent application publication 2002/0078165 discloses a system and method for prefetching portions of a web page based on learned preferences. A system and a method for prefetching portions of a web page is based on preferences learned from previous visits to the web page. The disclosed prefetching technique determines whether a user prefers certain sub-pages of the web page and, if so, prefetches these preferred sub-pages prior to the other sub-pages of the web page. The set of preferred sub-pages is generated by analyzing the user's actions during previous visits to the web page.
U.S. Pat. No. 6,385,641 discloses an adaptive prefetching method for use in a computer network and web browsing. The prefetching scheme consists of two modules: a prediction module and a threshold module. After a user's request for a new file is satisfied, the prediction module immediately updates a database of history information, if needed, and computes the access probability for each candidate file where the access probability of a file is an estimate of the probability with which that file will be requested by the user in the near future. Next, the threshold module determines the prefetch threshold for each related server which contains at least one candidate file with nonzero access probability. The threshold is determined in real time based on then current network conditions. Finally, each file whose access probability exceeds or equals its server's prefetch threshold is prefetched. When prefetching a file, the file is actually downloaded if and only if no up-to-date version of the file is available on the local computer; otherwise, no action is taken.
U.S. Pat. No. 6,085,193 discloses a method and system for dynamically prefetching information via a server hierarchy. The method for prefetching data identifies data access patterns and prefetches select information based on dynamic interpretation of the data access patterns. The content server or proxy server identifies data access reference patterns of clients associated with the content server or the proxy server hierarchy. The decision to prefetch select information for the clients is made based on prefetch hint information and prefetch hint values.
U.S. Pat. No. 6,081,799 discloses a method for executing complex SQL queries using index screening for conjunct or disjunct index operations. A query is executed to access data stored on a data storage device connected to a computer. In particular, while accessing one or more indexes to retrieve row identifiers, index matching predicates in the query are applied to select row identifiers and index screening predicates in the query are applied to eliminate one or more selected row identifiers.
U.S. Pat. No. 6,067,565 discloses a technique for prefetching a web page of potential future interest in lieu of continuing a current information download. Described within is a technique that, through continual computation, harnesses available computer resources during periods of low processing activity and low network activity, such as idle time, for prefetching, e.g., web pages or pre-selected portions thereof, into the local cache of a client computer.
U.S. Pat. No. 6,026,474 discloses shared client-side web caching using globally addressable memory. A shared client-side Web cache is provided by implementing a file system shared between nodes. Each browser application stores cached data in files stored in a globally addressable data store. Since the file system is shared, the client-side Web caches are also shared.
Whatever the precise merits, features, and advantages of the above-cited references, none of them achieves or fulfills the purposes of the present invention.
The present invention provides a system and method for prefetching and replacing pages in storage, wherein the storage retains a plurality of pages and each of the pages comprising a plurality of nodes grouped into one or more regions. The system and method are accomplished via a bufferpool, a prefetcher, and a page replacer. The bufferpool stores a variable set of pages in memory. The prefetcher recognizes access patterns and usage and fetches pages among the plurality of pages that fit the access patterns and usage. Further, the page replacer works in conjunction with the bufferpool and, during a traversal, weights the variable set of pages to identify a subset to be retained and a remainder to be replaced, wherein the subset includes pages having a high probability of being revisited. The remainder is replaced with a page corresponding to the traversal. Weighting is based upon at least the following numerical values associated with each page in said variable set of pages: number of children, number of parents, and region statistics. The region statistics are any of, or a combination of, the following: minimum step, minimum level, maximum step, or maximum level.
In an extended embodiment, weighting is additionally based upon identifying pivot pages that define traversals that are not strictly parent-to-child or child-to-parent.
In another embodiment, the plurality of nodes are associated with a mark-up language based document, such as XML.
In yet another embodiment, the system and the method are implemented across networks, wherein the across network element is any of the following: local area network (LAN), wide area network (WAN), the Internet, cellular network, or wireless network.
a-c illustrate differing sets of regions formed from a representative XML document.
a and 6b illustrate regions as defined in
a and 7b illustrate a specific example depicting the mapping of nodes in a hierarchically structured document, based upon steps and levels.
a-b illustrate original and region-relative coordinates associated with nodes in various regions.
a-b illustrate a set of nodes and their respective mapping based on the method of assigning a step number every time a child node is descended.
c illustrate regions R1 through R6 formed from the set of nodes.
d-f illustrate the effect of modifications on the above-mentioned parameters with respect to regions R1 through R6.
While this invention is illustrated and described in a preferred embodiment, the invention may be produced in many different configurations. There is depicted in the drawings, and will herein be described in detail, a preferred embodiment of the invention, with the understanding that the present disclosure is to be considered an exemplification of the principles of the invention and the associated functional specifications for its construction and is not intended to limit the invention to the embodiment illustrated. Those skilled in the art will envision many other possible variations within the scope of the present invention.
The present invention presents a robust system and method for prefetching and replacing pages in an ordered node structure, wherein the node structure is representative of hierarchical data associated with a document and the ordering is based on the concept of isolated ordered regions. The coordinates of nodes are maintained by associating each node with coordinates relative to a containing region. Modifications to nodes within a region only affect the nodes in that region—not nodes in other regions. Traversals that retrieve information from the nodes can rebase the coordinates from their containing region and return results with a total order.
It should be noted that although throughout the figures and specification an XML document has been used to illustrate various examples, other hierarchically-ordered documents, such as documents in mark-up language formats such HTML, can be equally used in conjunction with the present invention. Therefore, the scope of the present invention should not be limited by the type of hierarchically-ordered document.
a-c illustrate differing sets of regions formed from a representative XML document 400. In this example, a set of nodes representative of an XML document can be broken, in
Similarly, in
Each region has a number of values associated with it wherein these values are computed using algorithms, to be outlined later. Each region has a Minimum Step (Min Step), Minimum Level (Min Level), Maximum Step (Max Step), Maximum Level (Max Level), and Step Range. The Min Step, Min Level, Max Step, and Max Level numbers give a region its dimensions and order within the document.
a and 7b illustrate a specific example depicting the mapping of nodes in a hierarchically-structured document based upon steps and levels. The following algorithm, based on a set of rules, is used in such a mapping:
Next, as in
The regions of
Regions are then grouped into Step Ranges. Regions within a Step Range have Min Step and Max Step values that do not overlap with that of regions in other Step Ranges. The algorithm below illustrates how to compute the Step Ranges in a set of regions:
Table 2, provided below, depicts Step Ranges (calculated based upon the above-mentioned algorithm) of regions of
The relationship among the calculated Step Ranges and the various regions of
Once the Step Ranges are determined, the regions are re-ordered. The previous entries ordered based on Min Step, Min Level are now ordered based on Step Range, Min Level, Min Step. In the above example, regions R2902, R3904, R6910, and R7912 are reordered. This change accurately reflects the parent-child relationship of the regions within a Step Range. Table 5, provided below, depicts a list of regions of
For regions in the same Step Range, retraversal of the regions needs to be performed to recompute the Min Level, Min Step, Max Level, and Max Step values. For regions in Step Ranges that follow, only the Min Step and Max Step values need adjustment.
To defer retraversal of regions during modifications, regions affected can be assigned to another nesting level. When this happens, the original set of regions retains its dimensions with respect to other regions in the same nesting level, while a new set of regions with a higher nesting level is created.
For example, as shown in
The regions of the new nesting level have Min Level, Min Step, Max Level, and Max Step values that are computed with respect to their parent nesting level region. For example, R81316 in nesting level 1 is two levels and one step away from the axis of R21308 in nesting level 0. It should be noted that, in
Further modifications to the document cause more regions of higher nesting levels to be created, all based of a parent level region. For example, as illustrated in
After the retraversal of regions within the Step Range and the adjustment of Min Step and Max Step values of the regions in the Step Ranges that follow, the regions of the document will be reordered, as shown in
Traversals that extract information from nodes require an order for each of the nodes in the document. Step and Level values can be associated with each of the nodes to impose an order for all nodes. These values are computed relative to the Step and Level values of the containing region. Modifications in the document only affect the region coordinates which are maintained in a Region Index—not the node coordinates. In the example illustrated in
N1 CONTAINS N2
It should be noted that although algorithms identified above (e.g., in the discussions of
a-b illustrate a set of nodes and their respective mapping based on the above-mentioned method of assigning a step number every time a child node is descended.
d-f illustrate the effect of modifications on the above-mentioned parameters with respect to regions R1 through R6. Thus, as can be seen in the examples illustrated in
Similarly, regions can be grouped in a varying fashion. For example, as in
Thus, as can be seen in the example above, various rules can be used to identify regions among a set of nodes and, hence, such rules should not be used to limit the scope of the present invention.
The present invention's robust system and method for prefetching and page replacement takes advantage of the above-mentioned node structure representative of hierarchical data associated with a document, wherein ordering is based on the concept of isolated ordered regions.
For example, returning to the example depicted in
In addition to the advantage of a robust prefetch algorithm, the present invention also provides for a page replacement algorithm based upon node order and hierarchical data. Hierarchical data can be stored by placing related sets of nodes into pages. While processing the nodes, a number of statistics can be gathered for each page. These statistics include the number of child pointers and parent pointers as well as the nodes relative order within the hierarchy.
Using these statistics, the system can tell the bufferpool component how the degree of probability that the pages traversed will be needed again in the future. This will cause the bufferpool component to keep the “most likely to be referenced” pages in memory longer.
The present invention can be used for the page replacement of bufferpool pages that contain nodes of a mark-up-based document, such as an XML document. As mentioned earlier, an XML document is stored when the system creates nodes that represent the entities of the document and the nodes are written out to pages. The nodes created are grouped (into regions) in various ways depending on anticipated access patterns. As regions are created, they are written out to bufferpool pages. Also, as mentioned earlier, a number of statistics are kept for each page. The Num Children and Num Parent values reflect the number of edges incident to the page. The Min Step and Min Level values reflect the order of the regions contained in the page with respect to the hierarchy. Regions with high Num Children and Num Parent values tend to be pages that are referenced often.
A region's Min Step/Min Level value reflects the region's order within the hierarchy. Regions with low Min Step/Min Level values tend to be regions which will be referenced often when the traversal moves from low Step/Level regions to high Step/Level regions. On the other hand, regions with high Min Step/Min Level values tend to be regions which will be referenced often when traversals move from high Step/Level regions to low Step/Level regions.
Using the Num Children, Num Parent, Min Step, and Min Level values associated with a page, the system can provide more information for the bufferpool component during page unfix. For example, in a traversal from a parent page to a child page where the parent pages Min Step/Min Level value is low and Num Children value is high, the system can unfix the parent page with a high weight count, as it is likely that the page will be referenced again. Subsequent pages will then have lower weights compared to their parent. This is illustrated in
a-j show chronologically, from left to right and top to bottom, how bufferpool pages are used to read in pages on disk and how pages unlikely to be referenced again are chosen for replacement. In areas where there is an asterisk (*), a LRU-based page replacement algorithm would have chosen a bad candidate.
a illustrates an initial condition depicting pages (more specifically, 11 pages) stored on a disk.
Next, in
It should be noted that, although systems that drop pages based upon the most recently used (MRU) algorithm would have also picked page 2112 as the page to dropped from the bufferpool, such systems do not benefit from the decision being made based upon taking into account factors such as number of children nodes, number of parent nodes, min step, and min level values associated with a page. Additionally, as will be seen later, the present invention's method does not mirror the results of neither the MRU not LRU algorithms.
e-g further illustrate how the page latched in memory changes traverses within the hierarchy (i.e., latched page 2116 in
In cases where the traversal is not purely parent-to-child or child-to-parent, the plan generator can leave hints about certain pages (called pivot pages) which, when reached, can change the direction of the traversal and will likely be needed again after it is unfixed. These pages usually contain nodes involved in predicate evaluations. Therefore, when it comes time to unfix a pivot page, the system can unfix it with a higher weight.
a-g show how a page that contains nodes, and has pointers (2200, 2202, 2204) to other pages which contain their children nodes, might be prematurely replaced by a transactional system (specifically those pages marked with an asterisk) with a page replacement module that uses an LRU. But, the present invention provides for a system and method that properly assign weights to pages by considering various factors (such as, but not limited to, the number of children, region statistics, or hints left by the compiler) to identify which pages are likely to be kept in memory longer for retraversals to be accomplished efficiently.
This aspect of the present invention is best shown in
it should be noted that the number of pages depicted in for illustrative purposes only and should not be used to limit the scope of the present invention.
One aspect of this approach that makes it different from traditional LRU/MRU-based techniques is its bias towards keeping pages in memory as opposed to a bias towards throwing pages out of memory. Because of the nature of hierarchical data, access patterns will tend to visit pages that have non-leaf nodes multiple times—sometimes after pages with leaf nodes have been visited. As a consequence, pages with non leaf nodes need to stay in memory longer. That is why this approach, oriented toward that kind of access pattern, is more beneficial than LRU/MRU.
One difference hierarchical data accesses have over index node accesses lies in the fact that non-leaf index nodes tend to not be reaccessed and most of the time result in index leaf nodes accesses, whereas accesses to hierarchical data doesn't necessarily result in leaf page accesses.
Additionally, the present invention provides for an article of manufacture comprising computer-readable program code contained within implementing one or more modules for ordering nodes in a document (e.g., XML document). Furthermore, the present invention includes a computer program code-based product, which is a storage medium having program code stored therein which can be used to instruct a computer to perform any of the methods associated with the present invention. The computer storage medium includes any of, but is not limited to, the following: CD-ROM, DVD, magnetic tape, optical disc, hard drive, floppy disk, ferroelectric memory, flash memory, ferromagnetic memory, optical storage, charge coupled devices, magnetic or optical cards, smart cards, EEPROM, EPROM, RAM, ROM, DRAM, SRAM, SDRAM, or any other appropriate static or dynamic memory or data storage devices.
Implemented in computer program code-based products are software modules for: (a) instructing a computer to store a variable set of pages in memory; (b) recognizing access patterns and usage and fetching pages among the plurality of pages that fit the access patterns and usage; and (c) upon traversals within the plurality of pages: (i) instructing the computer to retain a subset of the variable set to include pages having a high probability of being revisited; and (ii) instructing the computer to dynamically replace remainder of the variable set with a page corresponding to said traversal; and during each traversal, one or more modules weights the variable set of pages to identify the subset to be retained and the remainder to be replaced, wherein the weighting is based upon at least the following numerical values associated with each page in said variable set of pages: number of children, number of parents, minimum step, and minimum level.
Conclusion
A system and method has been shown in the above embodiments for the effective implementation of a system and method for prefetching and page replacement. While various preferred embodiments have been shown and described, it will be understood that there is no intent to limit the invention by such disclosure but, rather, it is intended to cover all modifications falling within the spirit and scope of the invention, as defined in the appended claims. For example, the present invention should not be limited by number of nodes in bufferpool, size of bufferpool type of hierarchically-ordered document, the type of algorithm used to calculate the step, number of nodes, number of levels, number of steps, number and shape of regions, software/program, or computing environment.
The above enhancements are implemented in various computing environments. For example, the present invention may be implemented on a conventional IBM PC or equivalent, multi-nodal system (e.g., LAN) or networking system (e.g., Internet, WWW, wireless). All programming and data related thereto are stored in computer memory, static or dynamic, and may be retrieved by the user in any of: conventional computer storage, display (i.e., CRT), and/or hardcopy (i.e., printed) formats. The programming of the present invention may be implemented by one of skill in the art of mark-up-based languages and database programming.