Persist caches keys index at configurable pace

Introduce 'cache.persistIndexEvery' parameter (by default '15m') that
specifies how often indexes should be persisted to a disk.
* in order to avoid race condition between evict and persist operations
  the latter is performed after the former is finished
* considering the above the smallest duration between persist operations
  is 30s amd smaller values of 'persistIndexEvery' will be rounded up to
* higher values are rounded down (if needed) to the closest multiple of
* persist operation is additionally called on Gerrit exit - regardless
  of the configured duration but it will be skipped on a particular
  index level if there is one already running (as a result of schedule)
* persist operation is scheduled in a dedicated thread

Example when 'cache.persistIndexEvery = 2m' it means that persist
operation will be performed after every 4th eviction is finished.
And additionally on Gerrit exit provided that there is no one in

Bug: Issue 15121
Change-Id: Ib6ea9c0e2819bf6d93ab4654db9e8a2abc8b5b20
8 files changed
tree: 183ab27701277f71e90e4e49571c3686ac6f35eb
  1. src/
  2. .gitignore
  3. BUILD
  4. external_plugin_deps.bzl
  5. Jenkinsfile

Persistent cache for Gerrit, based on ChronicleMap

Non-blocking and super-fast on-disk cache libModule for Gerrit Code Review based on ChronicleMap on-disk implementation.

How to build

This libModule is built like a Gerrit in-tree plugin, using Bazelisk. See the build instructions for more details.


  • Install cache-chronicalmap module

Install the chronicle-map module into the $GERRIT_SITE/lib directory.

Add the cache-chroniclemap module to $GERRIT_SITE/etc/gerrit.config as follows:

  installModule = com.googlesource.gerrit.modules.cache.chroniclemap.ChronicleMapCacheModule

For further information and supported options, refer to config documentation.

Migration from H2 caches

You can check how to migrate from H2 to chronicle-map here.