<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="City"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
h1
        {margin-top:12.0pt;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        page-break-after:avoid;
        font-size:16.0pt;
        font-family:Arial;
        color:black;}
h2
        {margin-top:12.0pt;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        page-break-after:avoid;
        font-size:14.0pt;
        font-family:Arial;
        color:black;
        font-style:italic;}
h3
        {margin-top:12.0pt;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        page-break-after:avoid;
        font-size:13.0pt;
        font-family:Arial;
        color:black;}
p.MsoCaption, li.MsoCaption, div.MsoCaption
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:6.0pt;
        margin-left:0in;
        font-size:10.0pt;
        font-family:"Times New Roman";
        color:black;
        font-weight:bold;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
        {margin-top:12.0pt;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        text-align:center;
        font-size:16.0pt;
        font-family:Arial;
        color:black;
        font-weight:bold;}
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:6.0pt;
        margin-left:0in;
        text-indent:.5in;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
p.MsoSubtitle, li.MsoSubtitle, div.MsoSubtitle
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:3.0pt;
        margin-left:0in;
        text-align:center;
        font-size:12.0pt;
        font-family:Arial;
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.Code, li.Code, div.Code
        {margin:0in;
        margin-bottom:.0001pt;
        background:#F3F3F3;
        border:none;
        padding:0in;
        font-size:9.0pt;
        font-family:"Courier New";
        color:black;}
p.code0, li.code0, div.code0
        {margin:0in;
        margin-bottom:.0001pt;
        background:#F3F3F3;
        font-size:9.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle25
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>OK, I did. So that means I need to disable
shadow facts?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:windowtext'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:windowtext'> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Mark Proctor<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, May 15, 2008 12:22
PM<br>
<b><span style='font-weight:bold'>To:</span></b> Rules Users List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] Shadow
facts(was JRules\Drools benchmarking)</span></font><font color=black><span
style='color:windowtext'><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>Hehl, Thomas wrote: <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"><u1:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"><!--[if gte mso 9]><xml>
   <u1:shapedefaults u2:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
   <u1:shapelayout u3:ext="edit">
    <u1:idmap u3:ext="edit" data="1"/>
   </u1:shapelayout>
</xml><![endif]--></u1:SmartTagType></u1:SmartTagType>I did some reading about
shadow facts and I was thinking about turning them off, but it seems to be that
if I use stateless sessions (session.execute()) that shadow facts are
irrelevant. Is this true?</span></font><o:p></o:p></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>No, only if you turn on sequential mode.<br>
<br>
Mark<br>
<br>
<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><u1:p></u1:p><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> <a
href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>
[<a href="mailto:rules-users-bounces@lists.jboss.org">mailto:rules-users-bounces@lists.jboss.org</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Edson Tirelli<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, May 15, 2008 10:00
AM<br>
<b><span style='font-weight:bold'>To:</span></b> Rules Users List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users]
JRules\Drools benchmarking...</span></font><u1:p></u1:p><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u1:p>&nbsp;</u1:p><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt'><br>
&nbsp;&nbsp; It seems you are using a good strategy to do your tests. But
still, it is difficult to explain why one is slower than the other without
seeing the actual test code. This is because all the engines have stronger and
weaker spots. Just to mention one example, some engines (not talking
specifically about drools and jrules, but about all engines) implement faster
alpha evaluation, others implement faster beta (join) evaluation, others
implement good optimizations for not() while others may focus on eval(), etc.
It is up to the point that when comparing 2 engines, one performs better in
hardware with a bigger L2 cache while the other performs better in hardware
with a smaller L2 cache.<br>
<br>
&nbsp;&nbsp; So, best I can do without looking at the actual tests is provide
you some tips:<br>
<br>
1. First of all, are you using Drools 4.0.7? It is very important that you use
this version over the previous ones.<br>
<br>
2. Are you using stateful or stateless sessions? If you are using stateful
sessions are you calling dispose() after using the session? If not, you are
inflating your memory and certainly causing the engine to run slower over time.<br>
<br>
3. Are you sharing the rulebase among multiple requests? The drools rulebase is
designed to be shared and the compilation process is eager and pretty heavy
compared to session creation. So, it pays off to create the rulebase once and
share among requests.<br>
<br>
4. Did you disabled shadow facts? Test cases usually use a really small fact
base, so would not be much affected by shadow facts, but still, disabling them
improves performance, but require some best practices to be followed.<br>
<br>
5. Do your rules follow best practices (similar to SQL writing best practices),
i.e., write the most constraining patterns first, write the most constraining
restrictions first, etc? Do you write patterns in the same order among rules to
maximize node sharing? I guess you do, but worth mentioning anyway.<br>
<br>
&nbsp;&nbsp; Anyway, just some tips.<br>
<br>
&nbsp;&nbsp; Regarding the jrules blog, I know it, but I make a bet with you.
Download the manners benchmark to your machine, make sure the rules are the
correct ones (not cheated ones), run the test on both engines and share the
results. I pay you a beer if you get results similar to those published in the
blog. :) <br>
&nbsp;&nbsp; My point is not that we are faster (what I know we are) or them
are faster. My point is that perf benchmarks for rules engines are a really
tricky matter, with lots of variables involved, that make every test case
configuration unique. Try to reproduce in a different environment and you will
get different performance rates between the engines.<br>
<br>
&nbsp;&nbsp; That is why, our recommendation is to always do what you are
doing: try your own use case. Now, whatever you are trying, I'm sure it is
possible to optimize if we see the test case, but is it worth it? Or the perf
as it is already meets your requirements?<br>
<br>
&nbsp;&nbsp; Cheers,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edson<br>
<br>
PS: I'm serious about the beer... ;) run and share the results with us... <br>
<br>
<br>
<o:p></o:p></span></font></p>

<u1:p></u1:p>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>2008/5/15 mmquelo massi &lt;<a
href="mailto:mmquelo@gmail.com" moz-do-not-send=true>mmquelo@gmail.com</a>&gt;:<u1:p></u1:p><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>You r right...<br>
<br>
I have to tell you what I have done...<br>
<br>
I did not define a &quot;stand-alone&quot; benchmark like the
&quot;Manners&quot; one.<br>
<br>
I benchmarked a real j2ee application.<br>
<br>
I have got jrules deployed with a resource adapter and drools deployed<br>
with simple jars libraries plus jbrms.<br>
<br>
Jrules uses a &quot;bres&quot; module which does the same trick jbrms does.<br>
<br>
Both of them are deployed on the same AS, in the same time, same<br>
machine (my laptop: dual core 2 duo 1.66, 2GB).<br>
<br>
Using the inversion of control pattern I found out how to &quot;switch the<br>
rule engine&quot; at run-time. So I can easily choose then rule engine to<br>
use between drools and jrules.<br>
<br>
Ofcourse thay have got two separate rule repositories but both of them<br>
persist the rules on the same DB which is <st1:City u4:st="on"><st1:place u4:st="on"><st1:City
w:st="on"><st1:place w:st="on">Derby</st1:place></st1:City></st1:place></st1:City>.<br>
<br>
The j2ee application I benchmarked sends a request object to the<br>
current rule engine and get back a reply from it. I just measured the<br>
elapsed time between the request and reply generation using drools<br>
first and the jrules.<br>
<br>
I did the measurements tens of times.<br>
<br>
Both rule engines implement the same rules and the Drools rules (which<br>
I personally implemented) are at least as optimized as the jrules<br>
ones. In the Jrules version of the rules there are a lot of<br>
&quot;Eval(...)&quot; blocks in the Drools version I did not use the
&quot;Eval()&quot; at<br>
all ....but I just did pattern matching.<br>
<br>
If you want i can send you a more specific documentation but I hope<br>
this explanation will be enough to show you that the measurements I<br>
have done are not that bad.<br>
<br>
In any case I noticed that after a warming-up phase, the drools engine<br>
gives a reply back 3 times slower than the jrules engine.<br>
<br>
The link I have sent show you something related to it, It reports the<br>
manners execution time using drools and jrules. As you can see the<br>
difference is a 1,5x factor....so I was wrong... drools is not that<br>
slow. In anycase seems to be slower that jrules.<br>
<br>
Look at this:<u1:p></u1:p><o:p></o:p></span></font></p>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt'><br>
<a
href="http://blogs.ilog.com/brms/wp-content/uploads/2007/10/jrules-perf-manners.png"
target="_blank" moz-do-not-send=true>http://blogs.ilog.com/brms/wp-content/uploads/2007/10/jrules-perf-manners.png</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>Massimiliano<u1:p></u1:p><o:p></o:p></span></font></p>

<div>

