Justin Mathew
Justin Mathew

Reputation: 335

On-Heap Caching – MaxSize in Ignite, what it really means?

I am bit confused about a parameter "MaxSize" used to configure On-heap caching in Ignite. When considering heap, we always think about the size in terms of memory but I am not sure that’s the case here. Could any one please clarify what is the maxSize Set to 1000000 really means? . The comments above put as 1 million, i.e is kind of number of items for me but that dosn't make much sense for me in the heap.

Here is the link from ignite - https://ignite.apache.org/docs/latest/configuring-caches/on-heap-caching#configuring-eviction-policy

 <bean class="org.apache.ignite.cache.CacheConfiguration">
  <property name="name" value="myCache"/>

  <!-- Enabling on-heap caching for this distributed cache. -->
  <property name="onheapCacheEnabled" value="true"/>

  <property name="evictionPolicy">
    <!-- LRU eviction policy. -->
    <bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">
        <!-- Set the maximum cache size to 1 million (default is 100,000). -->
      <property name="maxSize" value="1000000"/>
    </bean>
  </property>

</bean>

Upvotes: 0

Views: 365

Answers (1)

Alexandr Shapkin
Alexandr Shapkin

Reputation: 2425

Yes, it's about the number of records in a cache.

This makes sense, since you would like to keep only the most frequently used items for your additional on heap caching

You can use setMaxMemorySize to limit cache size in bytes, just as you described.

Upvotes: 2

Related Questions