Search in sources :

Example 21 with MemoryPolicyConfiguration

use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.

the class MemoryPolicyInitializationTest method prepareCustomConfigWithOverridingDefault.

/**
 */
private void prepareCustomConfigWithOverridingDefault() {
    memCfg = new MemoryConfiguration();
    memCfg.setMemoryPolicies(new MemoryPolicyConfiguration().setName(DFLT_MEM_PLC_DEFAULT_NAME).setInitialSize(USER_CUSTOM_MEM_PLC_SIZE).setMaxSize(USER_DEFAULT_MEM_PLC_SIZE));
}
Also used : MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 22 with MemoryPolicyConfiguration

use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.

the class MemoryPolicyInitializationTest method prepareCustomConfigWithOverridingDefaultAndCustom.

/**
 */
private void prepareCustomConfigWithOverridingDefaultAndCustom() {
    memCfg = new MemoryConfiguration();
    memCfg.setMemoryPolicies(new MemoryPolicyConfiguration().setName(DFLT_MEM_PLC_DEFAULT_NAME).setInitialSize(USER_CUSTOM_MEM_PLC_SIZE).setMaxSize(USER_DEFAULT_MEM_PLC_SIZE), new MemoryPolicyConfiguration().setName(CUSTOM_NON_DEFAULT_MEM_PLC_NAME).setInitialSize(USER_CUSTOM_MEM_PLC_SIZE).setMaxSize(USER_CUSTOM_MEM_PLC_SIZE));
}
Also used : MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 23 with MemoryPolicyConfiguration

use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.

the class PlatformConfigurationUtils method writeMemoryConfiguration.

/**
 * Writes the memory configuration.
 *
 * @param w Writer.
 * @param cfg Config.
 */
@SuppressWarnings("deprecation")
private static void writeMemoryConfiguration(BinaryRawWriter w, MemoryConfiguration cfg) {
    if (cfg == null) {
        w.writeBoolean(false);
        return;
    }
    w.writeBoolean(true);
    w.writeLong(cfg.getSystemCacheInitialSize());
    w.writeLong(cfg.getSystemCacheMaxSize());
    w.writeInt(cfg.getPageSize());
    w.writeInt(cfg.getConcurrencyLevel());
    w.writeString(cfg.getDefaultMemoryPolicyName());
    MemoryPolicyConfiguration[] plcs = cfg.getMemoryPolicies();
    if (plcs != null) {
        w.writeInt(plcs.length);
        for (MemoryPolicyConfiguration plc : plcs) {
            w.writeString(plc.getName());
            w.writeLong(plc.getInitialSize());
            w.writeLong(plc.getMaxSize());
            w.writeString(plc.getSwapFilePath());
            w.writeInt(plc.getPageEvictionMode().ordinal());
            w.writeDouble(plc.getEvictionThreshold());
            w.writeInt(plc.getEmptyPagesPoolSize());
            w.writeBoolean(plc.isMetricsEnabled());
            w.writeInt(plc.getSubIntervals());
            w.writeLong(plc.getRateTimeInterval());
        }
    } else
        w.writeInt(0);
}
Also used : MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 24 with MemoryPolicyConfiguration

use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.

the class PlatformConfigurationUtils method readMemoryConfiguration.

/**
 * Reads the memory configuration.
 *
 * @param in Reader
 * @return Config.
 */
@SuppressWarnings("deprecation")
private static MemoryConfiguration readMemoryConfiguration(BinaryRawReader in) {
    MemoryConfiguration res = new MemoryConfiguration();
    res.setSystemCacheInitialSize(in.readLong()).setSystemCacheMaxSize(in.readLong()).setPageSize(in.readInt()).setConcurrencyLevel(in.readInt()).setDefaultMemoryPolicyName(in.readString());
    int cnt = in.readInt();
    if (cnt > 0) {
        MemoryPolicyConfiguration[] plcs = new MemoryPolicyConfiguration[cnt];
        for (int i = 0; i < cnt; i++) {
            MemoryPolicyConfiguration cfg = new MemoryPolicyConfiguration();
            cfg.setName(in.readString()).setInitialSize(in.readLong()).setMaxSize(in.readLong()).setSwapFilePath(in.readString()).setPageEvictionMode(DataPageEvictionMode.values()[in.readInt()]).setEvictionThreshold(in.readDouble()).setEmptyPagesPoolSize(in.readInt()).setMetricsEnabled(in.readBoolean()).setSubIntervals(in.readInt()).setRateTimeInterval(in.readLong());
            plcs[i] = cfg;
        }
        res.setMemoryPolicies(plcs);
    }
    return res;
}
Also used : MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 25 with MemoryPolicyConfiguration

use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.

the class MemoryPolicyConfigValidationTest method createMemoryPolicy.

/**
 * @param name Name of MemoryPolicyConfiguration.
 * @param initialSize Initial size of MemoryPolicyConfiguration in bytes.
 * @param maxSize Max size of MemoryPolicyConfiguration in bytes.
 */
private MemoryPolicyConfiguration createMemoryPolicy(String name, long initialSize, long maxSize) {
    MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration();
    plc.setName(name);
    plc.setInitialSize(initialSize);
    plc.setMaxSize(maxSize);
    return plc;
}
Also used : MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Aggregations

MemoryPolicyConfiguration (org.apache.ignite.configuration.MemoryPolicyConfiguration)25 MemoryConfiguration (org.apache.ignite.configuration.MemoryConfiguration)14 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)3 MemoryMetricsImpl (org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)3 FreeListImpl (org.apache.ignite.internal.processors.cache.database.freelist.FreeListImpl)3 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 PersistentStoreConfiguration (org.apache.ignite.configuration.PersistentStoreConfiguration)2 IgniteEx (org.apache.ignite.internal.IgniteEx)2 IgniteOutOfMemoryException (org.apache.ignite.internal.mem.IgniteOutOfMemoryException)2 ArrayList (java.util.ArrayList)1 MemoryMetrics (org.apache.ignite.MemoryMetrics)1 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)1 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)1 SystemDataRegionConfiguration (org.apache.ignite.configuration.SystemDataRegionConfiguration)1 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)1 MappedFileMemoryProvider (org.apache.ignite.internal.mem.file.MappedFileMemoryProvider)1 PageMemory (org.apache.ignite.internal.pagemem.PageMemory)1 PageMemoryNoStoreImpl (org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl)1 MemoryPolicy (org.apache.ignite.internal.processors.cache.database.MemoryPolicy)1