Multi-threading / Parallelism in Drools
by Anitha Naduvath
HI all ,
Mine is a microservice (REST based stateless endpoint )running on the
cloud. Our service mainly deals with Invoices , where the Items of the
Invoice need to be evaluated against a set of rules .
We are now evaluating Drools to implement these business rules .
I have the following query with respect to Multi-threading / Parallelism
options in Drools.
*Use Case 1 :*
Our service receives an invoice with say 15000 Items , to be processed . We
need to evaluate the same set of rules for each of the items. It is Ok to
process each item in parallel . How do I achieve this in Drools ?
*Use case 2:*
Our service is called from 100 different end users . Such users may have
invoices ranging from 1 item to 15000 items in the invoice . How do I make
sure that the I maintain the same response time for all ? Should I use KIE
Execution Server which is a standalone exceution server ? In such a case,
is this server something like another microservice ? . So, will there not
be performance issues in making a REST call from my service to the KIE
Execution Server ? On the other hand , if I embed the runtime in my
application, then will it mean that I kind of tie the runtime One to One to
the user request ?
What is the best approach for the runtime considering both the use cases
here ?
*Also, can anybody explain what they mean in section 1.3.1.3 of the Drools
documentation
<https://docs.jboss.org/drools/release/6.5.0.Final/drools-docs/html_single...>:*
- 1.3.1.3. Runtime
The "runtime" requirements mentioned here are if you are deploying rules as
their binary form (either as KnowledgePackage objects, or KnowledgeBase
objects etc). This is an optional feature that allows you to keep your
runtime very light. You may use drools-compiler to produce rule packages
"out of process", and then deploy them to a runtime system. This runtime
system only requires drools-core.jar and knowledge-api for execution. This
is an optional deployment pattern, and many people do not need to "trim"
their application this much, but it is an ideal option for certain
environments.
Thanks!
Anitha .
8 years