Description
Current (Ignite 1.x) implementation of cache storage relies on a tiered approach where cache entry can be located in one of the three storage areas: on-heap, off-heap memory and swap. It leads to the following disadvantages:
- Entry constantly moves from one storage area to another which leads to a complex code (for example, swap/unswap listeners for queries and rebalancing)
- It is not possible to set per-cache memory limit
- Off-heap indexes require on-heap row cache. If this cache is small, performance becomes very poor
- Continuous put/remove operations with OFFHEAP_TIERED mode lead to uncontrollable memory fragmentation
We can reapproach the cache storage and base it on a concept of page memory. We will allocate several memory pools of pages of fixed size and assign each cache to one of the memory pools. All storage data structures should operate on memory pages, the main storage will be always off-heap with an optional on-heap cache.
This gives us the following benefits:
- Flexible and precise per-cache memory limit
- Transparent swap: we can allocate page memory over a memory-mapped file and OS will take care of swapping
- Getting rid of on-heap cache for off-heap SQL indexes
- Ability to take a cluster-wide data snapshot
I suggest the following API for memory policy configuration:
class MemoryPolicy { boolean default; // Require at least one memory policy to be default. private String name; private long size; private String tmpFsPath; // If memory-mapped file should be used. } class CacheConfiguration { .... private String memoryPolicyName; .... }
Attachments
Issue Links
- blocks
-
IGNITE-304 IGFS returns incorrect metrics (f.e. space used) if igfs-data cache configured to use off-heap
-
- Closed
-
- incorporates
-
IGNITE-1789 Data Snapshots for Ignite caches
-
- Closed
-
- is duplicated by
-
IGNITE-5953 Missed off-heap unswapping in GridCacheMap.versionedValue()
-
- Resolved
-
- is related to
-
IGNITE-4983 .NET: Cache plugins do not work
-
- Resolved
-
1.
|
Implement offheap eviction policies based on page memory |
|
Resolved | Alexey Goncharuk | |||||||||
2.
|
Add option to store deserialized values on-heap |
|
Resolved | Ilya Lantukh | |||||||||
3.
|
Update metrics for new offheap storage |
|
Resolved | Sergey Chugunov | |||||||||
4.
|
.NET: Remove swap API and cacheMemoryMode |
|
Resolved | Pavel Tupitsyn | |||||||||
5.
|
Introduce MemoryPolicy configuration and adapt PageMemory concept to multiple memory policies |
|
Resolved | Sergey Chugunov |
|
||||||||
6.
|
Reconsider CachePeekMode.ONHEAP |
|
Resolved | Unassigned | |||||||||
7.
|
Implement parallel indexes for BPlusTree |
|
Resolved | Alexey Goncharuk |