Drools Memory Challenges

57 views
Skip to first unread message

Raja Mahendrakar

unread,
Jun 12, 2026, 9:00:03 AMJun 12
to Drools Usage
Hello Drools Team,

We are currently using Drools in our application, and we are observing very high memory usage during rule execution.

To troubleshoot this issue, we tried multiple Drools execution approaches and configurations.


To optimize execution, we tried using a precompiled Drools KJAR approach. The rules are built and packaged as a KJAR, and at runtime we load the
KJAR using KieContainer instead of compiling the rules for every execution.
However, even after using the precompiled KJAR and stateless session approach, memory usage is still very high during Drools execution.


We also tried the equivalent programmatic Drools configurations:

KieBaseConfiguration kieBaseConf = kieServices.newKieBaseConfiguration();

Sequential mode:
kieBaseConf.setOption(SequentialOption.YES);

Parallel evaluation:
kieBaseConf.setOption(ParallelExecutionOption.PARALLEL_EVALUATION);

Fully parallel execution:
kieBaseConf.setOption(ParallelExecutionOption.FULLY_PARALLEL);


Stateless session :
 StatelessKieSession statelessSession = kieContainer.newStatelessKieSession();

Pooled session :
 KieServices ks = KieServices.Factory.get();
 KieContainer container = ks.newKieContainer(kieModule.getReleaseId());

 KieSessionsPool pool = container.newKieSessionsPool(poolSize);

Precompiled KIE base / KIE container approach:
 KieContainer kieContainer = kieServices.newKieContainer(releaseId);
 KieBase kieBase = kieContainer.getKieBase();


However, even after trying sequential, stateless, precompiled, parallel, fully parallel, and pooled configurations, the memory consumption remains
high and is affecting our application performance.

Could you please help us understand the possible reasons for this high memory usage and suggest the best Drools configuration or optimization
 approach for our use case?


We would appreciate guidance on the following:

* Which Drools configuration is recommended for lower memory
* we have ariund 5000 rules in our drl file and taking around 150MB of memory

Drools Version: 9.44.0.Final

Thank you for your support.

Alex Porcelli

unread,
Jun 12, 2026, 9:03:31 AMJun 12
to drools...@googlegroups.com
Please upgrade to recent version of drools release: 10.2.0

9.44 is way old and not maintained anymore. Once you do it, please report back.


-
Alex

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/drools-usage/6ccdc7ac-6033-4d4f-852d-7bf8658846c5n%40googlegroups.com.

Raja Mahendrakar

unread,
Jun 16, 2026, 12:18:14 AMJun 16
to Drools Usage
Hi Alex/ Team,

Thank you for your reply, we have upgraded the drools version to 10.2.0 and still see the memory usage is high.
Could you please let us know what else can be done to reduce to memory usage.


Abhijit Humbe

unread,
Jun 16, 2026, 12:51:46 AMJun 16
to drools...@googlegroups.com
Which drools version you were using earlier ? And how much memory was consumed for 5000 rules ? I think for 5000 rules 150mb heap usage is fine. 

 


Raja Mahendrakar

unread,
Jun 16, 2026, 1:08:42 AMJun 16
to Drools Usage
We were using drools version "9.44.0.Final".
we have multiple such files with over 5k rules and if it takes over 150MBand load simultaneously, memory will spike and get OutOfMemory issues. 
Please suggest on how we can reduce the heap memory.

Reply all
Reply to author
Forward
0 new messages