blob: 6cffd6205e624fcf6e3ad43564b09be79c49c93a [file] [log] [blame]
<!--
▄▄▄ ██▓███ ▄▄▄ ▄████▄ ██░ ██ ▓█████ ██▓ ▄████ ███▄ █ ██▓▄▄▄█████▓▓█████
▒████▄ ▓██░ ██▒▒████▄ ▒██▀ ▀█ ▓██░ ██▒▓█ ▀ ▓██▒ ██▒ ▀█▒ ██ ▀█ █ ▓██▒▓ ██▒ ▓▒▓█ ▀
▒██ ▀█▄ ▓██░ ██▓▒▒██ ▀█▄ ▒▓█ ▄ ▒██▀▀██░▒███ ▒██▒▒██░▄▄▄░▓██ ▀█ ██▒▒██▒▒ ▓██░ ▒░▒███
░██▄▄▄▄██ ▒██▄█▓▒ ▒░██▄▄▄▄██ ▒▓▓▄ ▄██▒░▓█ ░██ ▒▓█ ▄ ░██░░▓█ ██▓▓██▒ ▐▌██▒░██░░ ▓██▓ ░ ▒▓█ ▄
▓█ ▓██▒▒██▒ ░ ░ ▓█ ▓██▒▒ ▓███▀ ░░▓█▒░██▓░▒████▒ ░██░░▒▓███▀▒▒██░ ▓██░░██░ ▒██▒ ░ ░▒████▒
▒▒ ▓▒█░▒▓▒░ ░ ░ ▒▒ ▓▒█░░ ░▒ ▒ ░ ▒ ░░▒░▒░░ ▒░ ░ ░▓ ░▒ ▒ ░ ▒░ ▒ ▒ ░▓ ▒ ░░ ░░ ▒░ ░
▒ ▒▒ ░░▒ ░ ▒ ▒▒ ░ ░ ▒ ▒ ░▒░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░░ ░ ▒░ ▒ ░ ░ ░ ░ ░
░ ▒ ░░ ░ ▒ ░ ░ ░░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░ ▒ ░ ░ ░
░ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
-->
<!--
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
"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.
-->
<!DOCTYPE html>
<html>
<head>
<link rel="canonical" href="https://ignite.apache.org/arch/persistence.html" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>Peristence - Apache Ignite</title>
<meta name="description" content="Apache Ignite can be used as a memory-centric distributed SQL database that allows executing SQL queries over the data that is both in memory and on disk"/>
<link media="all" rel="stylesheet" href="/css/all.css?v=1514336028">
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
<!--#include virtual="/includes/sh.html" -->
</head>
<body>
<div id="wrapper">
<!--#include virtual="/includes/header.html" -->
<main id="main" role="main" class="container">
<section id="native-persistence" class="page-section">
<h1 class="first">Ignite Native Persistence</h1>
<div class="col-sm-12 col-md-12 col-xs-12" style="padding-left:0; padding-right:0;">
<div class="col-sm-6 col-md-6 col-xs-12" style="padding-left:0; padding-right:0;">
<p>
As it is covered in <a href="/arch/memorycentric.html">memory-centric storage</a>,
Ignite is widely used as a caching layer (aka. data grid) above an existing 3rd
party database such as RDBMS, Apache Cassandra or MongoDB. This mode is used to
accelerate the underlying database that persists the data.
At the same time Ignite comes with its own persistence, that is considered as an alternate
and preferable persistence layer for the Ignite cluster.
</p>
<p>
Ignite native persistence is a distributed, ACID, and <nobr>SQL-compliant</nobr> disk store
that transparently integrates with Ignite's durable memory. Ignite persistence is optional
and can be turned on and off. When turned off Ignite becomes a pure in-memory store.
</p>
</div>
<div class="col-sm-6 col-md-6 col-xs-12" style="padding-right:0; top: -10px;">
<a href="/images/native_persistence.png"><img class="img-responsive" src="/images/native_persistence.png" width="450px" style="float:right;" alt="Apache Ignite Native Persistence - Distributed SQL Database"/></a>
</div>
</div>
<p>
With the the native persistence enabled, Ignite always stores a superset of data on disk,
and as much as possible in RAM. For example, if there are
100 entries and RAM has the capacity to store only 20, then all 100 will be stored on disk
and only 20 will be cached in RAM for better performance.
</p>
<p>
The native persistence has the following important characteristics:
</p>
<ul class="page-list" style="margin-bottom: 20px;">
<li>
SQL queries over the full data set that spans both, memory and disk. This means that Apache
Ignite can be used as a memory-centric distributed SQL database.
</li>
<li>
No need to have all the data in memory. Ignite persistence allows storing a superset
of data on disk and only most frequently used subsets in memory.
</li>
<li>
Instantaneous cluster restarts. Ignite becomes fully operational from disk immediately
upon cluster startup or restart. There is no need to preload or warm up the in-memory caches.
The data will be loaded in-memory lazily, as it gets accessed.
</li>
<li>
Data and indexes are stored in a similar format both in memory and on disk, which helps avoid
expensive transformations when moving data between memory and disk.
</li>
<li>
Ability to create full and incremental cluster snapshots by plugging-in 3rd party solutions.
</li>
</ul>
<div class="page-heading">Write-Ahead Log</div>
<p>
Every time the data is updated in memory, the update will be appended to the tail of
the write-ahead log (WAL). The purpose of the WAL is to propagate updates to disk in
the fastest way possible and provide a consistent recovery mechanism that supports full cluster failures.
</p>
<p>
The whole WAL is split into several files, called segments, that are filled out sequentially.
Once a segment is full, its content will be copied to the <i>WAL archive</i> where it will be preserved
for a configurable amount of time. While the segment is being copied, another segment
will be treated as an active WAL file.
</p>
<p>
The cluster can always be recovered up to the latest successfully committed transaction.
</p>
<div class="page-heading">Checkpointing</div>
<p>
As WAL grows, it periodically gets <i>checkpointed</i> to the main storage.
The checkpointing is the process of copying <i>dirty pages</i> from memory to the partition files on disk.
A dirty page is a page that was updated in memory, was appended to WAL, but was not written to a respective partition
file on disk yet.
</p>
<div class="page-heading">Durability</div>
<p>
Ignite native persistence provides ACID durability guarantees to the data:
<ul class="page-list" style="margin-bottom: 20px;">
<li>Committed transactions will always survive any failures.</li>
<li>
The cluster can always be recovered to the latest successfully committed transaction.
</li>
<li>
The cluster restarts are very fast.
</li>
</ul>
</p>
<div class="page-heading">Configuration</div>
<p>
To enable Ignite persistence, add the following configuration parameter to the cluster's
node configuration:
</p>
<div class="tab-content">
<div class="tab-pane active" id="configuration">
<pre class="brush:xml">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Enabling Apache Ignite native persistence. -->
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true"/>
</bean>
</property>
</bean>
</property>
<!-- Additional setting. -->
</bean>
</pre>
</div>
</div>
<p><a href="https://apacheignite.readme.io/docs/distributed-persistent-store" target="_blank">Read more</a></p>
</section>
</main>
<!--#include virtual="/includes/footer.html" -->
</div>
<!--#include virtual="/includes/scripts.html" -->
</body>
</html>