On Fri, Mar 27, 2026 at 1:24 PM 'Yash Chaturvedi' via Repo and Gerrit
Discussion <
repo-d...@googlegroups.com> wrote:
>
> Hi all,
>
> We are exploring a new Gerrit module at Qualcomm that would provide a persistent cache implementation based on Infinispan as an alternative to the current H2-backed persistent cache. I wanted to share the idea early and get feedback on both the approach and the proposed module naming.
>
> Our interest in this comes from operational issues we have seen with the current persistent cache implementation in Gerrit v3.11, which relies on H2 v1 for local cache persistence. In our environment, H2 has not provided sufficiently reliable expiration and eviction behavior on disk, and it does not consistently enforce the configured disk limits. Over time, this can lead to uncontrolled cache growth and, eventually, request timeouts.
>
> Moving to Gerrit v3.12 is not, by itself, enough to address this for our use case, as H2 v2 has also proven unreliable in similar scenarios.
We have struggled with the H2 caches as well. An open source
alternative that can be used would be great.
>
> A second concern is the overall efficiency of the current model. Because persistent caches are maintained locally by each Gerrit process, cache population work is duplicated across the cluster, and disk usage grows with each additional node. For expensive caches, this results in avoidable recomputation and poor scaling characteristics.
>
> Infinispan is a distributed in-memory key/value data store with optional schema support, available under the Apache License 2.0. We think it could be a good fit for a few reasons:
>
>
> single-primary Gerrit setups can use Infinispan in a way that is similar to how H2 is used today
> optionally, a remote or distributed Infinispan cache can be used to de-duplicate cache work across a cluster
> persistence options beyond file-based storage, such as RocksDB and JDBC
> features such as passivation, preload, clustering, and transactional guarantees
> per-cache expiration and eviction policies
> better observability via JMX/Micrometer
> richer cache APIs and management capabilities
>
> For naming, following the existing module conventions in Gerrit, one possible option would be:
>
> modules/cache-infinispan
>
> We also have a couple of proof-of-concept changes that illustrate the direction:
>
>
https://gerrit-review.googlesource.com/c/plugins/examples/+/566042
>
https://gerrit-review.googlesource.com/c/plugins/examples/+/566121
>
> Feedback on the overall direction, scope, and naming would be very welcome.
It looks like your examples cover embedding the cache system within
Gerrit itself or speaking to a remote service running the infinispan
cache. I think for those of us running a single Gerrit instance
avoiding additional services is nice if possible. Is the idea that for
a simple Gerrit deployment we wouldn't need any additional services?
Then the other question I have is how is persistence done? An in
memory cache is not persistent. 566042 refers to SIFS which does write
cache data to disk. It looks like SIFS stores data in append only
files and it only reclaims disk space when a file drops below 50%
utilization (it copies the valid records into a new smaller file then
deletes the old file).
With H2 we have observed two major problems. The first is that the
backing files grow forever. We have been mitigating that with
occasional restarts of Gerrit where we delete the caches entirely
while Gerrit is not running. The second is that H2 performs cleanup
routines during Gerrit shutdown which causes shutdowns to take several
minutes at least. This is problematic when we 're going to immediately
delete the backing cache file as soon as Gerrit actually stops. I'd be
curious if SIFS performs better than H2 when it comes to pruning and
managing the disk consumption. I'm also curious if there are shutdown
impacts when using SIFS. Does Infinispan need to flush data to disk on
shutdown and will that make shutdown slow like H2?
In any case I think the problems with H2 have made it difficult to
operate Gerrit and alternatives would be great. Ideally any
alternative would address the disk consumption problem and slow
shutdown process slowness that H2 creates.
>
> Thanks,
> Yash
>