Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Locks section started

...

Splitting each data region (DataRegionConfiguration) to a number of segments allows to minimise contention on one lock for region (striping technique is used).

  • Read lock is held to segment to resolve real unmanaged memory address from page ID (page pin, acquire).
  • Read lock is held to release previously acquired page.
  • Write lock is held if segment pages are being modified (e.g. page is rotated from RAM to disk, or new page is allocated).

Structure of segments and Loaded Pages Map is shown at fugure:

...

Since Ignite version 2.5 Loaded Pages Id Table uses Robin Hood hashing: backward shift deletion algorithm for maintatining HashMap of FullPageId (CacheId, PageId)->(Address, PartGeneration).

To select approrpiate segment Ignite hashes Full Page Id, and (hash % segmentNo) gives the number.

In segment in LoadedPagesTable Ignite also hashes FullPageId to select approptiate bucket in the table.

...

Structure of segments and Loaded Pages Map is shown at fugure:

Gliffy Diagram
namesegmentsAndPageTable

Since Ignite version 2.5 Loaded Pages Id Table uses Robin Hood hashing: backward shift deletion algorithm for maintatining HashMap of FullPageId (CacheId, PageId)->(Address, PartGeneration).

To select approrpiate segment Ignite hashes Full Page Id, and (hash % segmentNo) gives the number.

In segment in LoadedPagesTable Ignite also hashes FullPageId to select approptiate bucket in the table.

In case of hash collision inside LoadedPagesTable lineral probe is used to find page by ID. If empty bucket is found, search is finished: page is not present in RAM.

Segment and Page Locks

Segment lock is read-write:

 

  • Read lock is held to segment to resolve real unmanaged memory address from page ID (page pin, acquire).
  • Read lock is held to release previously acquired page.
  • Write lock is held if segment pages are being modified (e.g. page is rotated from RAM to disk, or new page is allocated).

Page itself also has its own lock. This lock may be acquired only for page available in RAM and only for pinned (acquired) page.

Gliffy Diagram
namesegmentsAndPagesLocks

Since Ignite version 2.5 there are two optimizations introduced. Segment write lock

...