BewareMyPower commented on code in PR #23582:
URL: https://github.com/apache/pulsar/pull/23582#discussion_r1836141053


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/NegativeAcksTracker.java:
##########
@@ -30,15 +30,17 @@
 import java.util.concurrent.TimeUnit;
 import org.apache.pulsar.client.api.Message;
 import org.apache.pulsar.client.api.MessageId;
+import org.apache.pulsar.client.api.MessageIdAdv;
 import org.apache.pulsar.client.api.RedeliveryBackoff;
 import org.apache.pulsar.client.impl.conf.ConsumerConfigurationData;
+import org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 class NegativeAcksTracker implements Closeable {
     private static final Logger log = 
LoggerFactory.getLogger(NegativeAcksTracker.class);
 
-    private HashMap<MessageId, Long> nackedMessages = null;
+    private ConcurrentLongLongPairHashMap nackedMessages = null;

Review Comment:
   Could you also compare the memory usage with `HashMap<Pair<Long, Long>, 
Long>` or `HashMap<Long, HashMap<Long, Long>>` as its type? Changing it from a 
normal map to a concurrent map is not necessary.
   
   ```java
           for (long i = 0; i < numMessages; i++) {
               ledgerId = 10000+i;
               entryId = i;
               partitionIndex = 0;
   ```
   
   Additionally, your test data seems not fair. The entry id is always the 
ledger id - 10000. Could you test a more common case like M ledgers with N 
entries for each ledger?
   
   ```java
   for (long i = 0; i < M; i++) {
       for (long j = 0; j < N; j++) {
           // i is ledger id, j is entry id
   ```



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

Reply via email to