You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/10/24 08:47:30 UTC

[23/50] [abbrv] ignite git commit: IGNITE-6030 Allow enabling persistence per data region

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
new file mode 100644
index 0000000..50edf5c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataRegionConfiguration.java
@@ -0,0 +1,406 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.configuration;
+
+import java.io.Serializable;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_DATA_REG_DEFAULT_NAME;
+
+/**
+ * This class allows defining custom data regions' configurations with various parameters for Apache Ignite
+ * page memory (see {@link DataStorageConfiguration}. For each configured data region Apache Ignite instantiates
+ * respective memory regions with different parameters like maximum size, eviction policy, swapping options,
+ * persistent mode flag, etc.
+ * An Apache Ignite cache can be mapped to a particular region using
+ * {@link CacheConfiguration#setDataRegionName(String)} method.
+ * <p>Sample configuration below shows how to configure several data regions:</p>
+ * <pre>
+ *     {@code
+ *     <property name="memoryConfiguration">
+ *         <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+ *             <property name="defaultRegionConfiguration">
+ *                 <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ *                     <property name="name" value="Default_Region"/>
+ *                     <property name="initialSize" value="#{100 * 1024 * 1024}"/>
+ *                     <property name="maxSize" value="#{5 * 1024 * 102 * 1024}"/>
+ *                 </bean>
+ *             </property>
+ *
+ *             <property name="pageSize" value="4096"/>
+ *
+ *             <property name="dataRegions">
+ *                 <list>
+ *                      <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ *                          <property name="name" value="20MB_Region_Eviction"/>
+ *                          <property name="initialSize" value="#{20 * 1024 * 1024}"/>
+ *                          <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
+ *                      </bean>
+ *
+ *                      <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ *                          <property name="name" value="25MB_Region_Swapping"/>
+ *                          <property name="initialSize" value="#{25 * 1024 * 1024}"/>
+ *                          <property name="initialSize" value="#{100 * 1024 * 1024}"/>
+ *                          <property name="swapPath" value="db/swap"/>
+ *                      </bean>
+ *                  </list>
+ *              </property>
+ *     }
+ * </pre>
+ */
+public final class DataRegionConfiguration implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Default metrics enabled flag. */
+    public static final boolean DFLT_METRICS_ENABLED = false;
+
+    /** Default amount of sub intervals to calculate {@link DataRegionMetrics#getAllocationRate()} metric. */
+    public static final int DFLT_SUB_INTERVALS = 5;
+
+    /** Default length of interval over which {@link DataRegionMetrics#getAllocationRate()} metric is calculated. */
+    public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000;
+
+    /** Data region name. */
+    private String name = DFLT_DATA_REG_DEFAULT_NAME;
+
+    /** Data region maximum size in memory. */
+    private long maxSize = DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE;
+
+    /** Data region start size. */
+    private long initSize = Math.min(
+        DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE, DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE);
+
+    /** An optional path to a memory mapped files directory for this data region. */
+    private String swapPath;
+
+    /** An algorithm for memory pages eviction. */
+    private DataPageEvictionMode pageEvictionMode = DataPageEvictionMode.DISABLED;
+
+    /**
+     * A threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the page
+     * memory will start the eviction only after 90% data region is occupied.
+     */
+    private double evictionThreshold = 0.9;
+
+    /** Minimum number of empty pages in reuse lists. */
+    private int emptyPagesPoolSize = 100;
+
+    /**
+     * Flag to enable the memory metrics collection for this data region.
+     */
+    private boolean metricsEnabled = DFLT_METRICS_ENABLED;
+
+    /** Number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+     * {@link DataRegionMetrics#getAllocationRate()} and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+     * <p>
+     * Setting it to a bigger value will result in more precise calculation and smaller drops of
+     * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+     * calculation overhead. */
+    private int metricsSubIntervalCount = DFLT_SUB_INTERVALS;
+
+    /**
+     * Time interval (in milliseconds) for {@link DataRegionMetrics#getAllocationRate()}
+     * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+     * <p>
+     * For instance, after setting the interval to 60_000 milliseconds, subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+     * will return average allocation rate (pages per second) for the last minute.
+     */
+    private long metricsRateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
+
+    /**
+     * Flag to enable Ignite Native Persistence.
+     */
+    private boolean persistenceEnabled = false;
+
+    /**
+     * Gets data region name.
+     *
+     * @return Data region name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets data region name. The name must be non empty and must not be equal to the reserved 'sysMemPlc' one.
+     *
+     * If not specified, {@link DataStorageConfiguration#DFLT_DATA_REG_DEFAULT_NAME} value is used.
+     *
+     * @param name Data region name.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setName(String name) {
+        this.name = name;
+
+        return this;
+    }
+
+    /**
+     * Maximum memory region size defined by this data region. If the whole data can not fit into the memory region
+     * an out of memory exception will be thrown.
+     *
+     * @return Size in bytes.
+     */
+    public long getMaxSize() {
+        return maxSize;
+    }
+
+    /**
+     * Sets maximum memory region size defined by this data region. The total size should not be less than 10 MB
+     * due to the internal data structures overhead.
+     *
+     * @param maxSize Maximum data region size in bytes.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setMaxSize(long maxSize) {
+        this.maxSize = maxSize;
+
+        return this;
+    }
+
+    /**
+     * Gets initial memory region size defined by this data region. When the used memory size exceeds this value,
+     * new chunks of memory will be allocated.
+     *
+     * @return Data region start size.
+     */
+    public long getInitialSize() {
+        return initSize;
+    }
+
+    /**
+     * Sets initial memory region size defined by this data region. When the used memory size exceeds this value,
+     * new chunks of memory will be allocated.
+     *
+     * @param initSize Data region initial size.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setInitialSize(long initSize) {
+        this.initSize = initSize;
+
+        return this;
+    }
+
+    /**
+     * A path to the memory-mapped files the memory region defined by this data region will be mapped to. Having
+     * the path set, allows relying on swapping capabilities of an underlying operating system for the memory region.
+     *
+     * @return A path to the memory-mapped files or {@code null} if this feature is not used for the memory region
+     *         defined by this data region.
+     */
+    public String getSwapPath() {
+        return swapPath;
+    }
+
+    /**
+     * Sets a path to the memory-mapped files.
+     *
+     * @param swapFilePath A Path to the memory mapped file.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setSwapPath(String swapFilePath) {
+        this.swapPath = swapFilePath;
+
+        return this;
+    }
+
+    /**
+     * Gets memory pages eviction mode. If {@link DataPageEvictionMode#DISABLED} is used (default) then an out of
+     * memory exception will be thrown if the memory region usage, defined by this data region, goes beyond its
+     * capacity which is {@link #getMaxSize()}.
+     *
+     * @return Memory pages eviction algorithm. {@link DataPageEvictionMode#DISABLED} used by default.
+     */
+    public DataPageEvictionMode getPageEvictionMode() {
+        return pageEvictionMode;
+    }
+
+    /**
+     * Sets memory pages eviction mode.
+     *
+     * @param evictionMode Eviction mode.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setPageEvictionMode(DataPageEvictionMode evictionMode) {
+        pageEvictionMode = evictionMode;
+
+        return this;
+    }
+
+    /**
+     * Gets a threshold for memory pages eviction initiation. For instance, if the threshold is 0.9 it means that the
+     * page memory will start the eviction only after 90% of the data region is occupied.
+     *
+     * @return Memory pages eviction threshold.
+     */
+    public double getEvictionThreshold() {
+        return evictionThreshold;
+    }
+
+    /**
+     * Sets memory pages eviction threshold.
+     *
+     * @param evictionThreshold Eviction threshold.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setEvictionThreshold(double evictionThreshold) {
+        this.evictionThreshold = evictionThreshold;
+
+        return this;
+    }
+
+    /**
+     * Specifies the minimal number of empty pages to be present in reuse lists for this data region.
+     * This parameter ensures that Ignite will be able to successfully evict old data entries when the size of
+     * (key, value) pair is slightly larger than page size / 2.
+     * Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough
+     * to contain largest cache entry).
+     * Increase this parameter if {@link IgniteOutOfMemoryException} occurred with enabled page eviction.
+     *
+     * @return Minimum number of empty pages in reuse list.
+     */
+    public int getEmptyPagesPoolSize() {
+        return emptyPagesPoolSize;
+    }
+
+    /**
+     * Specifies the minimal number of empty pages to be present in reuse lists for this data region.
+     * This parameter ensures that Ignite will be able to successfully evict old data entries when the size of
+     * (key, value) pair is slightly larger than page size / 2.
+     * Increase this parameter if cache can contain very big entries (total size of pages in this pool should be enough
+     * to contain largest cache entry).
+     * Increase this parameter if {@link IgniteOutOfMemoryException} occurred with enabled page eviction.
+     *
+     * @param emptyPagesPoolSize Empty pages pool size.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setEmptyPagesPoolSize(int emptyPagesPoolSize) {
+        this.emptyPagesPoolSize = emptyPagesPoolSize;
+
+        return this;
+    }
+
+    /**
+     * Gets whether memory metrics are enabled by default on node startup. Memory metrics can be enabled and disabled
+     * at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
+     *
+     * @return Metrics enabled flag.
+     */
+    public boolean isMetricsEnabled() {
+        return metricsEnabled;
+    }
+
+    /**
+     * Sets memory metrics enabled flag. If this flag is {@code true}, metrics will be enabled on node startup.
+     * Memory metrics can be enabled and disabled at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
+     *
+     * @param metricsEnabled Metrics enabled flag.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setMetricsEnabled(boolean metricsEnabled) {
+        this.metricsEnabled = metricsEnabled;
+
+        return this;
+    }
+
+    /**
+     * Gets whether persistence is enabled for this data region. All caches residing in this region will be persistent.
+     *
+     * @return Persistence enabled flag.
+     */
+    public boolean isPersistenceEnabled() {
+        return persistenceEnabled;
+    }
+
+    /**
+     * Sets persistence enabled flag.
+     *
+     * @param persistenceEnabled Persistence enabled flag.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setPersistenceEnabled(boolean persistenceEnabled) {
+        this.persistenceEnabled = persistenceEnabled;
+
+        return this;
+    }
+
+    /**
+     * Gets time interval for {@link DataRegionMetrics#getAllocationRate()}
+     * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+     * <p>
+     * For instance, after setting the interval to 60_000 milliseconds,
+     * subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+     * will return average allocation rate (pages per second) for the last minute.
+     *
+     * @return Time interval over which allocation rate is calculated.
+     */
+    public long getMetricsRateTimeInterval() {
+        return metricsRateTimeInterval;
+    }
+
+    /**
+     * Sets time interval for {@link DataRegionMetrics#getAllocationRate()}
+     * and {@link DataRegionMetrics#getEvictionRate()} monitoring purposes.
+     * <p>
+     * For instance, after setting the interval to 60 seconds,
+     * subsequent calls to {@link DataRegionMetrics#getAllocationRate()}
+     * will return average allocation rate (pages per second) for the last minute.
+     *
+     * @param metricsRateTimeInterval Time interval used for allocation and eviction rates calculations.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setMetricsRateTimeInterval(long metricsRateTimeInterval) {
+        this.metricsRateTimeInterval = metricsRateTimeInterval;
+
+        return this;
+    }
+
+    /**
+     * Gets a number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)}
+     * will be split into to calculate {@link DataRegionMetrics#getAllocationRate()}
+     * and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+     * <p>
+     * Setting it to a bigger value will result in more precise calculation and smaller drops of
+     * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+     * calculation overhead.
+     *
+     * @return number of sub intervals.
+     */
+    public int getMetricsSubIntervalCount() {
+        return metricsSubIntervalCount;
+    }
+
+    /**
+     * Sets a number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+     * {@link DataRegionMetrics#getAllocationRate()} and {@link DataRegionMetrics#getEvictionRate()} rates (5 by default).
+     * <p>
+     * Setting it to a bigger value will result in more precise calculation and smaller drops of
+     * {@link DataRegionMetrics#getAllocationRate()} metric when next sub-interval has to be recycled but introduces bigger
+     * calculation overhead.
+     *
+     * @param metricsSubIntervalCnt A number of sub-intervals.
+     * @return {@code this} for chaining.
+     */
+    public DataRegionConfiguration setMetricsSubIntervalCount(int metricsSubIntervalCnt) {
+        this.metricsSubIntervalCount = metricsSubIntervalCnt;
+
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
new file mode 100644
index 0000000..bd314ab
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/DataStorageConfiguration.java
@@ -0,0 +1,882 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.configuration;
+
+import java.io.Serializable;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * A durable memory configuration for an Apache Ignite node. The durable memory is a manageable off-heap based memory
+ * architecture that divides all expandable data regions into pages of fixed size
+ * (see {@link DataStorageConfiguration#getPageSize()}). An individual page can store one or many cache key-value entries
+ * that allows reusing the memory in the most efficient way and avoid memory fragmentation issues.
+ * <p>
+ * By default, the durable memory allocates a single expandable data region with default settings. All the caches that
+ * will be configured in an application will be mapped to this data region by default, thus, all the cache data will
+ * reside in that data region. Parameters of default data region can be changed by setting
+ * {@link DataStorageConfiguration#setDefaultDataRegionConfiguration(DataRegionConfiguration)}.
+ * Other data regions (except default) can be configured with
+ * {@link DataStorageConfiguration#setDataRegionConfigurations(DataRegionConfiguration...)}.
+ * <p>
+ * Data region can be used in memory-only mode, or in persistent mode, when memory is used as a caching layer for disk.
+ * Persistence for data region can be turned on with {@link DataRegionConfiguration#setPersistenceEnabled(boolean)}
+ * flag. To learn more about data regions refer to {@link DataRegionConfiguration} documentation.
+ * <p>Sample configuration below shows how to make 5 GB data regions the default one for Apache Ignite:</p>
+ * <pre>
+ *     {@code
+ *
+ *     <property name="dataStorageConfiguration">
+ *         <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
+ *             <property name="systemCacheInitialSize" value="#{100 * 1024 * 1024}"/>
+ *
+ *             <property name="defaultDataRegionConfiguration">
+ *                 <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
+ *                     <property name="name" value="default_data_region"/>
+ *                     <property name="initialSize" value="#{5 * 1024 * 1024 * 1024}"/>
+ *                 </bean>
+ *             </property>
+ *         </bean>
+ *     </property>
+ *     }
+ * </pre>
+ */
+public class DataStorageConfiguration implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Default data region start size (256 MB). */
+    @SuppressWarnings("UnnecessaryBoxing")
+    public static final long DFLT_DATA_REGION_INITIAL_SIZE = 256L * 1024 * 1024;
+
+    /** Fraction of available memory to allocate for default DataRegion. */
+    private static final double DFLT_DATA_REGION_FRACTION = 0.2;
+
+    /** Default data region's size is 20% of physical memory available on current machine. */
+    public static final long DFLT_DATA_REGION_MAX_SIZE = Math.max(
+        (long)(DFLT_DATA_REGION_FRACTION * U.getTotalMemoryAvailable()),
+        DFLT_DATA_REGION_INITIAL_SIZE);
+
+    /** Default initial size of a memory chunk for the system cache (40 MB). */
+    private static final long DFLT_SYS_CACHE_INIT_SIZE = 40 * 1024 * 1024;
+
+    /** Default max size of a memory chunk for the system cache (100 MB). */
+    private static final long DFLT_SYS_CACHE_MAX_SIZE = 100 * 1024 * 1024;
+
+    /** Default memory page size. */
+    public static final int DFLT_PAGE_SIZE = 4 * 1024;
+
+    /** This name is assigned to default Dataregion if no user-defined default MemPlc is specified */
+    public static final String DFLT_DATA_REG_DEFAULT_NAME = "default";
+
+    /** */
+    public static final int DFLT_CHECKPOINT_FREQ = 180000;
+
+    /** Lock default wait time, 10 sec. */
+    public static final int DFLT_LOCK_WAIT_TIME = 10 * 1000;
+
+    /** */
+    public static final boolean DFLT_METRICS_ENABLED = false;
+
+    /** Default amount of sub intervals to calculate rate-based metric. */
+    public static final int DFLT_SUB_INTERVALS = 5;
+
+    /** Default length of interval over which rate-based metric is calculated. */
+    public static final int DFLT_RATE_TIME_INTERVAL_MILLIS = 60_000;
+
+    /** Default number of checkpoint threads. */
+    public static final int DFLT_CHECKPOINT_THREADS = 4;
+
+    /** Default checkpoint write order. */
+    public static final CheckpointWriteOrder DFLT_CHECKPOINT_WRITE_ORDER = CheckpointWriteOrder.SEQUENTIAL;
+
+    /** Default number of checkpoints to be kept in WAL after checkpoint is finished */
+    public static final int DFLT_WAL_HISTORY_SIZE = 20;
+
+    /** */
+    public static final int DFLT_WAL_SEGMENTS = 10;
+
+    /** Default WAL file segment size, 64MBytes */
+    public static final int DFLT_WAL_SEGMENT_SIZE = 64 * 1024 * 1024;
+
+    /** Default wal mode. */
+    public static final WALMode DFLT_WAL_MODE = WALMode.DEFAULT;
+
+    /** Default thread local buffer size. */
+    public static final int DFLT_TLB_SIZE = 128 * 1024;
+
+    /** Default Wal flush frequency. */
+    public static final int DFLT_WAL_FLUSH_FREQ = 2000;
+
+    /** Default wal fsync delay. */
+    public static final int DFLT_WAL_FSYNC_DELAY = 1000;
+
+    /** Default wal record iterator buffer size. */
+    public static final int DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE = 64 * 1024 * 1024;
+
+    /** Default wal always write full pages. */
+    public static final boolean DFLT_WAL_ALWAYS_WRITE_FULL_PAGES = false;
+
+    /** Default wal directory. */
+    public static final String DFLT_WAL_PATH = "db/wal";
+
+    /** Default wal archive directory. */
+    public static final String DFLT_WAL_ARCHIVE_PATH = "db/wal/archive";
+
+    /** Default write throttling enabled. */
+    public static final boolean DFLT_WRITE_THROTTLING_ENABLED = false;
+
+    /** Size of a memory chunk reserved for system cache initially. */
+    private long sysRegionInitSize = DFLT_SYS_CACHE_INIT_SIZE;
+
+    /** Maximum size of system cache. */
+    private long sysCacheMaxSize = DFLT_SYS_CACHE_MAX_SIZE;
+
+    /** Memory page size. */
+    private int pageSize;
+
+    /** Concurrency level. */
+    private int concLvl;
+
+    /** Configuration of default data region. */
+    private DataRegionConfiguration dfltDataRegConf = new DataRegionConfiguration();
+
+    /** Data regions. */
+    private DataRegionConfiguration[] dataRegions;
+
+    /** Directory where index and partition files are stored. */
+    private String storagePath;
+
+    /** Checkpoint frequency. */
+    private long checkpointFreq = DFLT_CHECKPOINT_FREQ;
+
+    /** Lock wait time, in milliseconds. */
+    private long lockWaitTime = DFLT_LOCK_WAIT_TIME;
+
+    /** */
+    private long checkpointPageBufSize;
+
+    /** */
+    private int checkpointThreads = DFLT_CHECKPOINT_THREADS;
+
+    /** Checkpoint write order. */
+    private CheckpointWriteOrder checkpointWriteOrder = DFLT_CHECKPOINT_WRITE_ORDER;
+
+    /** Number of checkpoints to keep */
+    private int walHistSize = DFLT_WAL_HISTORY_SIZE;
+
+    /** Number of work WAL segments. */
+    private int walSegments = DFLT_WAL_SEGMENTS;
+
+    /** Size of one WAL segment in bytes. 64 Mb is used by default.  Maximum value is 2Gb */
+    private int walSegmentSize = DFLT_WAL_SEGMENT_SIZE;
+
+    /** Directory where WAL is stored (work directory) */
+    private String walPath = DFLT_WAL_PATH;
+
+    /** WAL archive path. */
+    private String walArchivePath = DFLT_WAL_ARCHIVE_PATH;
+
+    /** Metrics enabled flag. */
+    private boolean metricsEnabled = DFLT_METRICS_ENABLED;
+
+    /** Wal mode. */
+    private WALMode walMode = DFLT_WAL_MODE;
+
+    /** WAl thread local buffer size. */
+    private int walTlbSize = DFLT_TLB_SIZE;
+
+    /** Wal flush frequency in milliseconds. */
+    private long walFlushFreq = DFLT_WAL_FLUSH_FREQ;
+
+    /** Wal fsync delay. */
+    private long walFsyncDelay = DFLT_WAL_FSYNC_DELAY;
+
+    /** Wal record iterator buffer size. */
+    private int walRecordIterBuffSize = DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE;
+
+    /** Always write full pages. */
+    private boolean alwaysWriteFullPages = DFLT_WAL_ALWAYS_WRITE_FULL_PAGES;
+
+    /** Factory to provide I/O interface for files */
+    private FileIOFactory fileIOFactory =
+        IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_USE_ASYNC_FILE_IO_FACTORY, false) ?
+            new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
+
+    /**
+     * Number of sub-intervals the whole {@link #setMetricsRateTimeInterval(long)} will be split into to calculate
+     * rate-based metrics.
+     * <p>
+     * Setting it to a bigger value will result in more precise calculation and smaller drops of
+     * rate-based metrics when next sub-interval has to be recycled but introduces bigger
+     * calculation overhead.
+     */
+    private int metricsSubIntervalCount = DFLT_SUB_INTERVALS;
+
+    /** Time interval (in milliseconds) for rate-based metrics. */
+    private long metricsRateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
+
+    /**
+     *  Time interval (in milliseconds) for running auto archiving for incompletely WAL segment
+     */
+    private long walAutoArchiveAfterInactivity = -1;
+
+    /**
+     * If true, threads that generate dirty pages too fast during ongoing checkpoint will be throttled.
+     */
+    private boolean writeThrottlingEnabled = DFLT_WRITE_THROTTLING_ENABLED;
+
+    /**
+     * Initial size of a data region reserved for system cache.
+     *
+     * @return Size in bytes.
+     */
+    public long getSystemRegionInitialSize() {
+        return sysRegionInitSize;
+    }
+
+    /**
+     * Sets initial size of a data region reserved for system cache.
+     *
+     * Default value is {@link #DFLT_SYS_CACHE_INIT_SIZE}
+     *
+     * @param sysRegionInitSize Size in bytes.
+     *
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setSystemRegionInitialSize(long sysRegionInitSize) {
+        A.ensure(sysCacheMaxSize > 0, "System region initial size can not be less zero.");
+
+        this.sysRegionInitSize = sysRegionInitSize;
+
+        return this;
+    }
+
+    /**
+     * Maximum data region size reserved for system cache.
+     *
+     * @return Size in bytes.
+     */
+    public long getSystemRegionMaxSize() {
+        return sysCacheMaxSize;
+    }
+
+    /**
+     * Sets maximum data region size reserved for system cache. The total size should not be less than 10 MB
+     * due to internal data structures overhead.
+     *
+     * @param sysCacheMaxSize Maximum size in bytes for system cache data region.
+     *
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setSystemRegionMaxSize(long sysCacheMaxSize) {
+        A.ensure(sysCacheMaxSize > 0, "System cache max size can not be less zero.");
+
+        this.sysCacheMaxSize = sysCacheMaxSize;
+
+        return this;
+    }
+
+    /**
+     * The page memory consists of one or more expandable data regions defined by {@link DataRegionConfiguration}.
+     * Every data region is split on pages of fixed size that store actual cache entries.
+     *
+     * @return Page size in bytes.
+     */
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    /**
+     * Changes the page size.
+     *
+     * @param pageSize Page size in bytes. If value is not set (or zero), {@link #DFLT_PAGE_SIZE} will be used.
+     */
+    public DataStorageConfiguration setPageSize(int pageSize) {
+        if (pageSize != 0) {
+            A.ensure(pageSize >= 1024 && pageSize <= 16 * 1024, "Page size must be between 1kB and 16kB.");
+            A.ensure(U.isPow2(pageSize), "Page size must be a power of 2.");
+        }
+
+        this.pageSize = pageSize;
+
+        return this;
+    }
+
+    /**
+     * Gets an array of all data regions configured. Apache Ignite will instantiate a dedicated data region per
+     * region. An Apache Ignite cache can be mapped to a specific region with
+     * {@link CacheConfiguration#setDataRegionName(String)} method.
+     *
+     * @return Array of configured data regions.
+     */
+    public DataRegionConfiguration[] getDataRegionConfigurations() {
+        return dataRegions;
+    }
+
+    /**
+     * Sets data regions configurations.
+     *
+     * @param dataRegionConfigurations Data regions configurations.
+     */
+    public DataStorageConfiguration setDataRegionConfigurations(DataRegionConfiguration... dataRegionConfigurations) {
+        this.dataRegions = dataRegionConfigurations;
+
+        return this;
+    }
+
+    /**
+     * Returns the number of concurrent segments in Ignite internal page mapping tables. By default equals
+     * to the number of available CPUs.
+     *
+     * @return Mapping table concurrency level.
+     */
+    public int getConcurrencyLevel() {
+        return concLvl;
+    }
+
+    /**
+     * Sets the number of concurrent segments in Ignite internal page mapping tables.
+     *
+     * @param concLvl Mapping table concurrency level.
+     */
+    public DataStorageConfiguration setConcurrencyLevel(int concLvl) {
+        this.concLvl = concLvl;
+
+        return this;
+    }
+
+    /**
+     * @return Configuration of default data region. All cache groups will reside in this data region by default.
+     * For assigning a custom data region to cache group, use {@link CacheConfiguration#setDataRegionName(String)}.
+     */
+    public DataRegionConfiguration getDefaultDataRegionConfiguration() {
+        return dfltDataRegConf;
+    }
+
+    /**
+     * Overrides configuration of default data region which is created automatically.
+     * @param dfltDataRegConf Default data region configuration.
+     */
+    public DataStorageConfiguration setDefaultDataRegionConfiguration(DataRegionConfiguration dfltDataRegConf) {
+        this.dfltDataRegConf = dfltDataRegConf;
+
+        return this;
+    }
+
+    /**
+     * Returns a path the root directory where the Persistent Store will persist data and indexes.
+     */
+    public String getStoragePath() {
+        return storagePath;
+    }
+
+    /**
+     * Sets a path to the root directory where the Persistent Store will persist data and indexes.
+     * By default the Persistent Store's files are located under Ignite work directory.
+     *
+     * @param persistenceStorePath Persistence store path.
+     */
+    public DataStorageConfiguration setStoragePath(String persistenceStorePath) {
+        this.storagePath = persistenceStorePath;
+
+        return this;
+    }
+
+    /**
+     * Gets checkpoint frequency.
+     *
+     * @return checkpoint frequency in milliseconds.
+     */
+    public long getCheckpointFrequency() {
+        return checkpointFreq <= 0 ? DFLT_CHECKPOINT_FREQ : checkpointFreq;
+    }
+
+    /**
+     * Sets the checkpoint frequency which is a minimal interval when the dirty pages will be written
+     * to the Persistent Store. If the rate is high, checkpoint will be triggered more frequently.
+     *
+     * @param checkpointFreq checkpoint frequency in milliseconds.
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setCheckpointFrequency(long checkpointFreq) {
+        this.checkpointFreq = checkpointFreq;
+
+        return this;
+    }
+
+    /**
+     * Gets amount of memory allocated for a checkpoint temporary buffer.
+     *
+     * @return Checkpoint page buffer size in bytes or {@code 0} for Ignite
+     *      to choose the buffer size automatically.
+     */
+    public long getCheckpointPageBufferSize() {
+        return checkpointPageBufSize;
+    }
+
+    /**
+     * Sets amount of memory allocated for the checkpoint temporary buffer. The buffer is used to create temporary
+     * copies of pages that are being written to disk and being update in parallel while the checkpoint is in
+     * progress.
+     *
+     * @param checkpointPageBufSize Checkpoint page buffer size in bytes or {@code 0} for Ignite to
+     *      choose the buffer size automatically.
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setCheckpointPageBufferSize(long checkpointPageBufSize) {
+        this.checkpointPageBufSize = checkpointPageBufSize;
+
+        return this;
+    }
+
+
+    /**
+     * Gets a number of threads to use for the checkpoint purposes.
+     *
+     * @return Number of checkpoint threads.
+     */
+    public int getCheckpointThreads() {
+        return checkpointThreads;
+    }
+
+    /**
+     * Sets a number of threads to use for the checkpoint purposes.
+     *
+     * @param checkpointThreads Number of checkpoint threads. Four threads are used by default.
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setCheckpointThreads(int checkpointThreads) {
+        this.checkpointThreads = checkpointThreads;
+
+        return this;
+    }
+
+    /**
+     * Timeout in milliseconds to wait when acquiring persistence store lock file before failing the local node.
+     *
+     * @return Lock wait time in milliseconds.
+     */
+    public long getLockWaitTime() {
+        return lockWaitTime;
+    }
+
+    /**
+     * Timeout in milliseconds to wait when acquiring persistence store lock file before failing the local node.
+     *
+     * @param lockWaitTime Lock wait time in milliseconds.
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setLockWaitTime(long lockWaitTime) {
+        this.lockWaitTime = lockWaitTime;
+
+        return this;
+    }
+
+    /**
+     * Gets a total number of checkpoints to keep in the WAL history.
+     *
+     * @return Number of checkpoints to keep in WAL after a checkpoint is finished.
+     */
+    public int getWalHistorySize() {
+        return walHistSize <= 0 ? DFLT_WAL_HISTORY_SIZE : walHistSize;
+    }
+
+    /**
+     * Sets a total number of checkpoints to keep in the WAL history.
+     *
+     * @param walHistSize Number of checkpoints to keep after a checkpoint is finished.
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setWalHistorySize(int walHistSize) {
+        this.walHistSize = walHistSize;
+
+        return this;
+    }
+
+    /**
+     * Gets a number of WAL segments to work with.
+     *
+     * @return Number of work WAL segments.
+     */
+    public int getWalSegments() {
+        return walSegments <= 0 ? DFLT_WAL_SEGMENTS : walSegments;
+    }
+
+    /**
+     * Sets a number of WAL segments to work with. For performance reasons,
+     * the whole WAL is split into files of fixed length called segments.
+     *
+     * @param walSegments Number of WAL segments.
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setWalSegments(int walSegments) {
+        this.walSegments = walSegments;
+
+        return this;
+    }
+
+    /**
+     * Gets size of a WAL segment in bytes.
+     *
+     * @return WAL segment size.
+     */
+    public int getWalSegmentSize() {
+        return walSegmentSize <= 0 ? DFLT_WAL_SEGMENT_SIZE : walSegmentSize;
+    }
+
+    /**
+     * Sets size of a WAL segment.
+     *
+     * @param walSegmentSize WAL segment size. 64 MB is used by default.  Maximum value is 2Gb
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setWalSegmentSize(int walSegmentSize) {
+        this.walSegmentSize = walSegmentSize;
+
+        return this;
+    }
+
+    /**
+     * Gets a path to the directory where WAL is stored.
+     *
+     * @return WAL persistence path, absolute or relative to Ignite work directory.
+     */
+    public String getWalPath() {
+        return walPath;
+    }
+
+    /**
+     * Sets a path to the directory where WAL is stored. If this path is relative, it will be resolved
+     * relatively to Ignite work directory.
+     *
+     * @param walStorePath WAL persistence path, absolute or relative to Ignite work directory.
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setWalPath(String walStorePath) {
+        this.walPath = walStorePath;
+
+        return this;
+    }
+
+    /**
+     * Gets a path to the WAL archive directory.
+     *
+     *  @return WAL archive directory.
+     */
+    public String getWalArchivePath() {
+        return walArchivePath;
+    }
+
+    /**
+     * Sets a path for the WAL archive directory. Every WAL segment will be fully copied to this directory before
+     * it can be reused for WAL purposes.
+     *
+     * @param walArchivePath WAL archive directory.
+     * @return {@code this} for chaining.
+     */
+    public DataStorageConfiguration setWalArchivePath(String walArchivePath) {
+        this.walArchivePath = walArchivePath;
+
+        return this;
+    }
+
+    /**
+     * Gets flag indicating whether persistence metrics collection is enabled.
+     * Default value is {@link #DFLT_METRICS_ENABLED}.
+     *
+     * @return Metrics enabled flag.
+     */
+    public boolean isMetricsEnabled() {
+        return metricsEnabled;
+    }
+
+    /**
+     * Sets flag indicating whether persistence metrics collection is enabled.
+     *
+     * @param metricsEnabled Metrics enabled flag.
+     */
+    public DataStorageConfiguration setMetricsEnabled(boolean metricsEnabled) {
+        this.metricsEnabled = metricsEnabled;
+
+        return this;
+    }
+
+    /**
+     * Gets flag indicating whether write throttling is enabled.
+     */
+    public boolean isWriteThrottlingEnabled() {
+        return writeThrottlingEnabled;
+    }
+
+    /**
+     * Sets flag indicating whether write throttling is enabled.
+     *
+     * @param writeThrottlingEnabled Write throttling enabled flag.
+     */
+    public DataStorageConfiguration setWriteThrottlingEnabled(boolean writeThrottlingEnabled) {
+        this.writeThrottlingEnabled = writeThrottlingEnabled;
+
+        return this;
+    }
+
+    /**
+     * Gets the length of the time interval for rate-based metrics. This interval defines a window over which
+     * hits will be tracked. Default value is {@link #DFLT_RATE_TIME_INTERVAL_MILLIS}.
+     *
+     * @return Time interval in milliseconds.
+     */
+    public long getMetricsRateTimeInterval() {
+        return metricsRateTimeInterval;
+    }
+
+    /**
+     * Sets the length of the time interval for rate-based metrics. This interval defines a window over which
+     * hits will be tracked.
+     *
+     * @param metricsRateTimeInterval Time interval in milliseconds.
+     */
+    public DataStorageConfiguration setMetricsRateTimeInterval(long metricsRateTimeInterval) {
+        this.metricsRateTimeInterval = metricsRateTimeInterval;
+
+        return this;
+    }
+
+    /**
+     * Gets the number of sub-intervals to split the {@link #getMetricsRateTimeInterval()} into to track the update history.
+     * Default value is {@link #DFLT_SUB_INTERVALS}.
+     *
+     * @return The number of sub-intervals for history tracking.
+     */
+    public int getMetricsSubIntervalCount() {
+        return metricsSubIntervalCount;
+    }
+
+    /**
+     * Sets the number of sub-intervals to split the {@link #getMetricsRateTimeInterval()} into to track the update history.
+     *
+     * @param metricsSubIntervalCnt The number of sub-intervals for history tracking.
+     */
+    public DataStorageConfiguration setMetricsSubIntervalCount(int metricsSubIntervalCnt) {
+        this.metricsSubIntervalCount = metricsSubIntervalCnt;
+
+        return this;
+    }
+
+    /**
+     * Property that defines behavior of wal fsync.
+     * Different type provides different guarantees for consistency. See {@link WALMode} for details.
+     *
+     * @return WAL mode.
+     */
+    public WALMode getWalMode() {
+        return walMode == null ? DFLT_WAL_MODE : walMode;
+    }
+
+    /**
+     * Sets property that defines behavior of wal fsync.
+     * Different type provides different guarantees for consistency. See {@link WALMode} for details.
+     *
+     * @param walMode Wal mode.
+     */
+    public DataStorageConfiguration setWalMode(WALMode walMode) {
+        this.walMode = walMode;
+
+        return this;
+    }
+
+    /**
+     * Property for size of thread local buffer.
+     * Each thread which write to wal have thread local buffer for serialize recode before write in wal.
+     *
+     * @return Thread local buffer size (in bytes).
+     */
+    public int getWalThreadLocalBufferSize() {
+        return walTlbSize <= 0 ? DFLT_TLB_SIZE : walTlbSize;
+    }
+
+    /**
+     * Sets size of thread local buffer.
+     * Each thread which write to wal have thread local buffer for serialize recode before write in wal.
+     *
+     * @param walTlbSize Thread local buffer size (in bytes).
+     */
+    public DataStorageConfiguration setWalThreadLocalBufferSize(int walTlbSize) {
+        this.walTlbSize = walTlbSize;
+
+        return this;
+    }
+
+    /**
+     *  This property define how often WAL will be fsync-ed in {@code BACKGROUND} mode. Ignored for
+     *  all other WAL modes.
+     *
+     * @return WAL flush frequency, in milliseconds.
+     */
+    public long getWalFlushFrequency() {
+        return walFlushFreq;
+    }
+
+    /**
+     *  This property define how often WAL will be fsync-ed in {@code BACKGROUND} mode. Ignored for
+     *  all other WAL modes.
+     *
+     * @param walFlushFreq WAL flush frequency, in milliseconds.
+     */
+    public DataStorageConfiguration setWalFlushFrequency(long walFlushFreq) {
+        this.walFlushFreq = walFlushFreq;
+
+        return this;
+    }
+
+    /**
+     * Property that allows to trade latency for throughput in {@link WALMode#DEFAULT} mode.
+     * It limits minimum time interval between WAL fsyncs. First thread that initiates WAL fsync will wait for
+     * this number of nanoseconds, another threads will just wait fsync of first thread (similar to CyclicBarrier).
+     * Total throughput should increase under load as total WAL fsync rate will be limited.
+     */
+    public long getWalFsyncDelayNanos() {
+        return walFsyncDelay <= 0 ? DFLT_WAL_FSYNC_DELAY : walFsyncDelay;
+    }
+
+    /**
+     * Sets property that allows to trade latency for throughput in {@link WALMode#DEFAULT} mode.
+     * It limits minimum time interval between WAL fsyncs. First thread that initiates WAL fsync will wait for
+     * this number of nanoseconds, another threads will just wait fsync of first thread (similar to CyclicBarrier).
+     * Total throughput should increase under load as total WAL fsync rate will be limited.
+     *
+     * @param walFsyncDelayNanos Wal fsync delay, in nanoseconds.
+     */
+    public DataStorageConfiguration setWalFsyncDelayNanos(long walFsyncDelayNanos) {
+        walFsyncDelay = walFsyncDelayNanos;
+
+        return this;
+    }
+
+    /**
+     * Property define how many bytes iterator read from
+     * disk (for one reading), during go ahead wal.
+     *
+     * @return Record iterator buffer size.
+     */
+    public int getWalRecordIteratorBufferSize() {
+        return walRecordIterBuffSize <= 0 ? DFLT_WAL_RECORD_ITERATOR_BUFFER_SIZE : walRecordIterBuffSize;
+    }
+
+    /**
+     * Sets property defining how many bytes iterator read from
+     * disk (for one reading), during go ahead wal.
+     *
+     * @param walRecordIterBuffSize Wal record iterator buffer size.
+     */
+    public DataStorageConfiguration setWalRecordIteratorBufferSize(int walRecordIterBuffSize) {
+        this.walRecordIterBuffSize = walRecordIterBuffSize;
+
+        return this;
+    }
+
+    /**
+     * Gets flag that enforces writing full page to WAL on every change (instead of delta record).
+     * Can be used for debugging purposes: every version of page will be present in WAL.
+     * Note that WAL will take several times more space in this mode.
+     */
+    public boolean isAlwaysWriteFullPages() {
+        return alwaysWriteFullPages;
+    }
+
+    /**
+     * Sets flag that enforces writing full page to WAL on every change (instead of delta record).
+     * Can be used for debugging purposes: every version of page will be present in WAL.
+     * Note that WAL will take several times more space in this mode.
+     *
+     * @param alwaysWriteFullPages Always write full pages flag.
+     */
+    public DataStorageConfiguration setAlwaysWriteFullPages(boolean alwaysWriteFullPages) {
+        this.alwaysWriteFullPages = alwaysWriteFullPages;
+
+        return this;
+    }
+
+    /**
+     * Factory to provide implementation of FileIO interface
+     * which is used for any file read/write operations
+     *
+     * @return File I/O factory
+     */
+    public FileIOFactory getFileIOFactory() {
+        return fileIOFactory;
+    }
+
+    /**
+     * Sets factory to provide implementation of FileIO interface
+     * which is used for any file read/write operations
+     *
+     * @param fileIOFactory File I/O factory
+     */
+    public DataStorageConfiguration setFileIOFactory(FileIOFactory fileIOFactory) {
+        this.fileIOFactory = fileIOFactory;
+
+        return this;
+    }
+
+    /**
+     * <b>Note:</b> setting this value with {@link WALMode#DEFAULT} may generate file size overhead for WAL segments in case
+     * grid is used rarely.
+     *
+     * @param walAutoArchiveAfterInactivity time in millis to run auto archiving segment (even if incomplete) after last
+     * record logging. <br> Positive value enables incomplete segment archiving after timeout (inactivity). <br> Zero or
+     * negative  value disables auto archiving.
+     * @return current configuration instance for chaining
+     */
+    public DataStorageConfiguration setWalAutoArchiveAfterInactivity(long walAutoArchiveAfterInactivity) {
+        this.walAutoArchiveAfterInactivity = walAutoArchiveAfterInactivity;
+
+        return this;
+    }
+
+    /**
+     * @return time in millis to run auto archiving WAL segment (even if incomplete) after last record log
+     */
+    public long getWalAutoArchiveAfterInactivity() {
+        return walAutoArchiveAfterInactivity;
+    }
+
+    /**
+     * This property defines order of writing pages to disk storage during checkpoint.
+     *
+     * @return Checkpoint write order.
+     */
+    public CheckpointWriteOrder getCheckpointWriteOrder() {
+        return checkpointWriteOrder;
+    }
+
+    /**
+     * This property defines order of writing pages to disk storage during checkpoint.
+     *
+     * @param checkpointWriteOrder Checkpoint write order.
+     */
+    public DataStorageConfiguration setCheckpointWriteOrder(CheckpointWriteOrder checkpointWriteOrder) {
+        this.checkpointWriteOrder = checkpointWriteOrder;
+
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index a79d436..fc1fb6b 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -457,11 +457,16 @@ public class IgniteConfiguration {
     private ExecutorConfiguration[] execCfgs;
 
     /** Page memory configuration. */
+    @Deprecated
     private MemoryConfiguration memCfg;
 
     /** Persistence store configuration. */
+    @Deprecated
     private PersistentStoreConfiguration pstCfg;
 
+    /** Page memory configuration. */
+    private DataStorageConfiguration dsCfg;
+
     /** Active on start flag. */
     private boolean activeOnStart = DFLT_ACTIVE_ON_START;
 
@@ -510,6 +515,7 @@ public class IgniteConfiguration {
         allResolversPassReq = cfg.isAllSegmentationResolversPassRequired();
         atomicCfg = cfg.getAtomicConfiguration();
         binaryCfg = cfg.getBinaryConfiguration();
+        dsCfg = cfg.getDataStorageConfiguration();
         memCfg = cfg.getMemoryConfiguration();
         pstCfg = cfg.getPersistentStoreConfiguration();
         cacheCfg = cfg.getCacheConfiguration();
@@ -2157,6 +2163,29 @@ public class IgniteConfiguration {
      *
      * @return Memory configuration.
      */
+    public DataStorageConfiguration getDataStorageConfiguration() {
+        return dsCfg;
+    }
+
+    /**
+     * Sets durable memory configuration.
+     *
+     * @param dsCfg Data storage configuration.
+     * @return {@code this} for chaining.
+     */
+    public IgniteConfiguration setDataStorageConfiguration(DataStorageConfiguration dsCfg) {
+        this.dsCfg = dsCfg;
+
+        return this;
+    }
+
+    /**
+     * Gets page memory configuration.
+     *
+     * @return Memory configuration.
+     * @deprecated Use {@link DataStorageConfiguration} instead.
+     */
+    @Deprecated
     public MemoryConfiguration getMemoryConfiguration() {
         return memCfg;
     }
@@ -2166,7 +2195,9 @@ public class IgniteConfiguration {
      *
      * @param memCfg Memory configuration.
      * @return {@code this} for chaining.
+     * @deprecated Use {@link DataStorageConfiguration} instead.
      */
+    @Deprecated
     public IgniteConfiguration setMemoryConfiguration(MemoryConfiguration memCfg) {
         this.memCfg = memCfg;
 
@@ -2177,14 +2208,20 @@ public class IgniteConfiguration {
      * Gets persistence configuration used by Apache Ignite Persistent Store.
      *
      * @return Persistence configuration.
+     *
+     * @deprecated Part of old API. Use {@link DataStorageConfiguration} for configuring persistence instead.
      */
+    @Deprecated
     public PersistentStoreConfiguration getPersistentStoreConfiguration() {
         return pstCfg;
     }
 
     /**
-     * @return Flag {@code true} if persistent enable, {@code false} if disable.
+     * @return Flag {@code true} if persistence is enabled, {@code false} if disabled.
+     *
+     * @deprecated Part of legacy configuration API. Doesn't work if new configuration API is used.
      */
+    @Deprecated
     public boolean isPersistentStoreEnabled() {
         return pstCfg != null;
     }
@@ -2194,7 +2231,10 @@ public class IgniteConfiguration {
      *
      * @param pstCfg Persistence configuration.
      * @return {@code this} for chaining.
+     *
+     * @deprecated Part of old API. Use {@link DataStorageConfiguration} for configuring persistence instead.
      */
+    @Deprecated
     public IgniteConfiguration setPersistentStoreConfiguration(PersistentStoreConfiguration pstCfg) {
         this.pstCfg = pstCfg;
 
@@ -2208,7 +2248,7 @@ public class IgniteConfiguration {
      * <p>
      * Default value is {@link #DFLT_ACTIVE_ON_START}.
      * <p>
-     * This flag is ignored when {@link PersistentStoreConfiguration} is present:
+     * This flag is ignored when {@link DataStorageConfiguration} is present:
      * cluster is always inactive on start when Ignite Persistence is enabled.
      *
      * @return Active on start flag value.
@@ -2221,7 +2261,7 @@ public class IgniteConfiguration {
      * Sets flag indicating whether the cluster will be active on start. This value should be the same on all
      * nodes in the cluster.
      * <p>
-     * This flag is ignored when {@link PersistentStoreConfiguration} is present:
+     * This flag is ignored when {@link DataStorageConfiguration} is present:
      * cluster is always inactive on start when Ignite Persistence is enabled.
      *
      * @param activeOnStart Active on start flag value.

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
index 9ba26c8..c3d4e74 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
@@ -57,7 +57,10 @@ import org.apache.ignite.internal.util.typedef.internal.U;
  *     </property>
  *     }
  * </pre>
+ *
+ * @deprecated Use {@link DataStorageConfiguration} instead.
  */
+@Deprecated
 public class MemoryConfiguration implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
@@ -66,7 +69,7 @@ public class MemoryConfiguration implements Serializable {
     @SuppressWarnings("UnnecessaryBoxing")
     public static final long DFLT_MEMORY_POLICY_INITIAL_SIZE = 256L * 1024 * 1024;
 
-    /** Fraction of available memory to allocate for default MemoryPolicy. */
+    /** Fraction of available memory to allocate for default DataRegion. */
     private static final double DFLT_MEMORY_POLICY_FRACTION = 0.2;
 
     /** Default memory policy's size is 20% of physical memory available on current machine. */
@@ -83,7 +86,7 @@ public class MemoryConfiguration implements Serializable {
     /** Default memory page size. */
     public static final int DFLT_PAGE_SIZE = 4 * 1024;
 
-    /** This name is assigned to default MemoryPolicy if no user-defined default MemPlc is specified */
+    /** This name is assigned to default DataRegion if no user-defined default MemPlc is specified */
     public static final String DFLT_MEM_PLC_DEFAULT_NAME = "default";
 
     /** Size of a memory chunk reserved for system cache initially. */
@@ -101,7 +104,7 @@ public class MemoryConfiguration implements Serializable {
     /** A name of the memory policy that defines the default memory region. */
     private String dfltMemPlcName = DFLT_MEM_PLC_DEFAULT_NAME;
 
-    /** Size of memory (in bytes) to use for default MemoryPolicy. */
+    /** Size of memory (in bytes) to use for default DataRegion. */
     private long dfltMemPlcSize = DFLT_MEMORY_POLICY_MAX_SIZE;
 
     /** Memory policies. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
index dff8b2b..efe7ae2 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryPolicyConfiguration.java
@@ -19,7 +19,7 @@ package org.apache.ignite.configuration;
 import java.io.Serializable;
 import org.apache.ignite.MemoryMetrics;
 import org.apache.ignite.internal.mem.IgniteOutOfMemoryException;
-import org.apache.ignite.mxbean.MemoryMetricsMXBean;
+import org.apache.ignite.mxbean.DataRegionMetricsMXBean;
 
 import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME;
 
@@ -60,7 +60,10 @@ import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_D
  *              </property>
  *     }
  * </pre>
+ *
+ * @deprecated Use {@link DataRegionConfiguration} instead.
  */
+@Deprecated
 public final class MemoryPolicyConfiguration implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
@@ -121,6 +124,11 @@ public final class MemoryPolicyConfiguration implements Serializable {
     private long rateTimeInterval = DFLT_RATE_TIME_INTERVAL_MILLIS;
 
     /**
+     * Flag to enable Ignite Native Persistence.
+     */
+    private boolean persistenceEnabled = true;
+
+    /**
      * Gets memory policy name.
      *
      * @return Memory policy name.
@@ -290,7 +298,7 @@ public final class MemoryPolicyConfiguration implements Serializable {
 
     /**
      * Gets whether memory metrics are enabled by default on node startup. Memory metrics can be enabled and disabled
-     * at runtime via memory metrics {@link MemoryMetricsMXBean MX bean}.
+     * at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
      *
      * @return Metrics enabled flag.
      */
@@ -300,7 +308,7 @@ public final class MemoryPolicyConfiguration implements Serializable {
 
     /**
      * Sets memory metrics enabled flag. If this flag is {@code true}, metrics will be enabled on node startup.
-     * Memory metrics can be enabled and disabled at runtime via memory metrics {@link MemoryMetricsMXBean MX bean}.
+     * Memory metrics can be enabled and disabled at runtime via memory metrics {@link DataRegionMetricsMXBean MX bean}.
      *
      * @param metricsEnabled Metrics enabled flag.
      * @return {@code this} for chaining.
@@ -312,6 +320,24 @@ public final class MemoryPolicyConfiguration implements Serializable {
     }
 
     /**
+     * Gets whether Ignite Native Persistence is enabled for this memory policy.
+     *
+     * @return Persistence enabled flag.
+     */
+    public boolean isPersistenceEnabled() {
+        return persistenceEnabled;
+    }
+
+    /**
+     * Sets persistence enabled flag.
+     *
+     * @param persistenceEnabled Persistence enabled flag.
+     */
+    public void setPersistenceEnabled(boolean persistenceEnabled) {
+        this.persistenceEnabled = persistenceEnabled;
+    }
+
+    /**
      * Gets time interval for {@link MemoryMetrics#getAllocationRate()}
      * and {@link MemoryMetrics#getEvictionRate()} monitoring purposes.
      * <p>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
index c44e92d..c41721a 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
@@ -25,7 +25,9 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  * Configures Apache Ignite Persistent store.
+ * @deprecated Use {@link DataStorageConfiguration} instead.
  */
+@Deprecated
 public class PersistentStoreConfiguration implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
@@ -144,7 +146,7 @@ public class PersistentStoreConfiguration implements Serializable {
     /** Factory to provide I/O interface for files */
     private FileIOFactory fileIOFactory =
         IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_USE_ASYNC_FILE_IO_FACTORY, false) ?
-        new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
+            new AsyncFileIOFactory() : new RandomAccessFileIOFactory();
 
     /**
      * Number of sub-intervals the whole {@link #setRateTimeInterval(long)} will be split into to calculate

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
index 7bd27fe..794a262 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsMetrics.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.igfs;
 
+import org.apache.ignite.configuration.DataRegionConfiguration;
+
 /**
  * {@code IGFS} metrics snapshot for the file system. Note, that some metrics are global and
  * some are local (i.e. per each node).
@@ -33,7 +35,7 @@ public interface IgfsMetrics {
 
     /**
      * Gets maximum amount of data that can be stored on local node. This metrics is related to
-     * to the {@link org.apache.ignite.configuration.MemoryPolicyConfiguration#getMaxSize()} of the IGFS data cache.
+     * to the {@link DataRegionConfiguration#getMaxSize()} of the IGFS data cache.
      *
      * @return Maximum IGFS local space size.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 759bf64..8a71e1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -49,6 +49,10 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.cache.CacheException;
 import javax.management.JMException;
 import javax.management.ObjectName;
+import org.apache.ignite.DataRegionMetrics;
+import org.apache.ignite.DataRegionMetricsAdapter;
+import org.apache.ignite.DataStorageMetrics;
+import org.apache.ignite.DataStorageMetricsAdapter;
 import org.apache.ignite.IgniteAtomicLong;
 import org.apache.ignite.IgniteAtomicReference;
 import org.apache.ignite.IgniteAtomicSequence;
@@ -85,6 +89,7 @@ import org.apache.ignite.configuration.BinaryConfiguration;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.CollectionConfiguration;
 import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
@@ -114,7 +119,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
 import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
 import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
-import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
 import org.apache.ignite.internal.processors.cache.persistence.filename.PdsConsistentIdProcessor;
 import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
@@ -176,6 +181,7 @@ import org.apache.ignite.lifecycle.LifecycleAware;
 import org.apache.ignite.lifecycle.LifecycleBean;
 import org.apache.ignite.lifecycle.LifecycleEventType;
 import org.apache.ignite.marshaller.MarshallerExclusions;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
 import org.apache.ignite.mxbean.IgniteMXBean;
 import org.apache.ignite.mxbean.StripedExecutorMXBean;
@@ -214,6 +220,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_BUILD_VER;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_CLIENT_MODE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_CONSISTENCY_CHECK_SKIPPED;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DAEMON;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DATA_STREAMER_POOL_SIZE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
@@ -231,10 +238,10 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_US
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MEMORY_CONFIG;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_NODE_CONSISTENT_ID;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_RESTART_ENABLED;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_PORT_RANGE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SPI_CLASS;
@@ -1245,10 +1252,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
                             int loadedPages = 0;
 
-                            Collection<MemoryPolicy> policies = ctx.cache().context().database().memoryPolicies();
+                            Collection<DataRegion> policies = ctx.cache().context().database().dataRegions();
 
                             if (!F.isEmpty(policies)) {
-                                for (MemoryPolicy memPlc : policies)
+                                for (DataRegion memPlc : policies)
                                     loadedPages += memPlc.pageMemory().loadedPages();
                             }
 
@@ -1424,7 +1431,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
             if (total > safeToUse) {
                 U.quietAndWarn(log, "Nodes started on local machine require more than 80% of physical RAM what can " +
-                    "lead to significant slowdown due to swapping (please decrease JVM heap size, memory policy " +
+                    "lead to significant slowdown due to swapping (please decrease JVM heap size, data region " +
                     "size or checkpoint buffer size) [required=" + (total >> 20) + "MB, available=" +
                     (ram >> 20) + "MB]");
             }
@@ -1604,8 +1611,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         if (cfg.getConnectorConfiguration() != null)
             add(ATTR_REST_PORT_RANGE, cfg.getConnectorConfiguration().getPortRange());
 
-        // Save database configuration.
-        add(ATTR_MEMORY_CONFIG, cfg.getMemoryConfiguration());
+        // Save data storage configuration.
+        addDataStorageConfigurationAttributes();
 
         // Save transactions configuration.
         add(ATTR_TX_CONFIG, cfg.getTransactionConfiguration());
@@ -1633,6 +1640,25 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /**
+     *
+     */
+    private void addDataStorageConfigurationAttributes() throws IgniteCheckedException {
+        MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
+
+        // Save legacy memory configuration if it's present.
+        if (memCfg != null) {
+            // Page size initialization is suspended, see IgniteCacheDatabaseSharedManager#checkPageSize.
+            // We should copy initialized value from new configuration.
+            memCfg.setPageSize(cfg.getDataStorageConfiguration().getPageSize());
+
+            add(ATTR_MEMORY_CONFIG, memCfg);
+        }
+
+        // Save data storage configuration.
+        add(ATTR_DATA_STORAGE_CONFIG, new JdkMarshaller().marshal(cfg.getDataStorageConfiguration()));
+    }
+
+    /**
      * Add SPI version and class attributes into node attributes.
      *
      * @param spiList Collection of SPIs to get attributes from.
@@ -2509,14 +2535,14 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
      *
      */
     private void ackMemoryConfiguration() {
-        MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
+        DataStorageConfiguration memCfg = cfg.getDataStorageConfiguration();
 
         if (memCfg == null)
             return;
 
-        U.log(log, "System cache's MemoryPolicy size is configured to " +
-            (memCfg.getSystemCacheInitialSize() / (1024 * 1024)) + " MB. " +
-            "Use MemoryConfiguration.systemCacheMemorySize property to change the setting.");
+        U.log(log, "System cache's DataRegion size is configured to " +
+            (memCfg.getSystemRegionInitialSize() / (1024 * 1024)) + " MB. " +
+            "Use DataStorageConfiguration.systemCacheMemorySize property to change the setting.");
     }
 
     /**
@@ -2535,12 +2561,12 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
             for (CacheConfiguration c : cacheCfgs) {
                 String cacheName = U.maskName(c.getName());
 
-                String memPlcName = c.getMemoryPolicyName();
+                String memPlcName = c.getDataRegionName();
 
                 if (CU.isSystemCache(cacheName))
                     memPlcName = "sysMemPlc";
-                else if (memPlcName == null && cfg.getMemoryConfiguration() != null)
-                    memPlcName = cfg.getMemoryConfiguration().getDefaultMemoryPolicyName();
+                else if (memPlcName == null && cfg.getDataStorageConfiguration() != null)
+                    memPlcName = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().getName();
 
                 if (!memPlcNamesMapping.containsKey(memPlcName))
                     memPlcNamesMapping.put(memPlcName, new ArrayList<String>());
@@ -2551,7 +2577,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
             }
 
             for (Map.Entry<String, ArrayList<String>> e : memPlcNamesMapping.entrySet()) {
-                sb.a("in '").a(e.getKey()).a("' memoryPolicy: [");
+                sb.a("in '").a(e.getKey()).a("' dataRegion: [");
 
                 for (String s : e.getValue())
                     sb.a("'").a(s).a("', ");
@@ -3509,7 +3535,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<MemoryMetrics> memoryMetrics() {
+    @Override public Collection<DataRegionMetrics> dataRegionMetrics() {
         guard();
 
         try {
@@ -3521,7 +3547,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+    @Nullable @Override public DataRegionMetrics dataRegionMetrics(String memPlcName) {
         guard();
 
         try {
@@ -3533,7 +3559,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public PersistenceMetrics persistentStoreMetrics() {
+    @Override public DataStorageMetrics dataStorageMetrics() {
         guard();
 
         try {
@@ -3545,6 +3571,21 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
+    @Override public Collection<MemoryMetrics> memoryMetrics() {
+        return DataRegionMetricsAdapter.collectionOf(dataRegionMetrics());
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public MemoryMetrics memoryMetrics(String memPlcName) {
+        return DataRegionMetricsAdapter.valueOf(dataRegionMetrics(memPlcName));
+    }
+
+    /** {@inheritDoc} */
+    @Override public PersistenceMetrics persistentStoreMetrics() {
+        return DataStorageMetricsAdapter.valueOf(dataStorageMetrics());
+    }
+
+    /** {@inheritDoc} */
     @Nullable @Override public IgniteAtomicSequence atomicSequence(String name, long initVal, boolean create) {
         return atomicSequence(name, null, initVal, create);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 024f339..277ed79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -184,8 +184,12 @@ public final class IgniteNodeAttributes {
     public static final String ATTR_DATA_STREAMER_POOL_SIZE = ATTR_PREFIX + ".data.streamer.pool.size";
 
     /** Memory configuration. */
+    @Deprecated
     public static final String ATTR_MEMORY_CONFIG = ATTR_PREFIX + ".memory";
 
+    /** Data storage configuration. */
+    public static final String ATTR_DATA_STORAGE_CONFIG = ATTR_PREFIX + ".data.storage.config";
+
     /**
      * Enforces singleton.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 07a5c43..36257e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -57,11 +57,15 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.compute.ComputeJob;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.configuration.DeploymentMode;
 import org.apache.ignite.configuration.ExecutorConfiguration;
 import org.apache.ignite.configuration.FileSystemConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
 import org.apache.ignite.configuration.TransactionConfiguration;
 import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.managers.communication.GridIoPolicy;
@@ -123,6 +127,8 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME;
+import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEMORY_POLICY_MAX_SIZE;
+import static org.apache.ignite.configuration.MemoryConfiguration.DFLT_MEM_PLC_DEFAULT_NAME;
 import static org.apache.ignite.internal.IgniteComponentType.SPRING;
 import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.RESTART_JVM;
 
@@ -2183,15 +2189,27 @@ public class IgnitionEx {
                 myCfg.setExecutorConfiguration(clone);
             }
 
-            if (!myCfg.isClientMode() && myCfg.getMemoryConfiguration() == null) {
-                MemoryConfiguration memCfg = new MemoryConfiguration();
+            initializeDataStorageConfiguration(myCfg);
 
-                memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
+            return myCfg;
+        }
 
-                myCfg.setMemoryConfiguration(memCfg);
+        /**
+         * @param cfg Ignite configuration.
+         */
+        private void initializeDataStorageConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException {
+            if (cfg.getDataStorageConfiguration() != null &&
+                (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null)) {
+                throw new IgniteCheckedException("Data storage can be configured with either legacy " +
+                    "(MemoryConfiguration, PersistentStoreConfiguration) or new (DataStorageConfiguration) classes, " +
+                    "but not both.");
             }
 
-            return myCfg;
+            if (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null)
+                convertLegacyDataStorageConfigurationToNew(cfg);
+
+            if (!cfg.isClientMode() && cfg.getDataStorageConfiguration() == null)
+                cfg.setDataStorageConfiguration(new DataStorageConfiguration());
         }
 
         /**
@@ -2755,4 +2773,108 @@ public class IgnitionEx {
             }
         }
     }
+
+    /**
+     * @param cfg Ignite Configuration with legacy data storage configuration.
+     */
+    private static void convertLegacyDataStorageConfigurationToNew(
+        IgniteConfiguration cfg) throws IgniteCheckedException {
+        boolean persistenceEnabled = cfg.getPersistentStoreConfiguration() != null;
+
+        DataStorageConfiguration dsCfg = new DataStorageConfiguration();
+
+        MemoryConfiguration memCfg = cfg.getMemoryConfiguration() != null ?
+            cfg.getMemoryConfiguration() : new MemoryConfiguration();
+
+        dsCfg.setConcurrencyLevel(memCfg.getConcurrencyLevel());
+        dsCfg.setPageSize(memCfg.getPageSize());
+        dsCfg.setSystemRegionInitialSize(memCfg.getSystemCacheInitialSize());
+        dsCfg.setSystemRegionMaxSize(memCfg.getSystemCacheMaxSize());
+
+        List<DataRegionConfiguration> optionalDataRegions = new ArrayList<>();
+
+        boolean customDfltPlc = false;
+
+        if (memCfg.getMemoryPolicies() != null) {
+            for (MemoryPolicyConfiguration mpc : memCfg.getMemoryPolicies()) {
+                DataRegionConfiguration region = new DataRegionConfiguration();
+
+                region.setPersistenceEnabled(persistenceEnabled);
+
+                if (mpc.getInitialSize() != 0L)
+                    region.setInitialSize(mpc.getInitialSize());
+
+                region.setEmptyPagesPoolSize(mpc.getEmptyPagesPoolSize());
+                region.setEvictionThreshold(mpc.getEvictionThreshold());
+                region.setMaxSize(mpc.getMaxSize());
+                region.setName(mpc.getName());
+                region.setPageEvictionMode(mpc.getPageEvictionMode());
+                region.setMetricsRateTimeInterval(mpc.getRateTimeInterval());
+                region.setMetricsSubIntervalCount(mpc.getSubIntervals());
+                region.setSwapPath(mpc.getSwapFilePath());
+                region.setMetricsEnabled(mpc.isMetricsEnabled());
+
+                if (mpc.getName() == null) {
+                    throw new IgniteCheckedException(new IllegalArgumentException(
+                        "User-defined MemoryPolicyConfiguration must have non-null and non-empty name."));
+                }
+
+                if (mpc.getName().equals(memCfg.getDefaultMemoryPolicyName())) {
+                    customDfltPlc = true;
+
+                    dsCfg.setDefaultDataRegionConfiguration(region);
+                } else
+                    optionalDataRegions.add(region);
+            }
+        }
+
+        if (!optionalDataRegions.isEmpty())
+            dsCfg.setDataRegionConfigurations(optionalDataRegions.toArray(new DataRegionConfiguration[optionalDataRegions.size()]));
+
+        if (!customDfltPlc) {
+            if (!DFLT_MEM_PLC_DEFAULT_NAME.equals(memCfg.getDefaultMemoryPolicyName())) {
+                throw new IgniteCheckedException(new IllegalArgumentException("User-defined default MemoryPolicy " +
+                    "name must be presented among configured MemoryPolices: " + memCfg.getDefaultMemoryPolicyName()));
+            }
+
+            dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+                .setMaxSize(memCfg.getDefaultMemoryPolicySize())
+                .setName(memCfg.getDefaultMemoryPolicyName())
+                .setPersistenceEnabled(persistenceEnabled));
+        } else {
+            if (memCfg.getDefaultMemoryPolicySize() != DFLT_MEMORY_POLICY_MAX_SIZE)
+                throw new IgniteCheckedException(new IllegalArgumentException("User-defined MemoryPolicy " +
+                    "configuration and defaultMemoryPolicySize properties are set at the same time."));
+        }
+
+        if (persistenceEnabled) {
+            PersistentStoreConfiguration psCfg = cfg.getPersistentStoreConfiguration();
+
+            dsCfg.setCheckpointFrequency(psCfg.getCheckpointingFrequency());
+            dsCfg.setCheckpointPageBufferSize(psCfg.getCheckpointingPageBufferSize());
+            dsCfg.setCheckpointThreads(psCfg.getCheckpointingThreads());
+            dsCfg.setCheckpointWriteOrder(psCfg.getCheckpointWriteOrder());
+            dsCfg.setFileIOFactory(psCfg.getFileIOFactory());
+            dsCfg.setLockWaitTime(psCfg.getLockWaitTime());
+            dsCfg.setStoragePath(psCfg.getPersistentStorePath());
+            dsCfg.setMetricsRateTimeInterval(psCfg.getRateTimeInterval());
+            dsCfg.setMetricsSubIntervalCount(psCfg.getSubIntervals());
+            dsCfg.setWalThreadLocalBufferSize(psCfg.getTlbSize());
+            dsCfg.setWalArchivePath(psCfg.getWalArchivePath());
+            dsCfg.setWalAutoArchiveAfterInactivity(psCfg.getWalAutoArchiveAfterInactivity());
+            dsCfg.setWalFlushFrequency(psCfg.getWalFlushFrequency());
+            dsCfg.setWalFsyncDelayNanos(psCfg.getWalFsyncDelayNanos());
+            dsCfg.setWalHistorySize(psCfg.getWalHistorySize());
+            dsCfg.setWalMode(psCfg.getWalMode());
+            dsCfg.setWalRecordIteratorBufferSize(psCfg.getWalRecordIteratorBufferSize());
+            dsCfg.setWalSegments(psCfg.getWalSegments());
+            dsCfg.setWalSegmentSize(psCfg.getWalSegmentSize());
+            dsCfg.setWalPath(psCfg.getWalStorePath());
+            dsCfg.setAlwaysWriteFullPages(psCfg.isAlwaysWriteFullPages());
+            dsCfg.setMetricsEnabled(psCfg.isMetricsEnabled());
+            dsCfg.setWriteThrottlingEnabled(psCfg.isWriteThrottlingEnabled());
+        }
+
+        cfg.setDataStorageConfiguration(dsCfg);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index f57bda7..1e5c370 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
 import org.apache.ignite.internal.processors.marshaller.MarshallerMappingTransport;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.MarshallerContext;
 import org.apache.ignite.plugin.PluginProvider;
@@ -506,7 +507,7 @@ public class MarshallerContextImpl implements MarshallerContext {
         closProc = ctx.closure();
         clientNode = ctx.clientNode();
 
-        if (ctx.config().isPersistentStoreEnabled())
+        if (CU.isPersistenceEnabled(ctx.config()))
             fileStore.restoreMappings(this);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec41370c/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 14485d2..a3b157d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -53,8 +53,8 @@ import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cluster.ClusterMetrics;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.ClusterMetricsSnapshot;
@@ -1533,32 +1533,21 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
         if(ctx.config().isClientMode())
             return 0;
 
-        MemoryConfiguration memCfg = ctx.config().getMemoryConfiguration();
+        DataStorageConfiguration memCfg = ctx.config().getDataStorageConfiguration();
 
         assert memCfg != null;
 
-        long res = memCfg.getSystemCacheMaxSize();
+        long res = memCfg.getSystemRegionMaxSize();
 
         // Add memory policies.
-        MemoryPolicyConfiguration[] memPlcCfgs = memCfg.getMemoryPolicies();
+        DataRegionConfiguration[] dataRegions = memCfg.getDataRegionConfigurations();
 
-        if (memPlcCfgs != null) {
-            String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
-
-            boolean customDflt = false;
-
-            for (MemoryPolicyConfiguration memPlcCfg : memPlcCfgs) {
-                if(F.eq(dfltMemPlcName, memPlcCfg.getName()))
-                    customDflt = true;
-
-                res += memPlcCfg.getMaxSize();
-            }
-
-            if(!customDflt)
-                res += memCfg.getDefaultMemoryPolicySize();
+        if (dataRegions != null) {
+            for (DataRegionConfiguration dataReg : dataRegions)
+                res += dataReg.getMaxSize();
         }
-        else
-            res += memCfg.getDefaultMemoryPolicySize();
+
+        res += memCfg.getDefaultDataRegionConfiguration().getMaxSize();
 
         // Add persistence (if any).
         res += GridCacheDatabaseSharedManager.checkpointBufferSize(ctx.config());