You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "advancedxy (via GitHub)" <gi...@apache.org> on 2023/02/09 07:14:53 UTC

[GitHub] [incubator-uniffle] advancedxy commented on a diff in pull request #568: [#567] feat: add a shuffle-server metric about read_used_buffer_size

advancedxy commented on code in PR #568:
URL: https://github.com/apache/incubator-uniffle/pull/568#discussion_r1101058393


##########
server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBufferManager.java:
##########
@@ -362,10 +363,12 @@ public boolean requireReadMemoryWithRetry(long size) {
   public void releaseReadMemory(long size) {
     if (readDataMemory.get() >= size) {
       readDataMemory.addAndGet(-size);
+      ShuffleServerMetrics.gaugeReadBufferUsedSize.dec(size);

Review Comment:
   In my opinion, the suggest might not be better than the previous one.
   
   Consider this case:
   ```
   T1, T2 for two threads.
   t0, t1, t2 for times
   N: current read buffer
   t0: T1: readDataMemory.addAndGet(-size)
   t1: T1: readDataMemory.get() --> N - size
   t2: T2: readDataMemory.addAndGet(-size)
   t3: T2: readDataMemory.get() --> N - size - size
   t4: T2 : gaugeReadBufferUsedSize <- N -size - size
   t5: T1:  gaugeReadBufferUsedSize  <- N - size
   ```
   
   Unless there's safe bet to actually reset the gauge to the readDataMemory.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.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org