The memory architecture in Apache Ignite consists of two storage tiers and is called "durable memory". Internally, it uses
paging for memory space management and data reference, similar to the
virtual memory of systems like
Unix. However, one significant difference between the durable and virtual memory architectures is that the former always keeps the whole data set with indexes on disk (assuming that the disk tier is enabled), while the virtual memory uses the disk when it runs out of RAM, for swapping purposes only. The first tier of the memory architecture, memory tier, keeps data and indexes in
RAM out of Java heap in so-called "off-heap regions". The regions are preallocated and managed by the database on its own which prevents Java heap utilization for storage needs, as a result, helping to avoid long garbage collection pauses. The regions are split into
pages of fixed size that store data, indexes, and system metadata. Apache Ignite is fully operational from the memory tier but it is always possible to use the second tier, disk tier, for the sake of
durability. The database comes with its own native persistence and, plus, can use
RDBMS,
NoSQL or
Hadoop databases as its disk tier.
Native persistence Apache Ignite native persistence is a distributed and strongly consistent disk store that always holds a superset of data and indexes on disk. The memory tier In the background, the store runs the "checkpointing process" which purpose is to copy dirty pages from the memory tier to the partition files. A dirty page is a page that is modified in memory with the modification recorded in WAL but not written to a respective partition file. The checkpointing allows removing outdated WAL segments over the time and reduces cluster restart time replaying only that part of WAL that has not been applied to the partition files.
Third-party persistence The native persistence became available starting version 2.1. Before that Apache Ignite supported only third-party databases as its disk tier. Apache Ignite can be configured as the in-memory tier on top of
RDBMS,
NoSQL or
Hadoop databases speeding up the latter. However, there are some limitations in comparison to the native persistence. For instance, SQL queries will be executed only on the data that is in RAM, thus, requiring to preload all the data set from disk to memory beforehand.
Swap space When using pure memory storage, it is possible for the data size to exceed the physical RAM size, leading to Out-Of-Memory Errors (OOMEs). To avoid this, the ideal approach would be to enable Ignite native persistence or use third-party persistence. However, if you do not want to use native or third-party persistence, you can enable swapping, in which case, Ignite in-memory data will be moved to the swap space located on disk. Note that Ignite does not provide its own implementation of swap space. Instead, it takes advantage of the swapping functionality provided by the operating system (OS). When swap space is enabled, Ignites stores data in memory mapped files (MMF) whose content will be swapped to disk by the OS depending on the current RAM consumption == Consistency ==