Search code examples
ignite

Should I store data in on-heap memory or off-heap memory


I am wondering whether I should store data in on-heap memory or off-heap memory. The official documentation states, "On-heap caching is useful in scenarios when you do a lot of cache reads on server nodes that work with cache entries in binary form or invoke cache entries' deserialization."

In my case, I persist data to MongoDB and store BSON binary data in cache.

  1. Should I choose on-heap memory or off-heap memory?

  2. What is the basis for the "-Xms10g -Xmx10g" in my JVM parameters? If the data is stored in off-heap memory, isn't 10G too large?


Solution

  • It's not either-or. Ignite always stores its data off-heap.

    In some specific circumstances, you can get better performance by additionally storing your data on the Java heap. Usually, it's not worth the extra memory.

    As far as the heap size, roughly speaking, the space required is proportionate to the use of the data rather than the volume. My rule of thumb is 4Gb + 2Gb if you use SQL + 2Gb if you use persistence.