Gitlab Community Edition Instance

Commit 90520f1a authored by mhellka's avatar mhellka
Browse files

Revert NIO caching change and use soft references again.

A single user can grow the cache very fast (e.g. by rapitdy modifying a
large archive without using transactions). We could purge old revisions on
commit to counter exactly this scenario, or just use soft references again
to prevent OOM situations. Time based eviction is not sufficient. We do
that anyway to free memory even if memory pressure is not high enough to
cause soft reference collection.
parent 0a95dbf7
Pipeline #116472 passed with stages
in 9 minutes and 15 seconds
......@@ -97,11 +97,10 @@ public class NioPool implements StoragePool {
private void rebuildCache() {
indexCache = Caffeine.newBuilder()
// TODO: Make this configurable
.softValues() // prevent OOM
// Allow GC to shrink the heap during idle hours.
.expireAfterAccess(60, TimeUnit.SECONDS)
.recordStats() // This has a (small) performance impact
......@@ -364,6 +363,7 @@ public class NioPool implements StoragePool {
private final long cacheSize;
public PoolStats() {
cacheStats = indexCache.stats();
cacheSize = indexCache.estimatedSize();
try {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment