Multi-threading / Parallelism options in Drools

2,905 views
Skip to first unread message

Anitha Naduvath

unread,
Nov 21, 2016, 5:12:15 AM11/21/16
to Drools Setup
HI experts ,
  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 you explain what is meant in section 1.3.1.3 of the  Drools documentation :


Mauricio Salatino

unread,
Nov 21, 2016, 5:26:53 AM11/21/16
to drools...@googlegroups.com
Hi there, 
yes you can use the KIE Server as another microservice (or several instance of the kie-server to load balance). 

For use case 1 and use case 2  you can use a new instance of the KieSession to process each request. 

The documentation means that you need to make sure that you don't compile all the rules everytime that you recieves a request, and for that reason if you have the compiled rules, creating a new KieSession for processing your invoices will be super fast. 

HTH


--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup+unsubscribe@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/7da3d371-0818-478a-81ac-a57e6085c8ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
 - MyJourney @ http://salaboy.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar
 
 - Salatino "Salaboy" Mauricio -

shashank cg

unread,
Jan 30, 2018, 2:43:11 PM1/30/18
to Drools Setup
Hello experts,

I'm using drools as a policy evaluation engine. I create a new kiesession for processing each request and it currently takes about 10ms. However, when I use multiple threads (10 threads in my test) for evaluation, the processing time went to 100ms for each request effectively not giving me any performance improvement. I was hoping to reduce the processing time to 1ms on a average using these 10 threads.

Should I create a new kieContainer instead of a session? I've posted a question here. 

Any help would be greatly appreciated. 

Thanks
Shashank


On Monday, 21 November 2016 02:26:53 UTC-8, Salaboy Mauricio Salatino wrote:
Hi there, 
yes you can use the KIE Server as another microservice (or several instance of the kie-server to load balance). 

For use case 1 and use case 2  you can use a new instance of the KieSession to process each request. 

The documentation means that you need to make sure that you don't compile all the rules everytime that you recieves a request, and for that reason if you have the compiled rules, creating a new KieSession for processing your invoices will be super fast. 

HTH

On Mon, Nov 21, 2016 at 10:12 AM, Anitha Naduvath <anad...@gmail.com> wrote:
HI experts ,
  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 you explain what is meant in section 1.3.1.3 of the  Drools documentation :


--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/7da3d371-0818-478a-81ac-a57e6085c8ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages