XComp commented on a change in pull request #13316:
URL: https://github.com/apache/flink/pull/13316#discussion_r486135088
##########
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:
I discussed the issue with @NicoK. He objects looking for the memory
usage in the `LocalBufferPools` and the `BufferManager`, i.e. the exclusive
buffers, since these values are configured separately using
`taskmanager.network.memory.buffers-per-channel` and
`taskmanager.network.memory.floating-buffers-per-gate`. I think, that’s a fair
point. Exposing only the amount of memory acquired by the non-available
`MemorySegments` in the `NetworkBufferPool` should be good enough. This is what
is actually configured through `taskmanager.memory.network.min` and
`taskmanager.memory.network.max`. Any thoughts about that?
----------------------------------------------------------------
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]