Search code examples
garbage-collectiondrools

drools with high GC time


In my case, i want to use drools to deal with real time streaming (from kafka) message as facts.

In pre-work, i test drools (version 7.5.0.Final) with the following code with jvm params(-Xms1500m -Xmx1500m -Xmn500m, jdk 1.8):

[code sample : simulate continuous facts with while method][1]

And the test result is(the app runs more than 24 hours):

jconsole monitor

Get from the monitor, i find the GC is too high, i guess the fact is located in the working memory with reference, so cannot be freed until major GC collection.

Is there any method to free facts explictly? Or how can i lower the GC collections(major GC)?


Solution

  • If your facts are events, you can take advantage of Drools' expiration policies for events to automatically remove your facts from the session.

    If not, your session will get bigger and bigger. Drools needs to have all the facts in memory in order to work. You can manually retract facts from a session by one of these options:

    Hope it helps,