<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 19/12/2011 17:03, David Martin wrote:
<blockquote
cite="mid:CB14ADE9.D2D5%25david.martin@mercedsystems.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div>No, Mark... You nailed it. My "guards" were reversed and my
rules were no longer matching anything.</div>
<div><br>
</div>
<div>The change you suggest below seems to do the trick though...
Putting the nested accessor first took a 90s process of 10k
records down to 12s. </div>
<div><br>
</div>
<div>Phew! I will double and triple check my work now, but thanks
a million! I would never have thought swapping the order could
have such a huge impact on performance.</div>
</blockquote>
In your case what you have there is not a nested accessor.
"device_type" is a direct field of BINNING_INPUT. It use to be in
earlier versions of drools that fields must be to the left of the
operator, and this would have blown up. However edson has been
working on improving things for "free form" expressions, to remove
artificial barriers to authoring constraints. I suspect though that
things that do not fall into the legacy layout are written as evals,
and thus you miss out on the indexing. In short because you put
$call to the left of the operator Drools was not intelligent enough
to know that this was not a variable constraint, and it executed as
an eval. We'll be improving that intelligence over time.<br>
<br>
M<br>
<blockquote
cite="mid:CB14ADE9.D2D5%25david.martin@mercedsystems.com"
type="cite">
<div><br>
</div>
<div>Dave</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt;
text-align:left; color:black; BORDER-BOTTOM: medium none;
BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT:
0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid;
BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Mark Proctor <<a
moz-do-not-send="true" href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>><br>
<span style="font-weight:bold">Reply-To: </span>Rules Users
List <<a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
<span style="font-weight:bold">Date: </span>Mon, 19 Dec 2011
16:59:25 +0000<br>
<span style="font-weight:bold">To: </span><<a
moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re:
[rules-users] Poor performance from a simple join<br>
</div>
<div><br>
</div>
<div>
<div bgcolor="#FFFFFF" text="#000000">On 19/12/2011 16:58,
Mark Proctor wrote:
<blockquote cite="mid:4EEF6D22.3010009@codehaus.org"
type="cite">sorry I misread that, you've put the binding
first, not using a nested accessor.<br>
<br>
Currently you have<br>
$call : BINNING_INPUT()<br>
$device_typeLookup : LU_DEVICE_TYPE( $call.device_type ==
device_type )<br>
<br>
try rewriting it as:<br>
$call : BINNING_INPUT()<br>
$device_typeLookup : LU_DEVICE_TYPE( device_type ==
$call.device_type )<br>
<br>
I know edson was working on making such that the order no
longer matters, I'm not sure what progress he made on that
and he's away at the moment so can't answer. It may be
that he's already done that work and it's correctly
getting executed as an indexed constraint, or it might be
rewritting to an eval. Hopefully edson can answer when he
gets back.<br>
<br>
Ass Mauricio suggests, maybe you can restrict the number
of instances for BINNING_INPUT and LU_DEVICE_TYPE too.<br>
</blockquote>
ooops<br>
s/Ass/As/<br>
<blockquote cite="mid:4EEF6D22.3010009@codehaus.org"
type="cite"><br>
Mark<br>
<br>
<br>
<br>
<br>
On 19/12/2011 16:51, Mark Proctor wrote:
<blockquote cite="mid:4EEF6B79.6000600@codehaus.org"
type="cite">Nested accessors are not currently indexed,
because we cannot assure their immutability:<br>
<span id="OLK_SRC_BODY_SECTION"><span
style="font-family: 'Courier New'; ">$call.device_type<br>
<br>
If people changed indexed nested accessors, without
correctly notifying the engine it would result in
integrity problems.<br>
<br>
If you have a large number of these, trying
flattening the model, such as you would do in a
database.<br>
<br>
Mark<br>
</span></span>On 19/12/2011 16:23, David Martin wrote:
<blockquote
cite="mid:CB14A3D9.D29C%25david.martin@mercedsystems.com"
type="cite">
<div><span class="Apple-style-span"
style="font-family: Tahoma; font-size: 13px; ">Folks:</span></div>
<span id="OLK_SRC_BODY_SECTION">
<div dir="ltr">
<div ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family:
Tahoma;color: #000000;font-size: 10pt;">
<br>
My co-workers and I have been using Drools to
great success, but we ran smack into a
performance brick wall recently.<br>
<br>
In the example below, both BINNING_INPUT and
LU_DEVICE_TYPE have large numbers of
associated facts in working memory
(BINNING_INPUT has more than 8 million facts
in working memory, LU_DEVICE_TYPE about 10k.)
</div>
</div>
</div>
</span>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div dir="ltr">
<div ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family:
Tahoma;color: #000000;font-size: 10pt;">
LU_DEVICE_TYPE models a lookup table.<br>
<br>
<span style="font-family: 'Courier New'; ">rule
"Binning for Attribute: Device_type_desc"</span><br
style="font-family: Courier New;">
<span style="font-family: 'Courier New'; ">
when</span><br style="font-family: Courier
New;">
<span style="font-family: 'Courier New'; ">
$call :</span><br style="font-family:
Courier New;">
<span style="font-family: 'Courier New'; ">
<span style="font-weight: bold;">
BINNING_INPUT</span>()</span><br
style="font-family: Courier New;">
<span style="font-family: 'Courier New'; ">
$device_typeLookup :</span><br
style="font-family: Courier New;">
<span style="font-family: 'Courier New'; ">
<span style="font-weight: bold;">
LU_DEVICE_TYPE</span>(</span><br
style="font-family: Courier New;">
<span style="font-family: 'Courier New'; ">
$call.device_type == device_type</span><br
style="font-family: Courier New;">
<span style="font-family: 'Courier New'; ">
)</span><br style="font-family: Courier
New;">
<br style="font-family: Courier New;">
<span style="font-family: 'Courier New'; ">
then</span><br style="font-family: Courier
New;">
<span style="font-family: 'Courier New'; ">
$call.setDevice_type_desc($device_typeLookup.getDevice_type_desc());</span><br
style="font-family: Courier New;">
<span style="font-family: 'Courier New'; ">end</span><br>
<br>
It's a simple enough rule: join on the
device_type field. Unfortunately, this rule
and a few others like it are taking FOREVER to
insert. Even when I cut the number of
BINNING_INPUT facts in working memory down
from 8M to 10k.<br>
<br>
This feels like a basic Drools question. But
I can't seem to find any help from google.<br>
<br>
Please advise!<br>
<br>
Thanks in advance,<br>
<br>
Dave Martin<br>
<br>
</div>
</div>
</div>
</span><br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</div>
</div>
_______________________________________________ rules-users
mailing list <a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a> <a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users">
https://lists.jboss.org/mailman/listinfo/rules-users</a> </span>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>