Browse Source
Repository has a usage counter that is initialized to 1 at instantiation and this counter is decremented when Repository.close method is called. There is also a Repository.incrementOpen method that RepositoryCache uses to increment the usage count when it's returning a repository that is already opened. The problem was that RepositoryCache was incrementing the usage count for repositories that it just opened or registered. The usage count was 2 when it should have been 1. Incrementing usage count is now only be done for repository that are served from the cache. This bug is causing slow memory increase of our Gerrit server until the server become slow. Even if the RepositoryCache is using SoftReference, it seems that the JVM is not garbage collecting the repositories because it's not yet on the edge of being out of memory. To test this change, I replicated all repositories(11k) from Gerrit master to one slave. The Gerrit master used memory after this test was 10GB without this change and 3.5GB with. Change-Id: I86c7b36174e384f106b51fe92f306018fd1dbdf0 Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>stable-4.4
Hugo Arès
9 years ago
committed by
Matthias Sohn
3 changed files with 27 additions and 3 deletions
Loading…
Reference in new issue