zhijiangW commented on a change in pull request #13316:
URL: https://github.com/apache/flink/pull/13316#discussion_r488440817



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
##########
@@ -271,12 +271,28 @@ public int getTotalNumberOfMemorySegments() {
                return totalNumberOfMemorySegments;
        }
 
+       public long getTotalMemory() {
+               return getTotalNumberOfMemorySegments() * memorySegmentSize;
+       }
+
        public int getNumberOfAvailableMemorySegments() {
                synchronized (availableMemorySegments) {
                        return availableMemorySegments.size();
                }
        }
 
+       public long getAvailableMemory() {
+               return getNumberOfAvailableMemorySegments() * memorySegmentSize;
+       }
+
+       public int getNumberOfUsedMemorySegments() {
+               return getTotalNumberOfMemorySegments() - 
getNumberOfAvailableMemorySegments();
+       }
+
+       public long getUsedMemory() {
+               return getNumberOfUsedMemorySegments() * memorySegmentSize;
+       }

Review comment:
       also +1 on my side. 
   I might previously misunderstand the motivation of exposing the TM level 
buffer usages. 
   
   I guess this metric is for guiding the users how to tune the config of TM 
network buffers:
   - If the config of TM network buffers is not enough, the task will fail when 
deployment.
   - If the config of buffer amount is redundant, we can know this info from 
this proposed metrics when all the task running.
   
   If so, it is indeed not need to care about the internal buffer usages on 
task level.




----------------------------------------------------------------
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:
[email protected]


Reply via email to