Search in sources :

Example 6 with PersistentMemoryConfig

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

Example 7 with PersistentMemoryConfig

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

Example 8 with PersistentMemoryConfig

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());
}
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 9 with PersistentMemoryConfig

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

Example 10 with PersistentMemoryConfig

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());
}
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)

Aggregations

PersistentMemoryConfig (com.hazelcast.config.PersistentMemoryConfig)10 QuickTest (com.hazelcast.test.annotation.QuickTest)8 Test (org.junit.Test)8 PersistentMemoryDirectoryConfig (com.hazelcast.config.PersistentMemoryDirectoryConfig)7 XMLConfigBuilderTest (com.hazelcast.config.XMLConfigBuilderTest)3 YamlConfigBuilderTest (com.hazelcast.config.YamlConfigBuilderTest)3 NativeMemoryConfig (com.hazelcast.config.NativeMemoryConfig)2 Node (org.w3c.dom.Node)1