Drools 7.4.1 performance issue

889 views
Skip to first unread message

Szabo Arpad

unread,
Nov 20, 2017, 9:35:01 AM11/20/17
to Drools Usage
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:
# Warmup Iteration   4: **** COMPILER BUG! REPORT THIS IMMEDIATELY AT http://jira.codehaus.org/browse/mvel2
...
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.










drools5.zip
drools7.zip

Mark Proctor

unread,
Nov 20, 2017, 11:04:18 AM11/20/17
to drools...@googlegroups.com
We’ll start looking into this and get back to you. Please be patent, it might take a while.

Mark
--
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 post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/f21a3548-3bdc-44ac-9c78-6958396f287a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<drools5.zip><drools7.zip>

Mark Proctor

unread,
Nov 27, 2017, 11:34:46 AM11/27/17
to drools...@googlegroups.com
We have identified a regression for stateless sessions between 5.3.0 and 5.3.2. Surprised no one noticed this before :)

We'll try and have this fixed soon.

Mark

Mark
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage+unsubscribe@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/f21a3548-3bdc-44ac-9c78-6958396f287a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<drools5.zip><drools7.zip>


Szabo Arpad

unread,
Nov 29, 2017, 5:31:53 AM11/29/17
to Drools Usage
Thank you for your spent time.
Should I understand that you will make some fix in 7.4.x line?

Regards,
Arpad.
 

Mark Proctor

unread,
Nov 29, 2017, 8:56:01 AM11/29/17
to drools...@googlegroups.com
On Wed, Nov 29, 2017 at 10:31 AM, Szabo Arpad <sa5...@gmail.com> wrote:
Thank you for your spent time.
Should I understand that you will make some fix in 7.4.x line?
We don't  do maintenance releases in community. The fix will be available, but as part of a 7.x release. So either 7.5 or 7.6.

There was only a 7.4.1 as there was a corrupted maven upload for 7.4.0 and we could not re-upload it without a version change.

Mark

Regards,
Arpad.
 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.

Mario Fusco

unread,
Jan 3, 2018, 11:14:07 AM1/3/18
to Drools Usage
Hi,

I investigated the performance issues you reported and did a profiling session on the benchmarks you sent.

As consequence of this I implemented a few changes in this commit https://github.com/kiegroup/drools/commit/f69ab6bfb7448bf5f1f5090b2e8c6cec7db8e94f and based on your benchmarks now the 7.5 will be even faster than the original 5.3.0. Let me know if you'll give this a try when the 7.5 will be release.

Thanks,
Mario

Srinivas ev

unread,
Apr 23, 2018, 1:57:10 AM4/23/18
to Drools Usage
Hi Mario Fusco,

I am using stateful sessions. I observed the time rules won't invoke correctly when the facts inserted continuously for the kiesession. This delay will keep on increasing and rules won't invoke for newly inserted facts immediately.
When using profiler, I observed below. I am using fireUntilHalt() on kiesession.

Name: Thread-133
State: WAITING on org.drools.core.phreak.SynchronizedPropagationList@4b40f489
Total blocked: 18,516,583  Total waited: 5,621,285

Stack trace: 
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:502)
org.drools.core.phreak.SynchronizedPropagationList.waitOnRest(SynchronizedPropagationList.java:128)
org.drools.core.common.DefaultAgenda$RestHandler$FireUntilHaltRestHandler.handleRest(DefaultAgenda.java:1138)
org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1079)
org.drools.core.common.DefaultAgenda.internalFireUntilHalt(DefaultAgenda.java:996)
org.drools.core.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:988)
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:1359)
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:1338)
com.**********.KieSessionImpl$FireUntilHalt.run(KieSessionImpl.java:97)


On Wednesday, 3 January 2018 21:44:07 UTC+5:30, Mario Fusco wrote:
Hi,

I investigated the performance issues you reported and did a profiling session on the benchmarks you sent.

As consequence of this I implemented a few changes in this commit https://github.com/kiegroup/drools/commit/f69ab6bfb7448bf5f1f5090b2e8c6cec7db8e94f and based on your benchmarks now the 7.5 will be even faster than the original 5.3.0. Let me know if you'll give this a try when the 7.5 will be release.

Thanks,
Mario
On Wed, Nov 29, 2017 at 2:55 PM, Mark Proctor <mdpr...@gmail.com> wrote:
On Wed, Nov 29, 2017 at 10:31 AM, Szabo Arpad <sa5...@gmail.com> wrote:
Thank you for your spent time.
Should I understand that you will make some fix in 7.4.x line?
We don't  do maintenance releases in community. The fix will be available, but as part of a 7.x release. So either 7.5 or 7.6.

There was only a 7.4.1 as there was a corrupted maven upload for 7.4.0 and we could not re-upload it without a version change.

Mark

Regards,
Arpad.
 

--
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 post to this group, send email to drools...@googlegroups.com.

--
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.
Reply all
Reply to author
Forward
0 new messages