j-easy / easy-rules

The simple, stupid rules engine for Java
https://github.com/j-easy/easy-rules/wiki
MIT License
4.86k stars 1.05k forks source link

Introduce a rules engine implementation based on Rete algorithm #348

Open fmbenhassine opened 3 years ago

fmbenhassine commented 3 years ago

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:

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!