You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/05/21 07:13:02 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #7894: add cache hit ratio metrics for topic subscription

codelipenghui commented on a change in pull request #7894:
URL: https://github.com/apache/pulsar/pull/7894#discussion_r636686833



##########
File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryCacheImpl.java
##########
@@ -208,7 +208,12 @@ private void asyncReadEntry0(ReadHandle lh, PositionImpl position, final ReadEnt
             EntryImpl cachedEntry = EntryImpl.create(entry);
             entry.release();
             manager.mlFactoryMBean.recordCacheHit(cachedEntry.getLength());
-            callback.readEntryComplete(cachedEntry, ctx);
+            EntryCacheCounter entryCacheCounter = EntryCacheCounter.EntryCacheCounterBuilder
+                    .getBuilder()
+                    .setCacheHitCount(1)
+                    .setCacheHitSize(cachedEntry.getLength())
+                    .build();

Review comment:
       This will create more objects here which will increase the jvm GC workload. It's better to use a callback here to record the metrics in the subscription.




-- 
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