This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new 187074c908 log cache type when logging cache stats (#4585)
187074c908 is described below
commit 187074c908f3f64181f990e74562bf9c2fa33799
Author: Keith Turner <[email protected]>
AuthorDate: Wed May 22 10:46:36 2024 -0400
log cache type when logging cache stats (#4585)
---
.../accumulo/core/file/blockfile/cache/lru/LruBlockCache.java | 10 +++++-----
.../file/blockfile/cache/lru/LruBlockCacheConfiguration.java | 4 ++++
.../core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java | 4 +++-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java
index 0183ebe3bb..dc85350405 100644
---
a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java
+++
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java
@@ -577,14 +577,14 @@ public class LruBlockCache extends
SynchronousLoadingBlockCache implements Block
float freeMB = ((float) freeSize) / ((float) (1024 * 1024));
float maxMB = ((float) this.conf.getMaxSize()) / ((float) (1024 * 1024));
log.debug(
- "Cache Stats: Sizes: Total={}MB ({}), Free={}MB ({}), Max={}MB"
+ "Cache Stats: {} Sizes: Total={}MB ({}), Free={}MB ({}), Max={}MB"
+ " ({}), Counts: Blocks={}, Access={}, Hit={}, Miss={},
Evictions={},"
+ " Evicted={},Ratios: Hit Ratio={}%, Miss Ratio={}%,
Evicted/Run={},"
+ " Duplicate Reads={}",
- sizeMB, totalSize, freeMB, freeSize, maxMB, this.conf.getMaxSize(),
size(),
- stats.requestCount(), stats.hitCount(), stats.getMissCount(),
stats.getEvictionCount(),
- stats.getEvictedCount(), stats.getHitRatio() * 100,
stats.getMissRatio() * 100,
- stats.evictedPerEviction(), stats.getDuplicateReads());
+ conf.getCacheType(), sizeMB, totalSize, freeMB, freeSize, maxMB,
this.conf.getMaxSize(),
+ size(), stats.requestCount(), stats.hitCount(), stats.getMissCount(),
+ stats.getEvictionCount(), stats.getEvictedCount(), stats.getHitRatio()
* 100,
+ stats.getMissRatio() * 100, stats.evictedPerEviction(),
stats.getDuplicateReads());
}
/**
diff --git
a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java
index 0d427504cd..0ce59c993b 100644
---
a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java
+++
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCacheConfiguration.java
@@ -238,6 +238,10 @@ public final class LruBlockCacheConfiguration {
return conf.getMaxSize(type);
}
+ public CacheType getCacheType() {
+ return type;
+ }
+
public long getBlockSize() {
return conf.getBlockSize();
}
diff --git
a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java
index 46a07682bd..78206c7bd3 100644
---
a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java
+++
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/tinylfu/TinyLfuBlockCache.java
@@ -63,6 +63,7 @@ public final class TinyLfuBlockCache implements BlockCache {
private final int maxSize;
private final ScheduledExecutorService statsExecutor =
ThreadPools.getServerThreadPools()
.createScheduledExecutorService(1, "TinyLfuBlockCacheStatsExecutor");
+ private final CacheType type;
public TinyLfuBlockCache(Configuration conf, CacheType type) {
cache = Caffeine.newBuilder()
@@ -75,6 +76,7 @@ public final class TinyLfuBlockCache implements BlockCache {
maxSize = (int) Math.min(Integer.MAX_VALUE, policy.getMaximum());
ScheduledFuture<?> future =
statsExecutor.scheduleAtFixedRate(this::logStats, STATS_PERIOD_SEC,
STATS_PERIOD_SEC, SECONDS);
+ this.type = type;
ThreadPools.watchNonCriticalScheduledTask(future);
}
@@ -120,7 +122,7 @@ public final class TinyLfuBlockCache implements BlockCache {
double maxMB = ((double) policy.getMaximum()) / ((double) (1024 * 1024));
double sizeMB = ((double) policy.weightedSize().orElse(0)) / ((double)
(1024 * 1024));
double freeMB = maxMB - sizeMB;
- log.debug("Cache Size={}MB, Free={}MB, Max={}MB, Blocks={}", sizeMB,
freeMB, maxMB,
+ log.debug("Cache {} Size={}MB, Free={}MB, Max={}MB, Blocks={}", type,
sizeMB, freeMB, maxMB,
cache.estimatedSize());
log.debug(cache.stats().toString());
}