Hi Nikhil,<br><br>If it&#39;s taking 5-6 seconds as you said, it means that you are compiling your rules at runtime. To improve that, you could find a way to cache your KnowledgeBase<i>s</i> - that would make your rules be compiled only once and subsequent creation of stateless or stateful sessions would be pretty quick. To go further, you could create the knowledge bases using precompiled rules. For that, I use a maven plugin that compiles my drls at build time. I don&#39;t have a link now, but you should be able to find it.<br>
<br>Sharing your knowledge bases and precompiling your rules will certainly make a difference.<br><br>Hope that helps.<br><br>Leo. <br><br><div class="gmail_quote">On Sat, Sep 18, 2010 at 10:00 AM, Nikhil S. Kulkarni <span dir="ltr">&lt;<a href="mailto:Nikhil.Kulkarni@mastek.com">Nikhil.Kulkarni@mastek.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Edson,<br>
<br>
Thanks for the information.<br>
But now I want to ask you one thing. I have seen your post. The problem in application is mainly usage of memory<br>
You posted that Match 30,2010. I downloaded Drools 5.0 on August 2009 and I am using that.<br>
<br>
SO this &quot;True modify&quot; algorithm is implemented in Drools 5.1 only or it is even available in latest Drools 5.0<br>
<br>
If I use Drools 5.1 then Whether I will get any advantage.<br>
<br>
        In application we are using Rules Template ,Rule Flows and drls. When I am calling Rules from Java then it is taking more time compared to calling Java method from rules.<br>
<br>
<br>
        In addition to this can u suggest me how to write better rules Query.<br>
<br>
I am using very simple way of writing Rules Query like :-<br>
<br>
When<br>
Abc : ABC(condition==A)<br>
Then<br>
 Call method<br>
End;<br>
<br>
<br>
<br>
Thanks &amp; Regards,<br>
Nikhil S. Kulkarni<br>
<br>
<br>
<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of <a href="mailto:rules-users-request@lists.jboss.org">rules-users-request@lists.jboss.org</a><br>

Sent: Friday, September 17, 2010 9:30 PM<br>
To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
Subject: rules-users Digest, Vol 46, Issue 58<br>
<br>
Send rules-users mailing list submissions to<br>
        <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:rules-users-request@lists.jboss.org">rules-users-request@lists.jboss.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:rules-users-owner@lists.jboss.org">rules-users-owner@lists.jboss.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of rules-users digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. Re: Perfromance issues and memory leaks in Drools (Edson Tirelli)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 17 Sep 2010 11:04:55 -0400<br>
From: Edson Tirelli &lt;<a href="mailto:tirelli@post.com">tirelli@post.com</a>&gt;<br>
Subject: Re: [rules-users] Perfromance issues and memory leaks in<br>
        Drools<br>
To: Rules Users List &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<br>
Message-ID:<br>
        &lt;<a href="mailto:AANLkTinr2-%2BtwT_myOijf1rc_wAw7E6CVtwjPNGKBOb_@mail.gmail.com">AANLkTinr2-+twT_myOijf1rc_wAw7E6CVtwjPNGKBOb_@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;windows-1252&quot;<br>
<br>
    Nikhil,<br>
<br>
    Maybe you are using the term &quot;memory leak&quot; loosely here, but otherwise,<br>
Drools 4.0.7 and Drools 5.0.1 were both tested to exhaustion for memory<br>
leaks and I can tell you that no memory leak was found, and I personally<br>
doubt there is one there on regular use. Also, FYI, Drools 5.x eliminates<br>
the need for shadow facts, what is a considerable memory save over 4.x, but<br>
adds some other overheads for performance improvement that kind of offset<br>
those gains. On the other hand, Drools 5.1.1 takes the algorithm to a new<br>
level, saving a lot of memory on systems that use modify actions on their<br>
rules.<br>
<br>
<a href="http://blog.athico.com/2010/03/drools-halves-memory-use-with-new-true.html" target="_blank">http://blog.athico.com/2010/03/drools-halves-memory-use-with-new-true.html</a><br>
<br>
    Regarding your performance, all I can tell you is that a rules engine is<br>
a relational engine that works pretty much like a database, and rules as<br>
databases queries. The same way you can write SQL queries that run fast or<br>
slow on a database, you can write rules that run fast or slow on a rules<br>
engine. It all depends on how the rules/queries are written, how your data<br>
model/domain model looks like, etc.<br>
<br>
    So, regarding your question, we can&#39;t tell you how to improve those<br>
metrics without knowing your domain model, rules and etc.<br>
<br>
    []s<br>
    Edson<br>
<br>
2010/9/17 Nikhil S. Kulkarni &lt;<a href="mailto:Nikhil.Kulkarni@mastek.com">Nikhil.Kulkarni@mastek.com</a>&gt;<br>
<br>
&gt;  Hi,<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;                 I have written 2 different Drools programs. One is with<br>
&gt; Using rule Base of Drools 4.0 and other is using Knowledge Base of Drools<br>
&gt; 5.0.<br>
&gt;<br>
&gt; I was trying to check that is there any improvement in Drools 5.0. But I<br>
&gt; haven?t got any performance improvement in Drools 5.0 code compared to<br>
&gt; Drools 4.0.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;                 One more important thing is I am calling this drools code<br>
&gt; from  My application which itself is heavy application, when I am doing<br>
&gt; Performance tuning<br>
&gt;<br>
&gt; I got one point i.e. session.execute() method is taking around 6-7 seconds<br>
&gt; to initialize rules and even the memory utilized by Rules is huge.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; So is there any way that we can reduce the Memory leakage and improve<br>
&gt; performance.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Waiting for Reply.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Thanks &amp; Regards,<br>
&gt;<br>
&gt; Nikhil S. Kulkarni<br>
&gt;<br>
&gt; Emp No: - 9254<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; MASTEK LTD.<br>
&gt; In the US, we&#39;re called MAJESCOMASTEK<br>
&gt;<br>
&gt;<br>
&gt; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
&gt;<br>
&gt; 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>

&gt;<br>
&gt; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
&gt;<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>
&gt;<br>
<br>
<br>
--<br>
  Edson Tirelli<br>
  JBoss Drools Core Development<br>
  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.jboss.org/pipermail/rules-users/attachments/20100917/2573a187/attachment-0001.html" target="_blank">http://lists.jboss.org/pipermail/rules-users/attachments/20100917/2573a187/attachment-0001.html</a><br>

<br>
------------------------------<br>
<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>
<br>
End of rules-users Digest, Vol 46, Issue 58<br>
*******************************************<br>
<br>
<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>
<br>
<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>
</blockquote></div><br>