taklwu commented on code in PR #5615:
URL: https://github.com/apache/hbase/pull/5615#discussion_r1449071236
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java:
##########
@@ -386,6 +399,17 @@ public boolean shouldReadBlockFromCache(BlockType
blockType) {
return false;
}
+ /**
+ * Checks if the current heap usage is below the threshold configured by
+ * "hbase.rs.prefetchheapusage" (0.8 by default).
+ */
+ public boolean isHeapUsageBelowThreshold() {
+ double total = Runtime.getRuntime().maxMemory();
+ double available = Runtime.getRuntime().freeMemory();
+ double usedRatio = 1d - (available / total);
+ return heapUsageThreshold > usedRatio;
Review Comment:
[nit] I found the hbase has of `MemorySizeUtil.safeGetHeapMemoryUsage();`
in region server to get heap usage and other place with a single instance,
although I think it's still using these two methods at the end.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]