use of com.hazelcast.config.PersistentMemoryDirectoryConfig 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.PersistentMemoryDirectoryConfig in project hazelcast by hazelcast.
the class YamlClientConfigBuilderTest method testPersistentMemoryDirectoryConfiguration.
@Test
public void testPersistentMemoryDirectoryConfiguration() {
String yaml = "" + "hazelcast-client:\n" + " native-memory:\n" + " persistent-memory:\n" + " directories:\n" + " - directory: /mnt/pmem0\n" + " numa-node: 0\n" + " - directory: /mnt/pmem1\n" + " numa-node: 1\n";
ClientConfig config = buildConfig(yaml);
List<PersistentMemoryDirectoryConfig> directoryConfigs = config.getNativeMemoryConfig().getPersistentMemoryConfig().getDirectoryConfigs();
assertEquals(2, directoryConfigs.size());
PersistentMemoryDirectoryConfig dir0Config = directoryConfigs.get(0);
PersistentMemoryDirectoryConfig dir1Config = directoryConfigs.get(1);
assertEquals("/mnt/pmem0", dir0Config.getDirectory());
assertEquals(0, dir0Config.getNumaNode());
assertEquals("/mnt/pmem1", dir1Config.getDirectory());
assertEquals(1, dir1Config.getNumaNode());
}
use of com.hazelcast.config.PersistentMemoryDirectoryConfig 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());
}
use of com.hazelcast.config.PersistentMemoryDirectoryConfig in project hazelcast by hazelcast.
the class YamlMemberDomConfigProcessor method handlePersistentMemoryDirectory.
@Override
protected void handlePersistentMemoryDirectory(PersistentMemoryConfig persistentMemoryConfig, Node dirNode) {
String directory = getTextContent(getNamedItemNode(dirNode, "directory"));
String numaNodeIdStr = getTextContent(getNamedItemNode(dirNode, "numa-node"));
if (!StringUtil.isNullOrEmptyAfterTrim(numaNodeIdStr)) {
int numaNodeId = getIntegerValue("numa-node", numaNodeIdStr);
persistentMemoryConfig.addDirectoryConfig(new PersistentMemoryDirectoryConfig(directory, numaNodeId));
} else {
persistentMemoryConfig.addDirectoryConfig(new PersistentMemoryDirectoryConfig(directory));
}
}
Aggregations