5

I have read several posts where the use cases for using Rule Engine are discusses. And many of them say that you should not use it for workflow management.

Posts I referred:

  1. Pros and Cons of Rule Engine
  2. When you should not use the Rule Engine
  3. Guidelines on using Rule Engine

But I have not yet got any simple explanation on what all overheads does the Rule Engine add to system when used?

What if I use it for workflow management? Will it be an overhead on memory?

Can someone put some focus on this?

I will also put the scenario in which we will be using Rule Engine:

We have a bidding engine which whose input changes frequently on the basis of business analysts forecasts. So in simple terms we will be taking actions against some values provided based on rules. For example: If business analyst puts value as $2 then Rule engine will decide the bid value to be sent to the customers.

Community
  • 1
  • 1
Sam
  • 2,352
  • 4
  • 32
  • 45
  • The second link closely matches your question of "Why not to use". The obvious answer is: do not use it if it is bad for your certain case because you will be shooting your foot. Please correct your question title to match the "overhead" you seem to be ore concerned with, maybe it will stop "not constructive" votes. But, even so, the "whatifs" will encourage a debate.. – quetzalcoatl Apr 24 '13 at 12:18
  • @quetzalcoatl I think adding "overheads" will make sense. – Sam Apr 24 '13 at 12:22

3 Answers3

2

In short: a rule engine is used to make decisions; workflows are used to run processes.

You need a rues engine to replace some or all "IFs" and "ELSEs" in your compiled code with the "soft" logic that can be changed without changing/recompiling your main code. You supply it a rule and a data (called "fact object" or "source object") and the engine evaluates that data against that rule. That is the only purpose of a rules engine. Most engines can either return the output of a rule evaluation against your data as True or False, or invoke an "action" (a method in your code) to further process your data.

You use workflow process to run a factory, or a wharehouse, or a military facility. Workflow allows you to stop the conveyor and wait for an event to happen, or continue the approval process if a boss signed it. Etc, etc. Typically, workflow uses a rules engine internally as part of its core to make decisions what to do next.

Hope this clarifies things a bit :)

Kizz
  • 779
  • 1
  • 10
  • 15
  • You didn't exactly answer the question "To use or not to use rules engine" :) –  Apr 24 '13 at 14:21
  • 1
    @MTG Yep, my fault. I'd say if you know that you need a rules engine and not a workflow, then the decision of whether or not to use the engine would depend on how complicated your business logic is and how often it gets changed. I wouldn't bother with additional overhead of dealing with new technology just because of a couple of switch statements or several IFs that might change once a year. For anything more serious I'd consider a rule engine. Another point of consideration would be if business people want to manage rules themselves. Some engines come with excellent UIs that allow doing that. – Kizz Apr 24 '13 at 14:50
1

Because there is no standard rules engine and both the implementation and the consequences of that implementation are likely to be highly variable depending on the language and platform you are working with, it is impossible to answer your question directly. Nevertheless, I will endeavour to cast a little light for you.

What a Rules Engine does is to provide a way of implementing a set of conditions in your code or, more to the point, of allowing the conditions to be set outside your code and interpreted by it so that other stakeholders can alter the rules as needed.

You need to look at the exact problem you are trying to solve, the platform you are trying to solve it on and then decide whether, in that specific circumstance, a rules engine is the best solution. The linked questions provide some good guidance in that regard.

Bear in mind that if you have a problem that could be solved this way, or could be solved another way, every solution will have some overheads- some may affect performance, others affect development time or maintainability. You need to decide what is important to your users about your system and allow that to guide you towards solutions.

glenatron
  • 11,018
  • 13
  • 64
  • 112
  • We are using Java as programming language. We do have a valid case for using it. Your answer does not answer my question on overheads. – Sam Apr 24 '13 at 12:28
  • @Sam: please tell me, I think I should be using java.lang.String class. Will it add overhead to my business intelligence system? I hope you get the idea.. Every tool **will or will not** add overhead when you start using it. Even plain String and even in Java can kill your application if it is used improperly. With more complex tools it is easier to misuse them. It all depends not on the tool itself, but on **the way you end up using it**. You ask about overhead, but you do not tell how you want to use it. This is I think your question is still too vague. – quetzalcoatl Apr 24 '13 at 12:32
  • 1
    So why not include that in the question? The more detail you give, the more detail you will get. My answer went as far as possible with the information you provided. If you ask vague questions, you should expect vague answers. – glenatron Apr 24 '13 at 12:37
  • 1
    @quetzalcoatl Ok. I think let me put it this way. We have a bidding engine which whose input changes frequently on the basis of business analysts forecasts. So in simple terms we will be taking actions against some values provided based on rules. Let me know if that helps or I will try to elaborate more. – Sam Apr 24 '13 at 12:38
  • 1
    @Sam, put all of that in your question and you will get much better answers! – glenatron Apr 24 '13 at 12:40
0

In the interest of full disclosure, I work for InRule Technology, which is a business rule management system vendor.

A point was made in one of the linked posts about the fact that there will of course be overhead when you use any third party solution. A rule engine is no exception. However, the key is maximizing the efficiency of rule engine execution through careful planning and modeling of (1) the objects and data that will be passed into the rule engine and (2) the complexity of the rules themselves.

The overhead is no different if you were doing this in code instead of a rule engine though. On the lower end, where the objects/data and rules are of moderate complexity, we classify these as short-running decisions and, as expected, overhead is at a minimum. As that data and/or those rules increase in complexity, execution time will increase. However, the metrics we've seen raise no red flags as far as performance is concerned.