I cannot tell from what you have posted; but without relating member to company you run the risk of producing a Cartesian product of results which would, no doubt, give you a performance problem.<div><br></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">rule &quot;Cartesian product&quot;</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    when</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        $c : Company()</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        $m : Member()</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    then</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        //Joined all Companies to all Members. Ouch!</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">end</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">rule &quot;Join 1&quot;</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    when</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        $c : Company()</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        $m : Member(company == $c)</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    then</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        //Nice</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">end</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">rule &quot;Join 2&quot;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    when</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        $c : Company()</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        $m : Member() from $c.members</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    then</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        //Nice</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">end</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Rule &quot;Join 2&quot; should enable you to only insert Company&#39;s into working memory too.</font></div>
<div><br><br><div class="gmail_quote">2010/10/15 Nikhil S. Kulkarni <span dir="ltr">&lt;<a href="mailto:Nikhil.Kulkarni@mastek.com">Nikhil.Kulkarni@mastek.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">









<div lang="EN-US" link="blue" vlink="purple">

<div>

<p class="MsoNormal">Hi ,</p>

<p class="MsoNormal">                I
am using drools 5.0 in application. I am facing performance issues. I am using
drls, rule flows and rule templates.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">My scenario is as follows :-</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Consider there is list of 20 companies.</p>

<p class="MsoNormal">There are about 20000 members in each company.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Now I have several rules in which condition is for specific member
and specific company.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">e.g.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">rule 1</p>

<p class="MsoNormal"> when  comp : company</p>

<p class="MsoNormal">                and
member : Members</p>

<p class="MsoNormal">then</p>

<p class="MsoNormal">………</p>

<p class="MsoNormal">End;</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">So similarly I passed Member list and company list as fact.
But it was time consuming process.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">So I have done one change.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I kept only comp:company in when condition of rule as I
explained above and declare member list as global .</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I created a function in rule in which I am iterating over member
list and doing the same process.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Now this is taking less time.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Now my question is how efficient is this change.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Though we say that when we write specific condition in rule
then it will be fired only in that case. </p>

<p class="MsoNormal">But when I use Agenda Event Listener class,</p>

<p class="MsoNormal">I come to know one thing that it creates activation-created
for all possible conditions then it will fire activation-Fired for specific condition</p>

<p class="MsoNormal">And after that it will cancel all the activations.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">So as I reduced member level fact condition my time is
reduced drastically and performance improved.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">So anybody can suggest me that whether I am on right track
of improving time and performance or not ?</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Waiting for reply.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"><b>Thanks &amp; Regards,</b></p>

<p class="MsoNormal"><b>Nikhil S. Kulkarni</b></p>

<p class="MsoNormal"><b> </b></p>

<p class="MsoNormal"> </p>

</div>

<br><br><table bgcolor="white" style="color:black"><tbody><tr><td><br>MASTEK LTD.<br>
In the US, we&#39;re called MAJESCOMASTEK<br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.<br>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
</td></tr></tbody></table></div>


<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>