The Apache Ignite memory-centric platform is based on a durable memory architecture that allows storing and processing data and indexes both in memory and on disk when the Ignite Native Persistence feature is enabled. The durable memory architecture helps achieve in-memory performance with the durability of disk using all the available resources of the cluster.
Ignite's durable memory operates in a way similar to the virtual memory of operating systems, such as Linux. However, one significant difference between these two types of architecture is that the durable memory, whenever persistence is enabled, will always treat the disk as the superset of the data, capable of surviving crashes and restarts. Conversely, traditional virtual memory uses the disk only as a swap extension, which gets erased once the process stops.
Since this architecture is memory-centric, RAM is always treated as the first memory tier, where all the processing happens. The characteristics and benefits of the in-memory part of the architecture include:
- Off-heap Based. All the data and indexes are stored outside of Java heap, which allows easy processing petabytes of data located in the cluster.
- Removes Noticeable Garbage Collection Pauses. Since all the data and indexes are stored off-heap, the application's code is the only source possible for long stop-the-world pauses.
- Predictable memory usage. By default, durable memory uses as much RAM and disk space as possible. However, it's easy to set up memory utilization to suit your application requirements.
- Automatic memory defragmentation. Apache Ignite uses memory as efficiently as possible and executes defragmentation routines in the background, avoiding fragmentation.
- Improved performance and memory utilization. All the data and indexes are stored in paged format with similar representation in memory and on disk, which removes any need for serializing or deserializing of data.
This section outlines persistence options available in Ignite.
Ignite Persistence is the most flexible, scalable, and convenient way of persisting data in Ignite. It is widely used in scenarios where applications need a distributed memory-centric database. The benefits include:
- Data Resiliency. Since the Ignite persistent tier stores the full data set, it can survive cluster crashes and restarts, without losing any data and while preserving its strong transactional consistency.
- Cache only hot data in memory. Store the superset of data on disk and a subset of data in memory. With the Ignite Native Persistence feature enabled, there is no need to fit all the data in RAM. The durable memory will continue to retain the hot data in RAM, automatically purging the cold data from memory when there is no more space is left.
- Execute SQL over the whole data set. Most in-memory systems can query data only when it is preloaded in memory, therefore limiting the data size to the size of memory only. Ignite SQL will always span the whole distributed persisted data set, utilizing the in-memory caches for better performance.
- Instantaneous cluster restarts. If the whole cluster goes down, it can restart and become operational immediately. The in-memory caches will warm up automatically, as the data starts getting accessed.
Ignite can be used as a caching layer (aka. data grid) above an existing 3rd party database: RDBMS, NoSQL, or HDFS. This mode is used to accelerate the underlying database that persists the data. Ignite stores data in memory, distributed across multiple nodes providing fast data access. It reduces the network overhead caused due to frequent data movement between an application and the database.
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 the full data set be loaded from disk to memory beforehand.
If you do not want to use Ignite native persistence or 3rd party persistence, you can enable swapping, in which case, Ignite in-memory data will be moved to the swap space located on disk if you run out of RAM. 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.
The swap space is mostly used to avoid out of memory errors (OOME) that might happen if RAM consumption goes beyond its capacity and you need more time to scale the cluster out to redistribute the data sets evenly.
Updated 11 months ago