use of com.hazelcast.config.PersistentMemoryConfig in project hazelcast by hazelcast.
the class ClientConfigXmlGenerator method nativeMemory.
private static void nativeMemory(XmlGenerator gen, NativeMemoryConfig nativeMemory) {
gen.open("native-memory", "enabled", nativeMemory.isEnabled(), "allocator-type", nativeMemory.getAllocatorType()).node("size", null, "value", nativeMemory.getSize().getValue(), "unit", nativeMemory.getSize().getUnit()).node("min-block-size", nativeMemory.getMinBlockSize()).node("page-size", nativeMemory.getPageSize()).node("metadata-space-percentage", nativeMemory.getMetadataSpacePercentage());
PersistentMemoryConfig pmemConfig = nativeMemory.getPersistentMemoryConfig();
List<PersistentMemoryDirectoryConfig> directoryConfigs = pmemConfig.getDirectoryConfigs();
gen.open("persistent-memory", "enabled", pmemConfig.isEnabled(), "mode", pmemConfig.getMode().name());
if (!directoryConfigs.isEmpty()) {
gen.open("directories");
for (PersistentMemoryDirectoryConfig dirConfig : directoryConfigs) {
if (dirConfig.isNumaNodeSet()) {
gen.node("directory", dirConfig.getDirectory(), "numa-node", dirConfig.getNumaNode());
} else {
gen.node("directory", dirConfig.getDirectory());
}
}
gen.close();
}
gen.close().close();
}
use of com.hazelcast.config.PersistentMemoryConfig in project hazelcast by hazelcast.
the class XmlClientConfigBuilderTest method testPersistentMemoryDirectoryConfigurationSimple.
@Override
@Test
public void testPersistentMemoryDirectoryConfigurationSimple() {
String xml = HAZELCAST_CLIENT_START_TAG + "<native-memory>\n" + " <persistent-memory-directory>/mnt/pmem0</persistent-memory-directory>\n" + "</native-memory>\n" + HAZELCAST_CLIENT_END_TAG;
ClientConfig xmlConfig = buildConfig(xml);
PersistentMemoryConfig pmemConfig = xmlConfig.getNativeMemoryConfig().getPersistentMemoryConfig();
assertTrue(pmemConfig.isEnabled());
List<PersistentMemoryDirectoryConfig> directoryConfigs = pmemConfig.getDirectoryConfigs();
assertEquals(1, directoryConfigs.size());
PersistentMemoryDirectoryConfig dir0Config = directoryConfigs.get(0);
assertEquals("/mnt/pmem0", dir0Config.getDirectory());
assertFalse(dir0Config.isNumaNodeSet());
}
use of com.hazelcast.config.PersistentMemoryConfig in project hazelcast by hazelcast.
the class YamlClientConfigBuilderTest method testPersistentMemoryDirectoryConfigurationSimple.
@Test
public void testPersistentMemoryDirectoryConfigurationSimple() {
String yaml = "" + "hazelcast-client:\n" + " native-memory:\n" + " persistent-memory-directory: /mnt/pmem0";
ClientConfig config = buildConfig(yaml);
PersistentMemoryConfig pmemConfig = config.getNativeMemoryConfig().getPersistentMemoryConfig();
assertTrue(pmemConfig.isEnabled());
List<PersistentMemoryDirectoryConfig> directoryConfigs = pmemConfig.getDirectoryConfigs();
assertEquals(1, directoryConfigs.size());
PersistentMemoryDirectoryConfig dir0Config = directoryConfigs.get(0);
assertEquals("/mnt/pmem0", dir0Config.getDirectory());
assertFalse(dir0Config.isNumaNodeSet());
}
use of com.hazelcast.config.PersistentMemoryConfig in project hazelcast by hazelcast.
the class TestClientApplicationContext method testNativeMemorySystemMemory.
@Test
public void testNativeMemorySystemMemory() {
NativeMemoryConfig nativeMemoryConfig = pmemSystemMemoryClient.getClientConfig().getNativeMemoryConfig();
assertFalse(nativeMemoryConfig.isEnabled());
assertEquals(MemoryUnit.GIGABYTES, nativeMemoryConfig.getSize().getUnit());
assertEquals(256, nativeMemoryConfig.getSize().getValue());
assertEquals(20, nativeMemoryConfig.getPageSize());
assertEquals(NativeMemoryConfig.MemoryAllocatorType.STANDARD, nativeMemoryConfig.getAllocatorType());
assertEquals(10.2, nativeMemoryConfig.getMetadataSpacePercentage(), 0.1);
assertEquals(10, nativeMemoryConfig.getMinBlockSize());
PersistentMemoryConfig pmemConfig = nativeMemoryConfig.getPersistentMemoryConfig();
assertTrue(pmemConfig.isEnabled());
assertEquals(SYSTEM_MEMORY, pmemConfig.getMode());
}
use of com.hazelcast.config.PersistentMemoryConfig in project hazelcast by hazelcast.
the class TestClientApplicationContext method testNativeMemory.
@Test
public void testNativeMemory() {
NativeMemoryConfig nativeMemoryConfig = nativeMemoryClient.getClientConfig().getNativeMemoryConfig();
assertFalse(nativeMemoryConfig.isEnabled());
assertEquals(MemoryUnit.GIGABYTES, nativeMemoryConfig.getSize().getUnit());
assertEquals(256, nativeMemoryConfig.getSize().getValue());
assertEquals(20, nativeMemoryConfig.getPageSize());
assertEquals(NativeMemoryConfig.MemoryAllocatorType.STANDARD, nativeMemoryConfig.getAllocatorType());
assertEquals(10.2, nativeMemoryConfig.getMetadataSpacePercentage(), 0.1);
assertEquals(10, nativeMemoryConfig.getMinBlockSize());
PersistentMemoryConfig pmemConfig = nativeMemoryConfig.getPersistentMemoryConfig();
assertFalse(pmemConfig.isEnabled());
assertEquals(MOUNTED, pmemConfig.getMode());
List<PersistentMemoryDirectoryConfig> directoryConfigs = pmemConfig.getDirectoryConfigs();
assertEquals(2, directoryConfigs.size());
assertEquals("/mnt/pmem0", directoryConfigs.get(0).getDirectory());
assertEquals(0, directoryConfigs.get(0).getNumaNode());
assertEquals("/mnt/pmem1", directoryConfigs.get(1).getDirectory());
assertEquals(1, directoryConfigs.get(1).getNumaNode());
}
Aggregations