[rules-users] Slow compilation (4h) for a single rule

fx242 drools at fx242.com
Tue Jul 24 07:07:42 EDT 2012


Hi,

Recently I was trying to optimize the rule compilation time for my KB (~4K
rules).
I do a full KB compilation every night, as most of the rules are dynamic
generated/converted and managed by the business operators.
The compile time was not very good (around 3 hours on a 8 core Xeon CPU),
but is was acceptable.
On the other night I was alarmed that the compile time was doubled overnight
without an obvious explanation or any relevant rule count increase. After
some debuging I've traced the problem and was shocked to find that most of
the rules KB (4K rules) compile under 5 minutes, except one. This single
rule was taking all the 4h to compile!
I'm using DROOLS 5.2 Final.
The rule example below samples the problem (don't mind the nonsense Number()
conditions):

rule "CONFIG_1-3UCO07"
    salience -90
when
    Number(rel_4226982244: intValue)
    Number(rel_7521194: intValue)
    Number(rel_787633980: intValue)
    Number(qty_1331544548: intValue)
    Number(rel_1425187049: intValue)
    Number(rel_1180441096: intValue)
    Number(rel_3132221704: intValue)
    Number(rel_1663554156: intValue)
    Number(rel_1940612775: intValue)
    Number(rel_1735126416: intValue)
    Number(rel_3962361266: intValue)
    Number(rel_882187: intValue)
    Number(rel_1169008280: intValue)
    Number(rel_3495503197: intValue)
    Number(rel_70290066: intValue)
    Number(rel_1333860961: intValue)
    Number(rel_2793542368: intValue)
    Number(rel_952404632: intValue)
    Number(rel_2712335119: intValue)
    Number(qty_4276673135: intValue)
    Number(qty_3950051097: intValue)
    Number(rel_3391032645: intValue)
    Number(rel_2738029181: intValue)
    Number(qty_4125201080: intValue)
    Number(rel_663254919: intValue)
    Number(rel_3059142355: intValue)
    not((eval(qty_1331544548 == 1) or eval(rel_1425187049 == 1) or
eval(rel_1180441096 == 1) or eval(rel_787633980 >= 1) or eval(rel_7521194 >=
1) or eval(rel_4226982244 >= 1) or eval(rel_2712335119 == 1) or
eval(qty_3950051097 == 1) or eval(qty_4276673135 == 1) or
eval(rel_1940612775 == 1) or eval(rel_3132221704 == 1) or eval(rel_882187 ==
1) or eval(rel_1663554156 == 1) or eval(rel_1735126416 == 1) or
eval(rel_3962361266 == 1) or eval(rel_1169008280 == 1) or
eval(rel_2793542368 == 1) or eval(rel_3495503197 == 1) or
eval(qty_4125201080 == 1) or eval(rel_70290066 == 1) or eval(rel_3391032645
== 1) or eval(rel_1333860961 == 1) or eval(rel_2738029181 == 1) or
eval(rel_663254919 == 1) or eval(rel_952404632 == 1) or eval(rel_3059142355
== 1)))
then
    vh.error(kcontext, "Error ...");
end

I've noticed that the last "not(...)" is the problematic condition. Is there
a limit using eval() and or-clauses, or a known problem?

Regards,
Tiago Lopes





--
View this message in context: http://drools.46999.n3.nabble.com/Slow-compilation-4h-for-a-single-rule-tp4018855.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list