user1393285 user1393285 - 2 years ago 101
Java Question

Does JBoss Drools really execute all rules in parallel?

I've read a lot of documentation of JBoss Drools but cannot find a definitive answer as to if all rules are executed concurrently (certainly they are fired concurrently). More specifically, for a single input and a rule set of say 1000 rules, do the "when" conditions and the "then" conditions in each rule, execute sequentially one by one, or in parallel at the same time.

On the one hand the rete algorithm implies parallelism, certainly when the select nodes are collapsed. However after the nodes are optimized is the evaluation sequential? And the beta memory and join nodes look like they should be executed concurrently, but are they?

Also, Drools documentation speaks of "sequential mode", saying this is turned off by default. So what is turned on, parallel mode? And there is a maxThreads option implying threading.

On the other hand, I was told that the code does not utilize threading and so evaluates concurrently but executes, on the most part sequentially.

Has anyone seen any documentation that prooves the case either way?


Answer Source

There is no indication of parallelism in the standard rete algorithm. A conflict set is produced of matched rules, the agenda then applies a strategy for firing those rules in turn.

Over the years a number of efforts have been done to parallelise part(s) of the rete, either during the matching or firing stages.

A big problem when firing all rules in parallel is determinstic execution.

We are currently exploring various strategies to concurrent and parallel matching, in Drools. We will explore concurrent rule firing too, but we need to find more robust ways for users to indicate what can be fired in parallel and what can't; so that the user gets deterministic execution where they need it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download