Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Drools the most efficient way to map business rules / logic?

In our project we have to implement business logic regarding mapping of certain objects to some actions. We will have a series of conditions for specific types of objects to be verified before a certain action finally gets resolved. In other words for 7 types of objects we can have a series of actions ( from out of almost 45 actions).

We were thinking of using Drools to write down the aforementioned rules. Does anyone have some positive / negative experience with using Drools as far as its efficiency is concerned? There is also the jBPM framework that can be used (if I am not mistaken Drools are used there) – anyone is familiar with that framework? Perhaps you have some other ideas of how to solve the problem?

like image 981
Marcin Grzejszczak Avatar asked Dec 11 '12 13:12

Marcin Grzejszczak


People also ask

Why should I use drools?

Drools is a Business Rule Management System (BRMS) solution. It provides a rule engine which processes facts and produces output as a result of rules and facts processing. Centralization of business logic makes it possible to introduce changes fast and cheap.

How can you improve drools performance of rule execution?

Literal Restrictions using the operator '==' provide for faster execution as we can index using hashing to improve performance. One can bind variables to facts and their fields and then use them in subsequent field constraints. A bound variable is called a declaration.

How does drools work in Java?

Drools is an open-source Business Rules Management Software (BRMS) written in Java that provides users with a variety of features like Business Rule Engine, Web authoring, Rules Management Application, and runtime support for Decision Model and Notation models.


2 Answers

With regards efficiency, you should have no issues at all with Drools. That sounds like a pretty tiny set of facts and rules to me. The Rete engine on which it is based is almost certainly faster at making decisions than any pile of if-then-else statements you code up yourself. And a particular benefit that I noticed is that response times are extremely predictable.

Obviously all fact models and rules differe, but as an example, the application I'm currently building has hundreds of facts in working memory at any time, and more than 1000 rules. It's able to make decisions about incoming requests in about 20 milliseconds.

The full jBPM framework doesn't sound necessary for what you describe. However, it is good at what it does. For instance there is a process modelling GUI if you're looking to design workflows, and Guvnor can be usable for non-technical rules authors if the technical team puts in some up-front effort on writing DSLs and building decision tables.

For completeness, the main competitors are probably FICO Blaze Adviser or IBM ILog JRules. Generally when it comes to benchmarks those tend to be slightly ahead of Drools, but they are expensive. Admittedly, if you decide to pay for JBoss/RedHat service contracts then it's not much different, but if you're happy to take community support on Drools, then it's free!

like image 142
Steve Avatar answered Jan 05 '23 01:01

Steve


My only concern about Drools is that there is no decent GUI for it that a non-IT business people could really use. Lots of products claim that they do provide such UI but it always turns out to be not really true. So, you have to accept the fact that your development team will end up creating and testing all those rules based on decision tables or some other formats.

Other than that, Drools is a great BRE used by governments, banks and large companies.

like image 43
Kizz Avatar answered Jan 05 '23 02:01

Kizz