<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 09/04/2014 11:20, Maxime Falaize a
écrit :<br>
</div>
<blockquote
cite="mid:CAER338Prnopjp8mtf4fjBeo0d_YuqQU4488hymtbURAChbT=dQ@mail.gmail.com"
type="cite">
<div dir="ltr">I confirm that the multithreaded rules evaluation
is not currently supported. See <a moz-do-not-send="true"
href="https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/RuleBaseConfiguration.java#L683">https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/RuleBaseConfiguration.java#L683</a><br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2014-04-07 12:27 GMT+02:00 Maxime
Falaize <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:maxime.falaize@gmail.com" target="_blank">maxime.falaize@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I'm sorry but I don't understand what you are
talking about. In this article, there is nothing about
multithreaded rules evaluation. It just says that the
Phreak algorithm is designed for thread safety and <b>future</b>
multicore processors exploitation. It doesn't mean that it
is already multithreaded. Moreover I tested my
appliciation with and without multithreaded sessions (I am
using Drools 6.0.1.Final) and I noted a faster execution
in the multithreaded one.</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2014-04-04 13:53 GMT+02:00
jmercier <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:jmercier@genoscope.cns.fr"
target="_blank">jmercier@genoscope.cns.fr</a>></span>:
<div>
<div class="h5">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Le 04/03/2014 09:55, Maxime Falaize a écrit :<br>
<div>
<div>> Hello,<br>
><br>
> I want to ask you if it is a good
practive to pool stateful sessions<br>
> for a specific ruleset to improve the
execution performance.<br>
> Actually in my application I execute my
rules by calling SOAP<br>
> webservice. For performance purpose, I
test multithreaded calls to my<br>
> webservice and I noted that when I pool
sessions in the server side,<br>
> it improves the performance a lot.<br>
><br>
> To pool sessions, I just declare multiple
ksession tag in my<br>
> kmodule.xml :<br>
><br>
> <kbase name="KBase"
packages="com.example.*"><br>
> <ksession
name="KSession1"/><br>
> <ksession
name="KSession2"/><br>
> <ksession
name="KSession3"/><br>
> <ksession
name="KSession4"/><br>
> <ksession
name="KSession5"/><br>
> </kbase><br>
><br>
> In my spring webservice endpoint I just
put that code to handle the<br>
> pool :<br>
><br>
> @Endpoint<br>
> public class ExampleEndpoint implements
InitializingBean {<br>
><br>
> @Autowired<br>
> private ExampleRuleService
ruleService;<br>
> private Map<Integer, Boolean>
isRunningMap = new<br>
> HashMap<Integer, Boolean>();<br>
> private static final int
NB_POOL_SESSIONS = 5;<br>
><br>
> @PayloadRoot(localPart =
"com.example.ExampleRequest")<br>
> @ResponsePayload<br>
> public ExampleResponse handleRequest(<br>
> @RequestPayload
ExampleRequest request) throws<br>
> InterruptedException {<br>
> KieServices ks =
KieServices.Factory.get();<br>
> KieContainer kc =
ks.getKieClasspathContainer();<br>
> while (true) {<br>
> for (int i = 0; i <
NB_POOL_SESSIONS; i++) {<br>
> boolean run = false;<br>
><br>
> synchronized
(isRunningMap) {<br>
> if
(!isRunningMap.get(i)) {<br>
>
isRunningMap.put(i, true);<br>
> run = true;<br>
> }<br>
> }<br>
><br>
> if (run) {<br>
> KieSession ksession =
kc.newKieSession("KSession"<br>
> + (i + 1));<br>
> ExampleResponse
response =<br>
> ruleService.run(ksession, request);<br>
> ksession.dispose();<br>
><br>
> isRunningMap.put(i,
false);<br>
> return response;<br>
> }<br>
> }<br>
> Thread.sleep(100);<br>
> }<br>
> }<br>
><br>
> public void afterPropertiesSet()
throws Exception {<br>
> for (int i = 1; i <=
NB_POOL_SESSIONS; i++) {<br>
> isRunningMap.put((i - 1),
false);<br>
> }<br>
> }<br>
><br>
> }<br>
><br>
> It works well because in my benchmark I
improve 5 times the<br>
> performance (as I have 5 different
threads) but I wondered if it is a<br>
> good practice and if it does not hide any
issues that I could have in<br>
> the future.<br>
><br>
> Thanks for your help.<br>
><br>
> --<br>
> Maxime FALAIZE<br>
</div>
</div>
>
_______________________________________________<br>
> rules-users mailing list<br>
> <a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org"
target="_blank">rules-users@lists.jboss.org</a><br>
> <a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<br>
Hi maxime,<br>
<br>
I do not remember if use drools 6 or drools 5. If
you using drools 6.<br>
Phreaks algorithm use multi threading according to
use 'from<br>
accummulate' far i understand here:<br>
<a moz-do-not-send="true"
href="http://planet.jboss.org/post/drools_6_performance_with_the_phreak_algorithm"
target="_blank">http://planet.jboss.org/post/drools_6_performance_with_the_phreak_algorithm</a><br>
<br>
Instead to put a thread by ksession here rules
evaluation are<br>
multi-threaded.<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org"
target="_blank">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></blockquote>
</div>
</div>
</div>
<span class="HOEnZb"><font color="#888888"><br>
<br clear="all">
<div><br>
</div>
-- <br>
Maxime FALAIZE
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Maxime FALAIZE
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
Ah yes. Maybe Mark Proktor could tell some information about this<br>
</body>
</html>