<div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><br>
<br>
<br>
On 5/15/08, Edson Tirelli &lt;<a href="mailto:tirelli@post.com"
moz-do-not-send=true>tirelli@post.com</a>&gt; wrote:<br>
&gt; &nbsp; &nbsp;The old recurring performance evaluation question... :)<br>
&gt;<br>
&gt; &nbsp; &nbsp;You know that an explanation can only be made after having
looked at the<br>
&gt; tests used in the benchmark, the actual rules used by both products,<br>
&gt; hardware specs, etc... so, not quite sure what answer do you want?<br>
&gt;<br>
&gt; &nbsp; &nbsp;For instance, there are a lot of people that think exactly
the contrary.<br>
&gt; Just one example:<br>
&gt; <a
href="http://blog.athico.com/2007/08/drools-vs-jrules-performance-and-future.html"
target="_blank" moz-do-not-send=true>http://blog.athico.com/2007/08/drools-vs-jrules-performance-and-future.html</a><br>
&gt;<br>
&gt; &nbsp; &nbsp;My preferred answer is still:<br>
&gt;<br>
&gt; &quot;In 99% of the applications, the bottleneck is IO: databases,
network, etc.<br>
&gt; So, test your use case with both products, make sure it performs well<br>
&gt; enough, add to your analysis the products feature set, expressiveness
power,<br>
&gt; product flexibility, cost, professionals availability, support quality,
etc,<br>
&gt; and choose the one that best fits you.&quot;<br>
&gt;<br>
&gt; &nbsp; &nbsp;That is because I'm sure, whatever your rules are, in
whatever product<br>
&gt; you try them, they can be further optimized by having a product expert<br>
&gt; looking into them. But what is the point?<br>
&gt;<br>
&gt; &nbsp; &nbsp;Cheers,<br>
&gt; &nbsp; &nbsp; &nbsp; Edson<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; 2008/5/14 mmquelo massi &lt;<a href="mailto:mmquelo@gmail.com"
moz-do-not-send=true>mmquelo@gmail.com</a>&gt;:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi everybody,<br>
&gt;&gt;<br>
&gt;&gt; I did a benchmark on Drools\Jrules.<br>
&gt;&gt;<br>
&gt;&gt; I found out that drools is about 2,5-3 times slower than Jrules.<br>
&gt;&gt;<br>
&gt;&gt; How comes?<br>
&gt;&gt;<br>
&gt;&gt; The results I got are quite similar to the ones in:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; <a
href="http://images.google.com/imgres?imgurl=http://blogs.ilog.com/brms/wp-content/uploads/2007/10/jrules-perf-manners.png&amp;imgrefurl=http://blogs.ilog.com/brms/category/jrules/&amp;h=516&amp;w=722&amp;sz=19&amp;hl=it&amp;start=1&amp;um=1&amp;tbnid=YBqwC0nwaSLxwM:&amp;tbnh=100&amp;tbnw=140&amp;prev=/images%3Fq%3Dbrms%2Bbencmark%26um%3D1%26hl%3Dit"
target="_blank" moz-do-not-send=true>http://images.google.com/imgres?imgurl=http://blogs.ilog.com/brms/wp-content/uploads/2007/10/jrules-perf-manners.png&amp;imgrefurl=http://blogs.ilog.com/brms/category/jrules/&amp;h=516&amp;w=722&amp;sz=19&amp;hl=it&amp;start=1&amp;um=1&amp;tbnid=YBqwC0nwaSLxwM:&amp;tbnh=100&amp;tbnw=140&amp;prev=/images%3Fq%3Dbrms%2Bbencmark%26um%3D1%26hl%3Dit</a><br>
&gt;&gt;<br>
&gt;&gt; Any explanations?<br>
&gt;&gt;<br>
&gt;&gt; Thank you.<br>
&gt;&gt;<br>
&gt;&gt; Bye<br>
&gt;&gt;<br>
&gt;&gt; Massi<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org" moz-do-not-send=true>rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank" moz-do-not-send=true>https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Edson Tirelli<br>
&gt; JBoss Drools Core Development<br>
&gt; Office: +55 11 3529-6000<br>
&gt; <st1:City u4:st="on"><st1:place u4:st="on"><st1:City w:st="on"><st1:place
 w:st="on">Mobile</st1:place></st1:City></st1:place></st1:City>: +55 11
9287-5646<br>
&gt; JBoss, a division of Red Hat @ <a href="http://www.jboss.com"
target="_blank" moz-do-not-send=true>www.jboss.com</a><br>
&gt;<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" moz-do-not-send=true>rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"
moz-do-not-send=true>https://lists.jboss.org/mailman/listinfo/rules-users</a><u1:p></u1:p><o:p></o:p></span></font></p>

</div>

</div>

</div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><br>
<br clear=all>
<br>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
Office: +55 11 3529-6000<br>
<st1:City u4:st="on"><st1:place u4:st="on"><st1:City w:st="on"><st1:place
 w:st="on">Mobile</st1:place></st1:City></st1:place></st1:City>: +55 11
9287-5646<br>
JBoss, a division of Red Hat @ <a href="http://www.jboss.com"
moz-do-not-send=true>www.jboss.com</a> <u1:p></u1:p><o:p></o:p></span></font></p>

<pre wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>

<hr size=4 width="90%" align=center>

</span></font></pre><pre><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>_______________________________________________<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>rules-users mailing list<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>&nbsp; <o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>