Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/5726#discussion_r175753301
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/ContaineredTaskManagerParameters.java
---
@@ -112,35 +113,11 @@ public String toString() {
public static ContaineredTaskManagerParameters create(
Configuration config, long containerMemoryMB, int numSlots)
{
- // (1) compute how much memory we subtract from the total
memory, to get the Java memory
-
- final float memoryCutoffRatio = config.getFloat(
- ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO);
-
- final int minCutoff = config.getInteger(
- ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN);
-
- if (memoryCutoffRatio >= 1 || memoryCutoffRatio <= 0) {
- throw new IllegalArgumentException("The configuration
value '"
- +
ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO.key() + "' must be
between 0 and 1. Value given="
- + memoryCutoffRatio);
- }
-
- if (minCutoff >= containerMemoryMB) {
- throw new IllegalArgumentException("The configuration
value '"
- +
ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN.key() + "'='" + minCutoff
- + "' is larger than the total container memory
" + containerMemoryMB);
- }
-
- long cutoff = (long) (containerMemoryMB * memoryCutoffRatio);
- if (cutoff < minCutoff) {
- cutoff = minCutoff;
- }
-
- final long javaMemorySizeMB = containerMemoryMB - cutoff;
+ // (1) try to compute how much memory used by container
+ final long cutoffMB =
ResourceManagerRuntimeServices.calculateCutoffMB(config, containerMemoryMB);
--- End diff --
I would keep this method in the `ContaineredTaskManagerParameters` class.
---