<br>   Daniel,<br><br>   I think I missed your previous messages but can&#39;t you simply throw the session away and create a new session for every claim (don&#39;t forget to call dispose() when throwing away a session)? <br>
<br>   Also, your rule seems odd, so I am assuming that was just a sub-optimal example. As it was pasted, it seems to me that it could be simplified to the following, more efficient rule:<br><br>rule &quot;RULE_2090&quot;<br>

when<br>
        $cl: ClaimLine(historic == false, code == 000000003908, type == 
&quot;T&quot;)<br>
        $historic: ClaimLine(historic == true, type == &quot;P&quot;, code &gt;= 000000000052 
&amp;&amp; &lt;=<br>
000000000052, $dt : date, eval(Utilities.isWithinTimePeriod($dt, $cl.date, &quot;Y&quot;, 
&quot;99&quot;)) )<br>then<br>       String ruleName = drools.getRule().getName();<br>       results.addMessage(ruleName, &quot;000000003908&quot;,&quot;Only 1 test per day&quot;);<br>       results.setRefer(&quot;R&quot;);<br>
end<font color="#888888"><br></font><br>   Inlining the eval helps a bit, and in your example rule the collect() call is totally redundant as it will always be true and the consequence is not using the bound list.<br><br>
   Like in SQL queries, the performance of the rules is totally dependent on how they are written and the how you modeled the domain model. Also, if you have just a couple rules, it might be more efficient running pure java code, but for higher number of rules, Drools becomes more and more efficient when compared to simple java code implementations of the rules.<br>
<br>   I worked with a customer sometime ago that uses hundreds of rules with 500k+ facts in memory constantly and has average response time on the 100ms order... although, they did fine tuned their rules.<br><br>    Edson<br>
<br><div class="gmail_quote">2010/5/5 djb <span dir="ltr">&lt;<a href="mailto:dbrownell83@hotmail.com">dbrownell83@hotmail.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;">
<br>
Hi Drools aficionados,<br>
<br>
This is further to my request to improve speed.  As requested previously, I<br>
am providing an example rule.<br>
<br>
So, I found that by only retracting facts after processing multiple claims,<br>
instead of after every claim, I managed to improve speed from 300ms per<br>
claim to 50ms!  We need it to be sub-170ms to be a viable option.<br>
<br>
But, I need to retract facts.  As you can see, if I add new Claim data, it<br>
might match the last guy&#39;s claim data (Bad!).  It would appear that<br>
&#39;disabling&#39; the data would require an update and take as much time as a<br>
retract.<br>
<br>
So, is there any way around this?  Am I stuck with 300ms per claim?  Would<br>
changing to sequential stateless session be possible, or worthwhile?  If I<br>
can&#39;t improve the speed, I will have to advice against Drools for the<br>
project.<br>
<br>
regards,<br>
Daniel<br>
<br>
<br>
---------------------<br>
My rules look like this:<br>
<br>
rule &quot;RULE_2090&quot;<br>
when<br>
        $cl: ClaimLine(historic == false, code == 000000003908, type == &quot;T&quot;)<br>
        $historic: ClaimLine(historic == true, code &gt;= 000000000052 &amp;&amp; &lt;=<br>
000000000052, type == &quot;P&quot;, $dt : date)<br>
        eval(Utilities.isWithinTimePeriod($dt, $cl.date, &quot;Y&quot;, &quot;99&quot;))<br>
        $historic_many: ArrayList(size &gt;= 0) from collect(ClaimLine(historic ==<br>
true, code &gt;= 000000000052 &amp;&amp; &lt;= 000000000052, type == &quot;P&quot;))<br>
then<br>
        String ruleName = drools.getRule().getName();<br>
        results.addMessage(ruleName, &quot;000000003908&quot;,&quot;Only 1 test per day<br>
&quot;);<br>
        results.setRefer(&quot;R&quot;);<br>
end<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Bulk-Retract-speed-conundrum-tp779188p779188.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Bulk-Retract-speed-conundrum-tp779188p779188.html</a><br>

Sent from the Drools - User 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>
</font></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>