Search code examples
drools

Drools - Load Large number of rules


In my application I'm loading nearly 10,000 rule to Drools ( Drools 5.5.0.final). But application throws java.lang.OutOfMemoryError Exception. My jvm args ,

-Xms1024m
-Xmx1024m

Can anyone help me to resolve this. I also used BigMemory ( http://terracotta.org/products/bigmemory) but still getting the same error.

Thanks in advance !


Solution

  • Use a profiler like VisualVM (free and very easy to run) to see how memory over time graph and take a heap snapshot just before it goes OutOfMemory.

    Especially that graph can tell you some interesting things (by adding some Thread.sleep's in your code) which could give you and us a clue what's causing it:

    • how much memory you consume before starting anything drools (so just having your dataset in memory)
    • how much memory having the rules in memory consumes (so the KnowledgeBase)
    • how memory evolves onces you start a drools session from that base and insert your dataset.