How to get the size (total memory) used for each cached key item in Ignite.NET (C#)?

Viewed 50

Is there anyway to get the size (total memory) used for each cache key item in Ignite.NET (C#)? The current method GetSize() provides the total number of cache entries in the cache.

1 Answers

Finding out memory usage for a particular entry isn't really possible because of how the memory footprint is structured. Whenever you add an entry, you'll consume

  • A chunk of memory in the data pages; there is overhead and fragmentation in the data pages too, so that adds on top
  • For every index you have, a chunk of memory for the new index tree leaf + some (tiny) amount of memory will additionally be used by the index tree
  • There are some internal data structures that also will be changed and consume tiny amounts of additional memory

So, instead of trying to understand the size of a particular entry, you normally want to understand the total used size of a data region. You can then divide that by the number of entries in the region to get the average entry size.

Here is the interface with the data region metrics.

To get the amount of memory currently occupied by all caches of the data region, you need to calculate TotalUsedPages * PageSize.

Related