Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt

This article covers the internal design of Durable Memory. Intended for Ignite developers.

The reasoning behind the durable memory is described in the main documentation: https://apacheignite.readme.io/docs/durable-memory

Table of Contents


Ignite Durable Memory

Let's split the memory into pages (synonyms: buffers, block, chunks). Let's consider the Page as a fundamental unit the whole memory is split into. This makes the memory addressing page-based.

...

Read lock is held to segment to resolve real unmanaged memory address from page ID (page pin). Write lock is held if segment pages are being modified (e.g. page is rotated from RAM to disk).

Eviction, rotation and expiration

This section describes possible pages and entries operations related to rotation with disk or completely removal data from grid.

TermActivatedCommentsConfigurationLevel of operationIn memory only modePersistency mode

Expiration (aka TTL)

Time

Sets expire time of entry after...

ExpiryPolicy (Factory)

Entry

(plus)

(plus)

Eviction

Region is full

Completely removes entry from grid. Reasonable with 3rd party persistence

PageEvictionMode

Entry (+ page is used to find more entries to remove)

(plus)

N/A

On Heap eviction

Depends on policy

Near caches and On-Heap caches (1.x)

LruEvictionPolicy

Entry

(plus) only for near /on-heap caches

Page replacement

Region is full

Ignite operates

Not configurable by user

Page

N/A

(plus) Always enabled


Page replacement (rotation with disk)

...

This policy solves case of one-time access of data, for example, one full scan query. Pages touched during running this query is not considered hot. See also documentation

Entries and pages in durable memory

Location of objects in durable memory

Free lists

Ignite manages free lists to solve issue with fragmentation in pages (not full pages).

...

  • Consult marshaller about size in bytes of this value pair
  • Upper-round this value to be divisible by 8 bytes
  • Use value from previous step to get page list from free list
  • Select some page from appropriate list of free pages. This page will have required amount of free space

Long objects

If object is longer than page size, it will require several pages to store

...

Hash Index is also B+ Tree (not hash table), key is hashcode and value is link.

Data Region Configuration

DataRegionConfiguration (historical naming is Memory Policy) is especially important when Ignite Persistent Store configuration is enabled.

...

Reference tables (dictionaries) are usually small, and may be assigned to be allocated to memory always.

...

Durable memory vs Ignite 1.x

Following paragraph summarizes results of memory structure changes

For previous Ignite versions - caches were on heap by default. Offheap caches were required configuration, and a number of small regions were allocated for each usage.

...