RulesEngine icon indicating copy to clipboard operation
RulesEngine copied to clipboard

Performance issue with rule-chaining

Open jchen-chc opened this issue 1 year ago • 3 comments

We have a large number of rules to run. We tried to use rule-chaining to improve performance by short-circuiting when a rule succeeds.

However, our benchmark tests showed that rule-chaining is much slower than ExecuteAllRulesAsync scheme.

The source code of ExecuteActionWorkflowAsync indicates that it makes a copy of the RuleResultTree for each rule executed in the chain.

Can someone look into this performance issue and possibly make a fix soon?

Thanks

jchen-chc avatar Mar 03 '23 17:03 jchen-chc

@jchen-chc can you share the number of rules and the performance numbers?

abbasc52 avatar Mar 07 '23 09:03 abbasc52

We had a benchmark with 10K run. We chained rules with OnFailure event. Here are some test results: 10 rules in the chain, 1st rule succeeds. the mean time is: 46.92 ms 10 rules in the chain, 2nd rule succeeds. the mean time is: 539.8 ms 10 rules in the chain, 3nd rule succeeds. the mean time is: 1.664 s

As a comparison, executing the 10 rules without chaining, the mean time is: 109.0 ms

jchen-chc avatar Mar 07 '23 16:03 jchen-chc

Is anyone looking into this? I am in a similar situation where I need to run 15 - 20 conditions (mostly equality operators) for a dataset of 600 records. This takes 15 seconds to complete. This is very slow. I am unsure if this is something that requires a fix or something that cannot be fixed. I can make a decision accordingly.

MithunChopda avatar Aug 10 '23 18:08 MithunChopda