// 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 using the persistent storage, Ignite stores all the data on disk, and loads as much data as it can into RAM for processing.

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

== Profile Configuration

Each Ignite storage engine can have several storage profiles.

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

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

== Storage Configuration

In Ignite 3, you can create and maintain configuration in either HOCON or JSON. The configuration file has a single root "node," called `ignite`. All configuration sections are children, grandchildren, etc., of that node. The example below shows sample Ignite cluster configuration with persistence and checkpoints:

[source, json]
----
{
  "ignite" : {
    "storage" : {
      "engines" : {
        "aipersist" : {
          "checkpoint" : {
            "checkpointDelayMillis" : 100
          }
        }
      },
      "profiles:" : [
        {
          "name" : "clock_aipersist",
          "engine": "aipersist",
          "replacementMode" : "CLOCK"
        }
      ]
    }
  }
}
----

You can then use the profile (in this case, `clock_aipersist`) in your distribution zone configuration.