You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/10/09 10:25:07 UTC

[GitHub] [incubator-iotdb] fanhualta commented on a change in pull request #431: display cache hit rate through jconsole

fanhualta commented on a change in pull request #431: display cache hit rate through jconsole
URL: https://github.com/apache/incubator-iotdb/pull/431#discussion_r332936879
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/engine/cache/DeviceMetaDataCache.java
 ##########
 @@ -153,6 +147,29 @@ public static DeviceMetaDataCache getInstance() {
     }
   }
 
+  private void printCacheLog(boolean isHit) {
+    if (!logger.isDebugEnabled()) {
+      return;
+    }
+    if (isHit) {
+      logger.debug(
+          "[ChunkMetaData cache hit] The number of requests for cache is {}, hit rate is {}.",
+          cacheRequestNum.get(), cacheHitNum.get() * 1.0 / cacheRequestNum.get());
+    } else {
+      logger.debug(
+          "[ChunkMetaData cache didn't hit] The number of requests for cache is {}, hit rate is {}.",
+          cacheRequestNum.get(), cacheHitNum.get() * 1.0 / cacheRequestNum.get());
+    }
+  }
 
 Review comment:
   These codes could be more concise.
   ```suggestion
         logger.debug(
             "[ChunkMetaData cache {}hit] The number of requests for cache is {}, hit rate is {}.",
             isHit ? "":"didn't ", cacheRequestNum.get(), cacheHitNum.get() * 1.0 / cacheRequestNum.get());
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services