// 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.

= Persistent Storage


== Overview

Ignite Persistence is designed to provide a quick and responsive persistent storage.
When the link:config/data-region[data region] is configured to use  Ignite persistence, Ignite stores all the data on disk, and loads as much data as it can into RAM for processing.

The Native Persistence functionality is based on the following features:

* Storing data partitions on disk
* Checkpointing

When persistence is enabled, Apache Ignite stores each partition in a separate file on disk. In addition to data partitions, Apache Ignite stores indexes and metadata.

//image::images/persistent_store_structure.png[]

== Checkpointing

_Checkpointing_ is the process of copying dirty pages from RAM to partition files on disk. A dirty page is a page that was updated in RAM but was not written to the respective partition file.

After a checkpoint is created, all changes are persisted to disk and will be available if the node crashes and is restarted.

Checkpointing is designed to ensure durability of data and recovery in case of a node failure.

// image:images/checkpointing-persistence.png[]

This process helps to utilize disk space frugally by keeping pages in the most up-to-date state on disk.


== Configuration Properties

The following table describes some properties of javadoc:org.apache.ignite.configuration.DataStorageConfiguration[].

[cols="1,1,3",opts="header", stripes=none]
|===
|name|| The name of the data region.
|initSize|`256 * 1024 * 1024`| Sets the initial space allocated to the data region.
|maxSize|`256 * 1024 * 1024`| Sets the maximum space that can be allocated to the data region.
|replacementMode|`CLOCK`| Sets the page replacement algorithm.
|===


== Configuration Example

The example below shows how to configure one data region that uses Ignite persistence:

----
ignite config set --type cluster \
"{
    aipersist.regions: [{
        name: btree_persistent_region,
        maxSize: 256000000
    }]
}"
----