The code you have posted just calls newStatefulKnowledgeSession, which does lock and unlock. But this should not prevent the insertion of facts and the firing of rules executing in parallel. It&#39;s pointless to execute newStatefulKnowledgeSession a million times in a single thread and to do nothing else, because this won&#39;t be a meaningful use case.<br>
<br>Don&#39;t run the million-times-loop. Just waste some cycles between session creation and dispose and see how many of these you can have in parallel. <br><br>-W<br><br><br><div class="gmail_quote">2011/10/11 Juan Carlos Fernández <span dir="ltr">&lt;<a href="mailto:juancarlos.fernandez@safelayer.com">juancarlos.fernandez@safelayer.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">We create one StatefulKnowledgeSession for every client (if 20 clients at<br>
same time, 20 StatefulKnowledgeSession are created) because every client has<br>
different environment for rule evaluation. Facts for one client does not<br>
have to collide with facts of other clients so this is the reason why we<br>
create multiple sessions.<br>
<br>
Let me explain all this in greater detail. When a client executes a SOAP<br>
operation, one StatefulKnowledgeSession is created and associated to the<br>
transaction. Every log generated by the transaction is inserted as a Fact.<br>
When transaction finishes, we fire all rules for the current transaction<br>
knowledge session in order to correlate all transaction logs. This<br>
transaction logs do not have to collide with other transaction logs so every<br>
thread (transaction) has its own StatefulKnowledgeSession.<br>
<br>
Our app locks and begin to use only one CPU thread because of<br>
newStatefulKnowledgeSession().<br>
<br>
Do you think entry-points would be the solution? Is there any other<br>
solution?<br>
<br>
One solution is to use StatefulKnowledgeSession pool who creates instances<br>
but we have to retract all facts when returning session to pool.<br>
<br>
Concurrent executions and throughput is a key feature of our SOAP<br>
application.<br>
<br>
Thank you very much<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-construction-executes-sequentially-no-multithread-tp3412107p3412222.html" target="_blank">http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-construction-executes-sequentially-no-multithread-tp3412107p3412222.html</a><br>

</font><div><div></div><div class="h5">Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>