<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&#39;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 &quot;a&quot;? 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 &quot;old&quot; 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 &quot;crash&quot; 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">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</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 &lt;<a href="mailto:svenja.brunstein@gmail.com">svenja.brunstein@gmail.com</a>&gt; wrote:<br>
</div><div class="im">&gt; Thanks for the input. For 150,000 type &quot;a&quot; events we had about 50,000<br>
&gt; different ids and 1,000 user values.<br>
&gt; After all, combinations possible for type &quot;b&quot; were only 1,000,000 (1,000<br>
&gt; users * 1,000 users), which is why I am surprised to have 88 million<br>
&gt; 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&#39;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 &quot;a&quot;? 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>
&gt;<br>
&gt; Yes, it is intentional to have the rule fire twice for each combination :-)<br>
&gt; 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>
&gt;<br>
&gt; I started another round, where I ensured to insert a lot more &quot;b&quot; events:<br>
&gt; The memory used by NotNodeLeftTuples is a lot less, even though these nodes<br>
&gt; still use most of the memory.<br>
&gt; Concluding from all that, I guess it is possible that the nodes take that<br>
&gt; much space (up to many GB), and the more events are inserted which<br>
&gt; invalidate the NOT nodes, the less memory is used by them?<br>
<br>
</div>Well, you don&#39;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>
&gt;<br>
&gt; 2013/1/7 Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;<br>
&gt;<br>
&gt;&gt; The amount of memory required for 150K type &quot;a&quot; depends on the actual<br>
&gt;&gt; distribution of this data w.r.t. fields id and user, and other<br>
&gt;&gt; circumstances; it is not only the rule that is to blame.<br>
&gt;&gt;<br>
&gt;&gt; There is one flaw, though: The rule would fire twice for a matching<br>
&gt;&gt; pair of events of type &quot;a&quot;. It&#39;s possible that you do want to have a<br>
&gt;&gt; type &quot;b&quot; for both combinations of user and friendid, but you could<br>
&gt;&gt; create both in a single rule, which should halve your memory<br>
&gt;&gt; requirements. If there is no ordered attribute, use the timestamp to<br>
&gt;&gt; restrict a pair to only one combination (hint: &quot;after&quot;).<br>
&gt;&gt;<br>
&gt;&gt; This will still generate a lot of network nodes.<br>
&gt;&gt;<br>
&gt;&gt; Other ideas for reduction may have to take the entire application<br>
&gt;&gt; scenario into account, e.g., can you retract events after they have<br>
&gt;&gt; been paired, or how do you do inserts and calls to fireAllRules, etc.<br>
&gt;&gt; Most importantly, however, is the actual frequency of id and user<br>
&gt;&gt; values in relation to type &quot;a&quot; events.<br>
&gt;&gt;<br>
&gt;&gt; -W<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On 07/01/2013, Svenja Brunstein &lt;<a href="mailto:svenja.brunstein@gmail.com">svenja.brunstein@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; Hi all,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; we observe a strange behavior with one of our rules. After deployment<br>
&gt;&gt; &gt; and sending lots of events (~150,000 of type &quot;a&quot;), the server slows<br>
&gt;&gt; &gt; down<br>
&gt;&gt; &gt; rapidly until it runs out of memory.<br>
&gt;&gt; &gt; We checked with VisualVM which objects are filling the memory: In one<br>
&gt;&gt; &gt; moment there were almost 14GB of NotNodeLeftTuples (88,933,186<br>
&gt;&gt; Instances)!<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; This is our rule:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; rule &quot;example&quot;<br>
&gt;&gt; &gt; when<br>
&gt;&gt; &gt; $evt1:EventObject(type==&#39;a&#39;, $id:data[&#39;id&#39;], $user:user) from<br>
&gt;&gt; &gt; entry-point<br>
&gt;&gt; &gt; internalstream<br>
&gt;&gt; &gt; $evt2:EventObject(type==&#39;a&#39;, data[&#39;id&#39;]==$id, user!=$user, $user2:user)<br>
&gt;&gt; &gt; from entry-point internalstream<br>
&gt;&gt; &gt; not(EventObject(type==&#39;b&#39;, user==$user, data[&#39;friendid&#39;]==$user2) from<br>
&gt;&gt; &gt; entry-point internalstream)<br>
&gt;&gt; &gt; then<br>
&gt;&gt; &gt; EventObject evt = new EventObject();<br>
&gt;&gt; &gt; evt.setType(&#39;b&#39;);<br>
&gt;&gt; &gt; evt.setUser($evt1.getUser());<br>
&gt;&gt; &gt; evt.put(&#39;friendid&#39;, $evt2.getUser());<br>
&gt;&gt; &gt; entryPoints[&#39;internalstream&#39;].insert(evt);<br>
&gt;&gt; &gt; end<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Is that behavior correct for such a size of event combinations when<br>
&gt;&gt; using a<br>
&gt;&gt; &gt; NOT in the rule?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks,<br>
&gt;&gt; &gt; Svenja<br>
&gt;&gt; &gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;<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>