RulesEngine
RulesEngine copied to clipboard
Performance issue with rule-chaining
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 can you share the number of rules and the performance numbers?
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
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.