Hi,
I have developed a REST API Service using Drools and Spring boot.
Apart from Firing Rules , This REST API Service loads Rules from a Drools Configured Excel Spreadsheet twice.
1.While starting the REST API Service.
2.Whenever the Rules in the Spreadsheet gets Updated.
For this API Service , I have set 4GB as the Max Heap Size.
Over the time , I found that the Heap Size has been consumed completely and the Swap Memory is being used.
While checking for a solution in the internet,
This Issue can be resolved by Configuring Cache Size of the Project and Project Versions of KIE Repository -->
https://blog.kie.org/2022/09/drools-trouble-shooting-memory-issues.htmlThe same can be provided in Java using System.getProperty() -->
https://groups.google.com/g/drools-usage/c/NhrQhuHeYOU/m/8QisTXohAwAJThere was no Change in Heap Memory Consumption after providing these System Properties either using "-D" Option while starting the application or providing it via Java Class
Please find the below regarding the Heap Memory Consumed (Used Jconsole Tool) by this Service for loading Rules (Updated from the Spreadsheet)
1st Rule Update :
Initial Heap Size : 1.2 GB
Max Heap Size Consumed : 2.5 GB
Heap Size (When Loading Updated Rules gets Completed) : 1.3 GB
2nd Rule Update :
Initial Heap Size : 1.35 GB
Max Heap Size Consumed : 3.1 GB
Heap Size (When Loading Updated Rules gets Completed) : 3.2 GB
3rd Rule Update :
Initial Heap Size : 3.1 GB
Max Heap Size Consumed : 4 GB
Heap Size (When Loading Updated Rules gets Completed) : 2.5 GB
4th Rule Update :
Initial Heap Size : 2.6 GB
Max Heap Size Consumed : 3.9 GB
Heap Size (When Loading Updated Rules gets Completed) : 3.75 GB
5th Rule Update :
Initial Heap Size : 3.75 GB
Max Heap Size Consumed : 4 GB
Heap Size (When Loading Updated Rules gets Completed) : 5.0 GB
I took the Heap Dump and when Analyzed using MAT Tool by Eclipse , found there are 2 Objects which are alive and consumed large memory
1.org.drools.compiler.kie.builder.impl.MemoryKieModule - Occupied 357.8 MB out of 775.8MB
2.org.drools.compiler.kie.builder.impl.KieRepositoryImpl - Occupied 357 MB out of 775.8MB
Note : This Heap Memory Consumption and Heap Dump Details are the same - before and after providing the Cache Size as System Property
Please help me on this issue
Thanks in advance for spending your valuable time to analyze this issue and providing any info/solution.
Regards,
Wigglesworth