The process of matching candidate rules against a set of facts is one of the most critical parts of any knowledge-based business rule system. Easy Rules provides two implementations for this:
The DefaultRulesEngine which follows a naive approach that performs the pattern matching with a loop. This was the first implementation provided initially and that choice was by design (hence the name "simple stupid rules engine").
The InferenceRulesEngine, which was added later, is a bit smarter but still follows the same approach in an iterative way.
Both of these implementations work well with small/medium sized facts/rules sets. However, as soon as these sets grow in size, this naive approach falls apart and the pattern matching process becomes slow. To my knowledge, Easy Rules has been successfully used in production by many companies and the feedback I got is that it works well until the sets of rules and facts grow to a certain size (like thousands of rules and facts). I personally had never seen or worked on systems at that scale, but it would be unfortunate to limit the success of Easy Rules within such large companies because of the lack of an efficient pattern matching implementation.
The goal of this issue is to explore the possibility of implementing the RulesEngine interface based on the Rete algorithm, which provides a more efficient way of selecting candidate rules against large sets of facts.
NB: Please note that the project is in maintenance mode, and I won't be able to implement this feature in the near future or review any contribution related to it. I'm just writing my thoughts down here to gather feedback from the community. So please share your thoughts with comments or by upvoting/downvoting the issue. Thank you upfront!
The process of matching candidate rules against a set of facts is one of the most critical parts of any knowledge-based business rule system. Easy Rules provides two implementations for this:
DefaultRulesEngine
which follows a naive approach that performs the pattern matching with a loop. This was the first implementation provided initially and that choice was by design (hence the name "simple stupid rules engine").InferenceRulesEngine
, which was added later, is a bit smarter but still follows the same approach in an iterative way.Both of these implementations work well with small/medium sized facts/rules sets. However, as soon as these sets grow in size, this naive approach falls apart and the pattern matching process becomes slow. To my knowledge, Easy Rules has been successfully used in production by many companies and the feedback I got is that it works well until the sets of rules and facts grow to a certain size (like thousands of rules and facts). I personally had never seen or worked on systems at that scale, but it would be unfortunate to limit the success of Easy Rules within such large companies because of the lack of an efficient pattern matching implementation.
The goal of this issue is to explore the possibility of implementing the
RulesEngine
interface based on the Rete algorithm, which provides a more efficient way of selecting candidate rules against large sets of facts.NB: Please note that the project is in maintenance mode, and I won't be able to implement this feature in the near future or review any contribution related to it. I'm just writing my thoughts down here to gather feedback from the community. So please share your thoughts with comments or by upvoting/downvoting the issue. Thank you upfront!