In our project we updated to drools 7.4.1-Final from drools 5.3.0-Final.
But the performance was decreased by 50-60%
20-30% more CPU usage and 20-30% more time to execution. (If CPU goes up to 100% the 50-60% goes to execution time)
We use stateless session and call it several hundred thousand of times per day (or more).
Insert facts, execute and get the result, and again insert the facts, execute and get the result. (The KBase is cached)
The logic file did not change.
After profiling it found out that a lot of time is spent in: org.drools.core.phreak.SynchronizedPropagationList.flush / org.drools.core.phreak.PropagationEntry$Insert.execute
I also made a simplified model where this behavior is still can be visible. (in drools5 creating a new WorkingMemory was expensive, but as soon as the rule execution takes at least half of this time, drools 7 becomes slower)
Scenario:
- create a KnowledgeBase/session and cache it
- in a for loop we call execute (300.000 times - or given by argument) with the same amount and type of objects inserted to memory.
In the drl we have
- a 30 line decision table, and some helper rule which sets some time related facts (these are used in other rules further - but omitted them as the effect is visible without those rules too)
Please find attached the two test.
NOTE:
Try to run with JHM - but for drools-5 I got:
...
java.lang.VerifyError: (class: ASMAccessorImpl_14296115441511183872990, method: getKnownEgressType signature: ()Ljava/lang/Class;) Illegal type in constant pool
Anyway I think that the plain execution of jar of 300K iteration is long enough to warm up the JVM (you can run with 3 million iteration too - takes only several minutes)
On my environment drools-5 runs around 37 seconds and drools-7 runs around 57 seconds (for 300K iteration)
Is there any drools-7 parameter which can be set up to speed up to be at least in pair with drools 5?
Can you advice something to increase the performance of drools 7?
Thank you,
Arpad.