In short no.<div><br></div><div>Activations are determined when Facts are inserted into WorkingMemory not when a call to fire the rules is made. Consequentially, IMO, &quot;through put&quot; is really limited to how quickly you can insert Facts into the network. You could have multiple threads inserting Facts into different stateless sessions however you&#39;d need to decide how to partition your facts between Threads. </div>
<div><br></div><div>Perhaps you should trial your performance concerns before embarking on more elaborate architectures? If your processing is stateless than you will be able to scale this horizontally if the need arises. </div>
<div><br></div><div>With kind regards,</div><div><br></div><div>Mike<br><br><div class="gmail_quote">2010/9/27 Harshit Bapna <span dir="ltr">&lt;<a href="mailto:hrbapna@gmail.com">hrbapna@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi All,<br><br>Thanks to Leo and Mark for the help...<br>Please find my comments(<span style="color:rgb(0, 0, 102)">blue</span>) inline.<br><br>Crisp question:<br><b><span style="color:rgb(51, 0, 153)">Is there any functionality in drools where I can run the rules(stateless session) in parallel threads to increase the throughput ?</span></b><br>

<span style="color:rgb(51, 0, 153)">Note: The rules actions won&#39;t change the facts/data such that it would require running of the rules again. Hence I came to this conclusion that stateless sessions are required.<br>

<br></span><div class="gmail_quote">2010/9/24 Leonardo Gomes <span dir="ltr">&lt;<a href="mailto:leonardo.f.gomes@gmail.com" target="_blank">leonardo.f.gomes@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

Hello Harshit / Mark,<br><br>My reasoning behind the yes, is that:<br><br>- If you have 10 rules that won&#39;t necessarily always match, it&#39;s better to use Rete, than sequentially match one-by-one. The tree structure with the sharing of nodes for different rules seems to always be a better approach for me, than sequentially testing one-by-one and, in some cases, retesting the same condition on different rules (if that happens);<br>


<br></blockquote><div><span style="color:rgb(51, 0, 153)">In my use case, the overlap of sub-conditions is not much. There would be only few conditions which will have common sub conditions and the no of sub conditions would be max 5. <br>

After reading the articles, I agree with Leo that still its better to use RETE than sequentially testing one by one.</span><br style="color:rgb(51, 0, 153)"><span style="color:rgb(51, 0, 153)"><br>Also the rules actions won&#39;t change the facts/data such that it would require running of the rules again. Hence I came to this conclusion that stateless sessions are required.</span><br style="color:rgb(51, 0, 153)">

<br style="color:rgb(51, 0, 153)"><span style="color:rgb(51, 0, 153)">I have jotted down the applicable reasons for me to use the rule engine (based on my readings on drools &amp; rete) :</span><br style="color:rgb(51, 0, 153)">

<span style="color:rgb(51, 0, 153)">1. separation of business logic from application logic.</span><br style="color:rgb(51, 0, 153)"><span style="color:rgb(51, 0, 153)">2. rules are flexible and likely to be changed overtime.</span><br style="color:rgb(51, 0, 153)">

<br style="color:rgb(51, 0, 153)"><span style="color:rgb(51, 0, 153)">My requirements would be satisfied by using stateless session functionality of drools.</span><br style="color:rgb(51, 0, 153)"><span style="color:rgb(51, 0, 153)">Questions:</span><br style="color:rgb(51, 0, 153)">

<b><span style="color:rgb(51, 0, 153)">Is there any functionality in drools where I can run the rules in parallel thread to increase the throughput ?</span></b><br>(I can use java threads to run the rules separately in different threads but would like to know if there is any optimization approach in drools for stateless sessions)<br style="color:rgb(51, 0, 153)">

<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">- You can write if-then-elses in a imperative language and perform better than Rete, but if your rules are complicated and you have many of them, it&#39;s likely that rete can do a better job; Also, if you need to change your rules or add new ones, it will be easier to do that declaratively;<br>


<br></blockquote><div><span style="color:rgb(51, 0, 153)">I think here you are suggesting that using a rule engine would be better. (based on ur comments on the need to change rules, add new ones)</span><br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

I first put the links, because you can use that to judge yourself whether or not you might gain in performance in your own scenarios, with that material.<br><br></blockquote><div><span style="color:rgb(51, 0, 153)">Thanks Leo. It really helped me to improve my understanding of the algorithm.</span> <br>

</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><br>@Mark: <br><div><div><br><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex" class="gmail_quote">


In general a stateless session is just a convenience api for
    stateful, it just wraps. So no performance gain at all.</blockquote></div><div><br>I think here you&#39;re saying that there will be no performance gain compared to a stateful session, but I believe that the question was more on the lines of &quot;I know that with a stateful it&#39;s efficient, how about stateless&quot;. I tried to say that, yes, it&#39;s also worth using Rete in stateless scenarios.<br>


<br></div></div></blockquote><div><span style="color:rgb(51, 0, 153)"> Mark, I meant the same what Leo explained.</span><br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

<div><div>Cheers,<br>Leo.<br></div> </div><div class="gmail_quote">2010/9/24 Mark Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt;</span><div><div></div><div>

<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">


  
    
  
  <div bgcolor="#ffffff" text="#000000"><div>
    On 24/09/2010 16:18, Leonardo Gomes wrote:
    <blockquote type="cite">Have a look here: <a href="http://www.drdobbs.com/184405218" target="_blank">http://www.drdobbs.com/184405218</a><br>
      <br>
      here: <a href="http://blog.athico.com/2007/07/sequential-rete.html" target="_blank">http://blog.athico.com/2007/07/sequential-rete.html</a><br>
      <br>
      and here: <a href="http://herzberg.ca.sandia.gov/guidelines.shtml" target="_blank">http://herzberg.ca.sandia.gov/guidelines.shtml</a><br>
      <br>
      The easy answer for your question is &quot;Yes&quot; ;-)<br>
    </blockquote></div>
    It depends :)<br>
    <br>
    In general a stateless session is just a convenience api for
    stateful, it just wraps. So no performance gain at all.<br>
    <br>
    There is a &quot;sequential&quot; mode, but in all honest you won&#39;t get any
    measurable perf gain. So I wouldn&#39;t use sequential mode for
    performance, the only reason to use it is if you want your rules to
    execute sequentially.<br><font color="#888888">
    <br>
    Mark</font><div><br>
    <blockquote type="cite"><br>
      Cheers,<br>
      Leo.<br>
      <br>
      <div class="gmail_quote">
        2010/9/24 Harshit Bapna <span dir="ltr">&lt;<a href="mailto:hrbapna@gmail.com" target="_blank">hrbapna@gmail.com</a>&gt;</span><br>
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
          Hi All,<br>
          <br>
          In a scenario where lets say 10 rule are to be fired (in any
          order) in a stateless session than will I get the benefits of
          RETE algorithm (i.e increased performance).<br>
          i.e Whether the engine will fire all the ten results in a
          parallel fashion or Whether the engine will file each rule one
          by one.<br>
          <br>
          How RETE algorithm will improve the performance of the engine
          for rules fired in stateless session ?<br>
          <br>
          <br>
          _______________________________________________<br>
          rules-users mailing list<br>
          <a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
          <br>
        </blockquote>
      </div>
      <br>
      <pre><fieldset></fieldset>
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote>
    <br>
  </div></div>

<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div></div></div><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br><br clear="all"><br>-- <br><font color="#888888">-- Harshit Bapna<br><br>
</font><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>
<br></blockquote></div><br></div>