tillrohrmann commented on a change in pull request #13316:
URL: https://github.com/apache/flink/pull/13316#discussion_r495997147
##########
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 see your point. However, `LocalBufferPools` can contain excess memory
which can be claimed by other `LocalBufferPools`. See
`LocalBufferPool.returnExcessMemorySegments` for more details. Hence it is not
correct that memory which is assigned to a `LocalBufferPool` won't be available
for other buffer pools.
Ideally the used network memory metric would allow us to see if we have
overprovisioned a TM with network memory or whether it it running at its
capacity. However, this won't be visible if we report how many memory segments
have been handed out by the `NetworkBufferPool` to the `LocalBufferPools` where
they might lie around idling.
If there is no easy way to achieve this goal, then I would be ok with
keeping as it is which gives a more coarse grained overview over the resource
utilization which is already a plus.
----------------------------------------------------------------
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]