]> source.dussan.org Git - jgit.git/commit
Time based eviction strategy for repository cache 04/74904/9
authorChristian Halstrick <christian.halstrick@sap.com>
Mon, 30 May 2016 14:09:58 +0000 (16:09 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 12 Jul 2016 09:32:49 +0000 (11:32 +0200)
commit7ffe547da79bf26301c5e5a0665d19a233b44818
treea56af114e97af32529548eda812c557d068dc28d
parentc1ca9cc80004b4eaa90f18a8fea251d565304e56
Time based eviction strategy for repository cache

When Repository.close() decrements the useCount to 0 currently the cache
immediately evicts the repository from WindowCache and RepositoryCache.
This leads to I/O overhead on busy repositories because pack files and
references are inserted and deleted from the cache frequently.

This commit defers the eviction of a repository from the caches until
last use of the repository is older than time to live. The eviction is
handled by a background task running periodically.

Add two new configuration parameters:
* core.repositoryCacheExpireAfter: cache entries are evicted if the
cache entry wasn't accessed longer than this time in milliseconds
* core.repositoryCacheCleanupDelay: defines the interval in milliseconds
for running a background task evicting expired cache entries. If set to
-1 the delay is set to min(repositoryCacheExpireAfter, 10 minutes). If
set to 0 the time based eviction is switched off and no background task
is started. If time based eviction is switched off the JVM can still
evict cache entries if heap memory is running low.

Change-Id: I4a0214ad8b4a193985dda6a0ade63b70bdb948d7
Also-by: Matthias Sohn <matthias.sohn@sap.com>
Also-by: Hugo Arès <hugo.ares@ericsson.com>
Also-by: Sasa Zivkov <sasa.zivkov@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheConfigTest.java [new file with mode: 0644]
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryCacheTest.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCacheConfig.java [new file with mode: 0644]