Search in sources :

Example 11 with PersistentMemoryDirectoryConfig

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());
}
Also used : PersistentMemoryConfig(com.hazelcast.config.PersistentMemoryConfig) PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) YamlConfigBuilderTest(com.hazelcast.config.YamlConfigBuilderTest) Test(org.junit.Test)

Example 12 with PersistentMemoryDirectoryConfig

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());
}
Also used : PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) YamlConfigBuilderTest(com.hazelcast.config.YamlConfigBuilderTest) Test(org.junit.Test)

Example 13 with PersistentMemoryDirectoryConfig

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());
}
Also used : NativeMemoryConfig(com.hazelcast.config.NativeMemoryConfig) PersistentMemoryConfig(com.hazelcast.config.PersistentMemoryConfig) PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 14 with PersistentMemoryDirectoryConfig

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));
    }
}
Also used : PersistentMemoryDirectoryConfig(com.hazelcast.config.PersistentMemoryDirectoryConfig)

Aggregations

PersistentMemoryDirectoryConfig (com.hazelcast.config.PersistentMemoryDirectoryConfig)14 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 PersistentMemoryConfig (com.hazelcast.config.PersistentMemoryConfig)7 NativeMemoryConfig (com.hazelcast.config.NativeMemoryConfig)3 XMLConfigBuilderTest (com.hazelcast.config.XMLConfigBuilderTest)3 YamlConfigBuilderTest (com.hazelcast.config.YamlConfigBuilderTest)3 Node (org.w3c.dom.Node)2 MemorySize (com.hazelcast.memory.MemorySize)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1