From Cyrus

Jump to: navigation,

Lazy Cache

[Page Tools]

Executive Summary

Lazy cache loading involves not opening the cache file at all until a request is made for a cache record from a mailbox. This has the benefit of reducing IO, especially if the cyrus.index files are on high speed SSDs and the cyrus.cache and data files are on slow disks.

Implementation

This will fall quite naturally out of always using an API to fetch the cache records (already done, but still using MMAPed direct accesses due to the way index.c copies FDs and the race conditions inherent in having EXPUNGE replace the cyrus.index file)

Having the API also able to recreate the cyrus.cache entry by parsing the file on disk if there are any corruptions or missing cache records will also be a huge plus. It's actually quite trivial to do if you're always using the API and filling a structure. We already have a crec (struct cache_record) structure in current 2.3, which was the non-invasive part of this change and has been committed upstream. All cache accesses use crec's, so it's just a matter of fetching them through the mailbox_cacherecord_* APIs rather than cache_parserecord on an MMAPed space!