Hi all,
I am pleased to share the first results of our (GerritForge) contribution to the performance improvements in the forthcoming Gerrit v3.3 release.
We have an initial experimental version of a brand-new high-performance persistent cache (based on ChronicleMap [1]) which is targeting the reduction of the latency in accessing significant caches like:
- change_notes
- diff_summary
- diff_intraline
and potentially have a positive impact on many others.
*We do expect* this change to have a significant impact on large mono-repos with hundreds of thousands of changes, thousands of packfiles and with tens of GBs in size.
The main reason of the expected performance improvement is the change_notes cache, which avoids parting the change meta-ref from NoteDb over and over again.
The change_notes cache was introduced a long ago, but its use was very limited in time and could not be persisted efficiently because of the intrinsics of H2 locking.
We tested the change_notes persistency on GerritHub a few months ago, and we literally crashed one site because of the additional latency and locks introduced by the H2 reorganisation and compaction mechanism.
Now, with the new persistent cache, all the above caches would receive a significant boost, especially for large repositories where computing the actual value is very expensive: the large and beefy mono-repos.
The new libModule will be compatible with the forthcoming Gerrit v3.3 and is pluggable as alternative implementation to the standard H2 cache.
The project is currently hosted on GerritHub.io and GitHub.com [3], and we are asking the community to move it to
gerrit-review.googlesource.com, where it is going to be more discoverable and aligned with the rest of the Gerrit platform.
1. Install the chronicle-map module into the $GERRIT_SITE/lib directory.
2. Add the cache-chroniclemap module to $GERRIT_SITE/etc/gerrit.config as follows:
[gerrit]
installModule = com.googlesource.gerrit.modules.cache.chroniclemap.ChronicleMapCacheModule
— * —
See below some preliminary E2E performance tests on a clean Gerrit with empty caches, 10 users, running for 5 minutes on a 3k changes project, a *best case scenario* for the H2 cache. The Server is a 16-cores 2.4 GHz 8-Core Intel Core i9 with 64GB of RAM
Get change details REST API (relies on change_notes cache):
H2 persistent cache:
- mean: 6ms
- 95 percentile: 50ms
- 99 percentile: 91ms
ChronicleMap persistent cache:
- mean: 6ms
- 95 percentile: 43ms
- 99 percentile: 68ms
The above figures show that even with a *small repo* and a relatively small H2 persistent cache, the improvement is visible on both 95 and 99 percentile. That is possible thanks to the non-blocking nature of ChronicleMap compared to the RDBS-style access of H2.
We are building up a series of CI automation of our E2E tests that will run on the Gerrit-CI [2] that will verify the Gerrit performance on a series of large-mono repos and will publish the resulting statistics for every merged commit on the master and the future stable-3.3 branch.
— * —
Hope you would find this new module interesting and applicable to your Gerrit setup, especially for all of those who are on NoteDb and have large mono-repos.
Thanks for your feedback and feel free to ask questions or give a +1 to this e-mail for including this new module into the
gerrit-review.googlesource.com.
Luca.
[1]
https://github.com/OpenHFT/Chronicle-Map
[2]
https://gerrit-ci.gerritforge.com
[3]
https://github.com/GerritForge/modules_cache-chroniclemap