Loading a Page
When a page is requested, instead of reading it from disk, it is first looked into the cache. There are three different caches and below shows the order in which the page is looked up.
- It might be a page that the current transaction has modified so it will first try to get it from its own page updates cache.
- If it is not available in transaction’s page updates, it will try to get it from PageFile’s page updates cache.
- If it is not found there, it will try to get it from PageFile’s page cache.
- It it is not found in the cache then the page will be read from disk. The marshaller is responsible to read the full page. One may also read a page with just its header. The read page will be added to page cache.
Below call loads the page with just its headers.
page = tx.load(page.getPageId(), null); assertNull(page.get());
If we pass the marshaller, it will read the full page.
page = tx.load(page.getPageId(), marshaller); assertNotNull(page.get());
The page cache used in PageFile is either a LFU or LRU cache and is configurable.