Skip to content

Commit

Permalink
Debug log, proper time measurement, comment
Browse files Browse the repository at this point in the history
  • Loading branch information
henningandersen committed Jan 30, 2024
1 parent 9f58f6a commit 1db01a5
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,8 @@ class LFUCacheEntry extends CacheEntry<CacheFileRegion> {
// todo: consider whether freq=1 is still right for new entries.
// it could risk decaying to level 0 right after and thus potentially be evicted
// if the freq 1 LRU chain was short.
// seems ok for now, since if it were to get evicted soon, the decays done would ensure we have more level 1
// entries eventually and thus such an entry would (after some decays) be able to survive in the cache.
this.freq = 1;
}

Expand Down Expand Up @@ -1548,11 +1550,11 @@ public boolean maybeEvictLeastUsed() {
}

private void computeDecay() {
long now = System.currentTimeMillis();
long now = threadPool.rawRelativeTimeInMillis();
long afterLock;
long end;
synchronized (SharedBlobCacheService.this) {
afterLock = System.currentTimeMillis();
afterLock = threadPool.rawRelativeTimeInMillis();
appendLevel1ToLevel0();
for (int i = 2; i < maxFreq; i++) {
assert freqs[i - 1] == null;
Expand All @@ -1562,8 +1564,8 @@ private void computeDecay() {
assert freqs[i - 1] == null || invariant(freqs[i - 1], true);
}
}
end = System.currentTimeMillis();
logger.info("Decay took {} ms (acquire lock: {} ms)", end - now, afterLock - now);
end = threadPool.rawRelativeTimeInMillis();
logger.debug("Decay took {} ms (acquire lock: {} ms)", end - now, afterLock - now);
}

class DecayAndNewEpochTask extends AbstractRunnable {
Expand Down

0 comments on commit 1db01a5

Please sign in to comment.