You can also split your application in multiple processes to use multiple JVMs. if you have 8 threads it can be divided into starting two apps with 4 threads each. If you are working with Stateless session that shouldn&#39;t be a problem. <div>

Cheers</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 11, 2012 at 7:23 AM, Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Looking at the code of the thread you are running in parallel<br>
I guess that almost all of its time is spent in session creation,<br>
and during this (and the dispose) the knowledge base is a<br>
resource that needs protection. Thus, the test you are running<br>
isn&#39;t well suited for demonstrating concurrency.<br>
<br>
* Run one stateful session per thread, inserting and retracting<br>
(random) facts.<br>
* Add code wasting cycles to your rule(s).<br>
<br>
Also, make sure that the global (which is shared between sessions)<br>
isn&#39;t causing another bottleneck.<br>
<span class="HOEnZb"><font color="#888888"><br>
-W<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 11/12/2012, ping &lt;<a href="mailto:jinpingv@hotmail.com">jinpingv@hotmail.com</a>&gt; wrote:<br>
&gt; I tried profiling my test program and found that all thread spent most of<br>
&gt; their time blocking or waiting for the same lock:<br>
&gt; org.drools.runtime.process.ProcessRuntimeFactory.getProcessRuntimeFactoryService()<br>
&gt; and<br>
&gt; org.drools.common.AbstractRuleBase.lock()<br>
&gt;<br>
&gt; examples:<br>
&gt;<br>
&gt; Thread-6 [WAITING] CPU time: 1s<br>
&gt; java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock()<br>
&gt; org.drools.common.UpgradableReentrantReadWriteLock.lowPriorityWriteLock()<br>
&gt; org.drools.common.UpgradableReentrantReadWriteLock.writeLock()<br>
&gt; org.drools.common.AbstractRuleBase.lock()<br>
&gt; org.drools.impl.StatelessKnowledgeSessionImpl.&lt;init&gt;(InternalRuleBase,<br>
&gt; KnowledgeAgent, KnowledgeSessionConfiguration)<br>
&gt; org.drools.impl.KnowledgeBaseImpl.newStatelessKnowledgeSession()<br>
&gt; java.lang.Thread.run()<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Thread-7 [BLOCKED] CPU time: 1s<br>
&gt; org.drools.runtime.process.ProcessRuntimeFactory.getProcessRuntimeFactoryService()<br>
&gt; org.drools.runtime.process.ProcessRuntimeFactory.newProcessRuntime(AbstractWorkingMemory)<br>
&gt; org.drools.common.AbstractWorkingMemory.createProcessRuntime()<br>
&gt; org.drools.common.AbstractWorkingMemory.setKnowledgeRuntime(InternalKnowledgeRuntime)<br>
&gt; org.drools.impl.StatefulKnowledgeSessionImpl.&lt;init&gt;(ReteooWorkingMemory,<br>
&gt; KnowledgeBase)<br>
&gt; org.drools.impl.StatelessKnowledgeSessionImpl.newWorkingMemory()<br>
&gt; org.drools.impl.StatelessKnowledgeSessionImpl.execute(Object)<br>
&gt; java.lang.Thread.run()<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context:<br>
&gt; <a href="http://drools.46999.n3.nabble.com/Multi-threading-inefficiency-caused-by-static-class-synchronization-tp4021160p4021163.html" target="_blank">http://drools.46999.n3.nabble.com/Multi-threading-inefficiency-caused-by-static-class-synchronization-tp4021160p4021163.html</a><br>


&gt; Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<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><br clear="all"><div><br></div>-- <br> - MyJourney @ <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><div> - Co-Founder @ <a href="http://www.jugargentina.org" target="_blank">http://www.jugargentina.org</a><br>

 - Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br> <br> - Salatino &quot;Salaboy&quot; Mauricio -</div><br>
</div>