For this sort of analysis one has to know<br>(1) whether one Member can be a member of a single company only, or whether (s)he can be a member of more than one, too;<br>(2) (assuming it's N:1) whether is is possible to have a reference to the company as a field in each Member object<br>
(3) whether you can or cannot (for whatever reason) insert indovodual Company objects as single facts into WM:<br>(4) whether you can or cannot (for whatever reason) insert individual Member objects as single facts into WM:<br>
(5) whether matching for an individual Member is possible by a unique identification of that Member or whether it is only<br>possible in combination with the member's company (employee IDs are only unique within a Company)<br>
<br>Best performance for rules where you have to search for a Member with employeeId in a Company with name can be achieved<br>by <a href="http://s.th">s.th</a>. like the rule shown below, where I assume that Member:Comp is N:1 and Member contains a reference to his/her Company:<br>
<br>rule<br>when<br> LookFor( $comp : comp, $empId : empId )<br> $c: Company( name == $comp )<br> $m: Member( comp == $c, empId == $empId )<br>then ...<br><br>-W<br><br><br><div class="gmail_quote">2010/10/15 Nikhil S. Kulkarni <span dir="ltr"><<a href="mailto:Nikhil.Kulkarni@mastek.com">Nikhil.Kulkarni@mastek.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<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 & 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 style="color: black;" bgcolor="white"><tbody><tr><td><br>MASTEK LTD.<br>
In the US, we'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>