use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class ProcessMemoryUtilsTestBase method testConfigLegacyHeapSize.
@Test
public void testConfigLegacyHeapSize() {
MemorySize legacyHeapSize = MemorySize.parse("1g");
Configuration conf = new Configuration();
conf.set(legacyMemoryOptions.getHeap(), legacyHeapSize);
testConfigLegacyHeapMemory(conf, legacyHeapSize);
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class ProcessMemoryUtilsTestBase method testDerivedTotalProcessMemoryGreaterThanConfiguredFailureWithTotalFlinkMemory.
@Test
public void testDerivedTotalProcessMemoryGreaterThanConfiguredFailureWithTotalFlinkMemory() {
Configuration conf = getConfigurationWithJvmMetaspaceAndTotalFlinkMemory(100, 200);
// Total Flink memory + JVM Metaspace > Total Process Memory (no space for JVM overhead)
MemorySize totalFlinkMemorySize = MemorySize.ofMebiBytes(150);
conf.set(options.getTotalFlinkMemoryOption(), totalFlinkMemorySize);
validateFail(conf);
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class ProcessMemoryUtilsTestBase method testConfigLegacyHeapEnv.
@Test
public void testConfigLegacyHeapEnv() {
MemorySize jvmHeapSize = MemorySize.parse("1g");
Map<String, String> env = new HashMap<>();
env.put(legacyMemoryOptions.getEnvVar(), "1g");
CommonTestUtils.setEnv(env);
testConfigLegacyHeapMemory(new Configuration(), jvmHeapSize);
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class ProcessMemoryUtilsTestBase method testConfigJvmOverheadFraction.
@Test
public void testConfigJvmOverheadFraction() {
MemorySize minSize = MemorySize.ZERO;
MemorySize maxSize = MemorySize.parse("1t");
@SuppressWarnings("MagicNumber") float fraction = 0.2f;
Configuration conf = new Configuration();
conf.set(options.getJvmOptions().getJvmOverheadMax(), maxSize);
conf.set(options.getJvmOptions().getJvmOverheadMin(), minSize);
conf.setFloat(options.getJvmOptions().getJvmOverheadFraction(), fraction);
validateInAllConfigurations(conf, jobManagerProcessSpec -> assertThat(jobManagerProcessSpec.getJvmOverheadSize(), is(jobManagerProcessSpec.getTotalProcessMemorySize().multiply(fraction))));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class ProcessMemoryUtilsTestBase method testConfigJvmOverheadRange.
@Test
public void testConfigJvmOverheadRange() {
MemorySize minSize = MemorySize.parse("50m");
MemorySize maxSize = MemorySize.parse("200m");
Configuration conf = new Configuration();
conf.set(options.getJvmOptions().getJvmOverheadMax(), maxSize);
conf.set(options.getJvmOptions().getJvmOverheadMin(), minSize);
validateInAllConfigurations(conf, JobManagerProcessSpec -> {
assertThat(JobManagerProcessSpec.getJvmOverheadSize().getBytes(), greaterThanOrEqualTo(minSize.getBytes()));
assertThat(JobManagerProcessSpec.getJvmOverheadSize().getBytes(), lessThanOrEqualTo(maxSize.getBytes()));
});
}
Aggregations