简体   繁体   中英

Apache Ignite : Ignite on-heap cache occupying too much memory in heap. Causing the application to throw OutOfMemory exception

I am using Apache Ignite as our caching mechanism for our java application. In a particular case, I have created a cache repository by extending Ignite's IgniteRepository class. This repository of mine has several methods with @Query annotation for getting data from the cache.

While running my application, I started getting an OutOfMemory exception, and my application stopped. I managed to get a heap dump for the same and analyzing it showed that ignite was occupying more than 2.5GB in the heap memory even though the collection cached is very small and hardly occupies a few MBs.

From the leak suspect report, it was visible that Ignite is holding too many maps in its cache. Following is a screenshot from the leak suspect report.

在此处输入图像描述

Upon further analysis, I also observed that this heap has been occupied in the form of Map instances inside org.apache.ignite.internal.processors.query.RunningQueryManager class.To be specific it has been held under the variable org.apache.ignite.internal.processors.query.RunningQueryManager.runs.

From my understanding, ignite removes elements from this map once the query has been executed and the data is returned. But from the facts and artefacts that I have, it is clear to me that this is not happening and Ignite is not removing the objects from this Map and keeps on retaining the heap memory.

Trying to figure out the solution for this issue.

Try the following:

  • Configure Ignite Eviction Policies to Avoid Out-of-Memory Issues
  • Consider Swapping to Avoid Memory Overflow
  • Use Ignite Native Persistence to Read Disk-Only Records and to Not Lose a Bit of Data on Restarts
  • Use Bigger Heap and Pauseless Garbage Collector to Eliminate Issues With Java Heap
  • Use Memory Quotas for SQL to Make Java Heap Usage Predictable

See Techniques to Follow If Your Apache Ignite Cluster Is Running Out of Memory Space

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM