<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">The system will create network nodes even when only one pattern matches.<br>
150,000/50,000 = 3 exactly, or average?</blockquote><div> 3 exactly.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
If you have 3 events A, B, C with identical ids and different users,<br>you'll get the following candidates for an activation: (A,B), (B,A),<br>(A,C), (C,A), (B,C), (C,B)<br>and this increases O(n^2). - Since you know the exact distribution of<br>
your data, you might compute this precisely.<br></blockquote><div>Okay. But if I always have only 3 events with the same id, the next three events D, E, F, that might have other users and another id, would not be combined with A, B or C, right?</div>
<div>I would get the six combinations you defined plus (D,E), (E,D), (D,F), (F,D), (E,F), and (F,E).</div><div>Going on with that, I would only see it growing by O(2n), which for this 150,000 events would mean 300,000 activations. Where am I going wrong?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Is the distribution of id/user combinations realistic?</blockquote>
<div>What do you mean by realistic? In our test scenario, we always have 3 events with the same id, and approx. 1000 users which are randomly used in the events.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
What else do<br>you need to do with Event type "a"? Similar? Completely different? -<br>There would be a simple solution to significantly reduce the memory<br>requirements, but it may not be feasible due to these answers.</blockquote>
<div>At the moment we are just designing a generic solution, which might be extended by rules afterwards, so that "old" events might need to be reused. In a real environment, of course, we would retract some events not needed any longer. But for now we are doing some performance testing and were surprised that we could "crash" the system with one single rule. Of course, with a lot of events ;-)</div>
<div class="gmail_extra"><br><div class="gmail_quote">2013/1/7 Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">On 07/01/2013, Svenja Brunstein <<a href="mailto:svenja.brunstein@gmail.com">svenja.brunstein@gmail.com</a>> wrote:<br>
</div><div class="im">> Thanks for the input. For 150,000 type "a" events we had about 50,000<br>
> different ids and 1,000 user values.<br>
> After all, combinations possible for type "b" were only 1,000,000 (1,000<br>
> users * 1,000 users), which is why I am surprised to have 88 million<br>
> instances.<br>
<br>
</div>The system will create network nodes even when only one pattern matches.<br>
150,000/50,000 = 3 exactly, or average?<br>
<br>
If you have 3 events A, B, C with identical ids and different users,<br>
you'll get the following candidates for an activation: (A,B), (B,A),<br>
(A,C), (C,A), (B,C), (C,B)<br>
and this increases O(n^2). - Since you know the exact distribution of<br>
your data, you might compute this precisely.<br>
<br>
Is the distribution of id/user combinations realistic? What else do<br>
you need to do with Event type "a"? Similar? Completely different? -<br>
There would be a simple solution to significantly reduce the memory<br>
requirements, but it may not be feasible due to these answers.<br>
<div class="im"><br>
><br>
> Yes, it is intentional to have the rule fire twice for each combination :-)<br>
> Unfortunately, retracting events is not an option right now.<br>
<br>
</div>Then, at least, generate both in a single rule.<br>
<div class="im"><br>
><br>
> I started another round, where I ensured to insert a lot more "b" events:<br>
> The memory used by NotNodeLeftTuples is a lot less, even though these nodes<br>
> still use most of the memory.<br>
> Concluding from all that, I guess it is possible that the nodes take that<br>
> much space (up to many GB), and the more events are inserted which<br>
> invalidate the NOT nodes, the less memory is used by them?<br>
<br>
</div>Well, you don't need the NOT node, and their number depends on the<br>
distribution of your data.<br>
<span class=""><font color="#888888"><br>
-W<br>
</font></span><div class=""><div class="h5"><br>
><br>
> 2013/1/7 Wolfgang Laun <<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>><br>
><br>
>> The amount of memory required for 150K type "a" depends on the actual<br>
>> distribution of this data w.r.t. fields id and user, and other<br>
>> circumstances; it is not only the rule that is to blame.<br>
>><br>
>> There is one flaw, though: The rule would fire twice for a matching<br>
>> pair of events of type "a". It's possible that you do want to have a<br>
>> type "b" for both combinations of user and friendid, but you could<br>
>> create both in a single rule, which should halve your memory<br>
>> requirements. If there is no ordered attribute, use the timestamp to<br>
>> restrict a pair to only one combination (hint: "after").<br>
>><br>
>> This will still generate a lot of network nodes.<br>
>><br>
>> Other ideas for reduction may have to take the entire application<br>
>> scenario into account, e.g., can you retract events after they have<br>
>> been paired, or how do you do inserts and calls to fireAllRules, etc.<br>
>> Most importantly, however, is the actual frequency of id and user<br>
>> values in relation to type "a" events.<br>
>><br>
>> -W<br>
>><br>
>><br>
>><br>
>> On 07/01/2013, Svenja Brunstein <<a href="mailto:svenja.brunstein@gmail.com">svenja.brunstein@gmail.com</a>> wrote:<br>
>> > Hi all,<br>
>> ><br>
>> > we observe a strange behavior with one of our rules. After deployment<br>
>> > and sending lots of events (~150,000 of type "a"), the server slows<br>
>> > down<br>
>> > rapidly until it runs out of memory.<br>
>> > We checked with VisualVM which objects are filling the memory: In one<br>
>> > moment there were almost 14GB of NotNodeLeftTuples (88,933,186<br>
>> Instances)!<br>
>> ><br>
>> > This is our rule:<br>
>> ><br>
>> > rule "example"<br>
>> > when<br>
>> > $evt1:EventObject(type=='a', $id:data['id'], $user:user) from<br>
>> > entry-point<br>
>> > internalstream<br>
>> > $evt2:EventObject(type=='a', data['id']==$id, user!=$user, $user2:user)<br>
>> > from entry-point internalstream<br>
>> > not(EventObject(type=='b', user==$user, data['friendid']==$user2) from<br>
>> > entry-point internalstream)<br>
>> > then<br>
>> > EventObject evt = new EventObject();<br>
>> > evt.setType('b');<br>
>> > evt.setUser($evt1.getUser());<br>
>> > evt.put('friendid', $evt2.getUser());<br>
>> > entryPoints['internalstream'].insert(evt);<br>
>> > end<br>
>> ><br>
>> > Is that behavior correct for such a size of event combinations when<br>
>> using a<br>
>> > NOT in the rule?<br>
>> ><br>
>> > Thanks,<br>
>> > Svenja<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>
_______________________________________________<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>
</div></div></blockquote></div><br></div></div>