swamirishi commented on code in PR #8203:
URL: https://github.com/apache/ozone/pull/8203#discussion_r2047917698


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStoreCodecBufferIterator.java:
##########
@@ -84,38 +92,77 @@ CodecBuffer getFromDb() {
     }
   }
 
-  private final Buffer keyBuffer;
-  private final Buffer valueBuffer;
+  private final Stack<RawKeyValue<Buffer>> availableBufferStack;

Review Comment:
   Just because we have initialized a Buffer object it doesn't mean we have 
allocated anything yet. It will still do a lazy allocation. Use of stack will 
minimize if there are not many concurrent threads in lock code block than the 
number of max buffers the allocation that is why it is better to use a stack. 
Moreover stack.pop() is a very cheap operation. There would be only one thread 
waiting for a non empty stack which should be fine. There should be no 
contention as well in this case ideally. We need the synchronized block only 
for the published subscriber model, optmize on the wait() & notify()



-- 
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: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to