NicoK commented on a change in pull request #8556: [FLINK-12171][Network] Do
not limit the network buffer memory by heap size on the TM side
URL: https://github.com/apache/flink/pull/8556#discussion_r308279997
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NettyShuffleEnvironmentConfiguration.java
##########
@@ -224,32 +224,40 @@ public static NettyShuffleEnvironmentConfiguration
fromConfiguration(
public static long calculateNewNetworkBufferMemory(Configuration
config, long maxJvmHeapMemory) {
// The maximum heap memory has been adjusted as in
TaskManagerServices#calculateHeapSizeMB
// and we need to invert these calculations.
- final long jvmHeapNoNet;
+ final long heapAndManagedMemory;
final MemoryType memoryType =
ConfigurationParserUtils.getMemoryType(config);
if (memoryType == MemoryType.HEAP) {
- jvmHeapNoNet = maxJvmHeapMemory;
+ heapAndManagedMemory = maxJvmHeapMemory;
} else if (memoryType == MemoryType.OFF_HEAP) {
long configuredMemory =
ConfigurationParserUtils.getManagedMemorySize(config) << 20; // megabytes to
bytes
if (configuredMemory > 0) {
// The maximum heap memory has been adjusted
according to configuredMemory, i.e.
// maxJvmHeap = jvmHeapNoNet - configuredMemory
- jvmHeapNoNet = maxJvmHeapMemory +
configuredMemory;
+ heapAndManagedMemory = maxJvmHeapMemory +
configuredMemory;
} else {
// The maximum heap memory has been adjusted
according to the fraction, i.e.
// maxJvmHeap = jvmHeapNoNet - jvmHeapNoNet *
managedFraction = jvmHeapNoNet * (1 - managedFraction)
- jvmHeapNoNet = (long) (maxJvmHeapMemory / (1.0
- ConfigurationParserUtils.getManagedMemoryFraction(config)));
+ heapAndManagedMemory = (long) (maxJvmHeapMemory
/ (1.0 - ConfigurationParserUtils.getManagedMemoryFraction(config)));
}
} else {
throw new RuntimeException("No supported memory type
detected.");
}
// finally extract the network buffer memory size again from:
- // jvmHeapNoNet = jvmHeap - networkBufBytes
- // = jvmHeap - Math.min(networkBufMax,
Math.max(networkBufMin, jvmHeap * netFraction)
- // jvmHeap = jvmHeapNoNet / (1.0 - networkBufFraction)
+ // heapAndManagedMemory = totalProcessMemory -
networkReservedMemory
+ // = totalProcessMemory - Math.min(networkBufMax,
Math.max(networkBufMin, totalProcessMemory * networkBufFraction)
Review comment:
nit: please fix indentation in the second line here
----------------------------------------------------------------
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]
With regards,
Apache Git Services