<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">For those interested, the code is now centralised and much cleaner than in 5.x<div><a href="https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/phreak/PhreakTimerNode.java">https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/phreak/PhreakTimerNode.java</a></div><div><br></div><div>The TimerNode memory is here:</div><div><a href="https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java">https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java</a></div><div><br></div><div>So if you follow the doLeftInserts, you can see it iterates all LTs and calls scheduleLeftTuple. This create a Trigger (line 229). "<span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">timer</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">.</span><span class="na" style="box-sizing: border-box; color: teal; font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">createTrigger</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">(</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">timestamp</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">leftTuple</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">jobHandle</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">calendarNames</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">calendars</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">timerNode</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">.</span><span class="na" style="box-sizing: border-box; color: teal; font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">getDeclarations</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">(),</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">wm</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">);”. </span>In the case of the cron the code for the trigger creation is here:</div><div><a href="https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/time/impl/CronTrigger.java">https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/time/impl/CronTrigger.java</a></div><div><br></div><div>Once it has a trigger it can calculate the next fire time and schedule for later firing. See line 309 "<span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">timerService</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">.</span><span class="na" style="box-sizing: border-box; color: teal; font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">scheduleJob</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">(</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">job</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">jobCtx</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">,</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">trigger</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">);"</span>. Also line 377 shows the Job it is scheduled with, "<span class="kd" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">public</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="kd" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">static</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="kd" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">class</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);"> </span><span class="nc" style="box-sizing: border-box; color: rgb(68, 85, 136); font-weight: bold; font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">TimerNodeJob"</span></div><div><br></div><div>The Job is very simple it adds the scheduled LT onto the tuple list and notifies the rule that it can continue evaluating. That notification happens on line 408 “<span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">pmem</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">.</span><span class="na" style="box-sizing: border-box; color: teal; font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">queueRuleAgendaItem"</span></div><div><br></div><div>If we look at PathMemory it should call line 147 "<span class="n" style="box-sizing: border-box; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">agenda</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">.</span><span class="na" style="box-sizing: border-box; color: teal; font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">notifyHalt</span><span class="o" style="box-sizing: border-box; font-weight: bold; color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Courier, monospace; line-height: 18px; white-space: pre; background-color: rgb(255, 255, 255);">();"</span></div><div><a href="https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/reteoo/PathMemory.java">https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/reteoo/PathMemory.java</a></div><div><br></div><div>The notifyHalt should wake the sleeping thread and force the rule to re-evaluate and fire.</div><div><br></div><div>One thing I recommend you do is setup the logging to TRACE mode. This will give you a lot of information of what is going on and when in the engine. Notice the log.trace calls in PhreakTimerNode and PathMemory. you’ll also get a full, indented, output of the rule evaluation itself. See the trace for RuleNetworkEvaluator</div><div><a href="https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/phreak/RuleNetworkEvaluator.java">https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/core/phreak/RuleNetworkEvaluator.java</a></div><div><br></div><div>Here is the logback.xml file we use, just copy that into your resources folder and change level to TRACE:</div><div><a href="https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/resources/logback-test.xml">https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/resources/logback-test.xml</a></div><div><br></div><div>A reminder of links for general explanations of the 6.x algo:</div><div><a href="http://blog.athico.com/2013/11/rip-rete-time-to-get-phreaky.html">http://blog.athico.com/2013/11/rip-rete-time-to-get-phreaky.html</a></div><div><a href="http://blog.athico.com/2014/01/drools-phreak-stack-based-evaluations.html">http://blog.athico.com/2014/01/drools-phreak-stack-based-evaluations.html</a></div><div><br></div><div>We’ll try and look into your problem over the next few days.</div><div><br></div><div>Mark</div><div><br></div><div><br></div><div><br><div><div>On 25 Mar 2014, at 11:20, Mark Proctor <<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">The 5x stuff evolved organically over time. For 6x we redesigned it from scratch, so that we could have clear and clean behaviour and implementation. We did some documentation updates, but I suspect there may be some 5x aspects remaining (that are not incorrect), and maybe there is still more docs we need to do. I’ve asked mario to have another go at updating the documentation for this area.<br><br>Mark<br><br><br>On 25 Mar 2014, at 08:14, Wolfgang Laun <<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>> wrote:<br><br><blockquote type="cite">Once more, a nagging. How much time could be saved if the docs would<br>tell the FULL truth, here w.r.t. timers in rules.<br><br>I can't even fix it, because this can't be derived easily from the<br>code. And, maybe, the code doesn't reflect the intent?!<br><br>-W<br><br><br>---------- Forwarded message ----------<br>From: Vieri <<a href="mailto:vieri.emiliani@gmail.com">vieri.emiliani@gmail.com</a>><br>Date: Tue, 25 Mar 2014 08:28:43 +0100<br>Subject: [rules-users] Drools Fusion inconsistencies at increasing<br>event throughputs<br>To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><br>Dear Drools Experts,<br><br><br>*Short version*<br><br><br> 1. Cron-based rules triggers (more than once) for a full second, rather<br> than once every defined period;<br> 2. After some time, event creation from the drl seems to hang. The "time<br> to hang" decreases as we increase the throughput of incoming events;<br> 3. The two issues seem to be somehow related (well, maybe).<br><br>*Full version*<br><br><br>We are testing Drools Fusion to implement CEP functionalities in our<br>platform. We are performing these tests using Drools 6.0.1.Final.<br><br>As a basic test case, we set up a synthetic stream of events, and defined a<br>couple of rules to implement a simple throughput metric. Here's the<br>complete drl:<br><br><br>*package* it.intext.unity.test<br><br><br><br>*import* it.intext.unity.test.SynthEvent;<br><br>*import* java.util.Date;<br><br><br><br>*global* org.slf4j.Logger logger;<br><br><br><br>*declare* SynthEvent<br><br> @role( event )<br><br> @timestamp( timestamp )<br><br>*end*<br><br><br><br>*declare* EventCounter<br><br> @role( event )<br><br> @timestamp( timestamp )<br><br> id : *long*<br><br> key : String<br><br> timestamp : Date<br><br>*end*<br><br><br><br><br><br>// Business rules<br><br>*rule* "Create counter"<br><br>*when*<br><br>$e : SynthEvent() *from* entry-point "synth"<br><br>*then*<br><br>entryPoints["counters"].*insert*(*new* EventCounter( $e.getId(), "event",<br>$e.getTimestamp() ) );<br><br>*end*<br><br><br><br>// Metrics<br><br>*rule* "Count epm"<br><br> // Emit count every 10s, accumulate over 1m<br><br>timer ( cron: 0/10 * * * * ? )<br><br> *when*<br><br> Number( $count : intValue ) *from* *accumulate*(<br><br> EventCounter( key == "event" ) over window:time( 60s<br>)*from*entry-point<br>"counters", count(1) )<br><br> *then*<br><br>logger.debug("epm = {}", $count );<br><br>*end*<br><br><br>The SynthEvent class is very basic:<br><br><br>*public* *class* SynthEvent {<br><br><br><br> *long* id;<br><br> Date timestamp;<br><br> List<String> meta;<br><br> ... // Getters/Setters and constructors omitted<br><br>}<br><br><br>Now, the test is performed running the session in one thread (code below)<br><br><br> *private* *void* process(*final* KieSession session) {<br><br> *new* Thread(){<br><br> *public* *void* run() {<br><br> session.fireUntilHalt();<br><br> };<br><br> }.start();<br><br> }<br><br><br><br>while feeding the events on a second thread (code below)<br><br><br> *private* *void* feed(*final* KieSession session) {<br><br> *new* Thread(){<br><br> @SuppressWarnings("unchecked")<br><br> *public* *void* run() {<br><br> *try* {<br><br> *int* counter = 0;<br><br> *while*(*true*) {<br><br> counter++;<br><br> session.execute(CommandFactory.<br>*newInsert*(createEvent(), *null*, *false*, "synth"));<br><br> Thread.*sleep*(getSleepRate());<br><br> *if* ((counter % 1000) == 0) {<br><br> *logger*.debug("Total events: {}",<br>counter);<br><br> }<br><br> }<br><br> } *catch* (InterruptedException e) {<br><br> *logger*.warn("{}", e);<br><br> }<br><br> };<br><br> }.start();<br><br> }<br><br>I expected the cron rule "count epm" to trigger once every 10 seconds. But<br>here's an extract from the log (running at 5 events per second +/- 20%):<br><br>[DEBUG] 2014-03-25 04:56:10.008<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 1<br>[DEBUG] 2014-03-25 04:56:10.075<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2<br>[DEBUG] 2014-03-25 04:56:10.262<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 3<br>[DEBUG] 2014-03-25 04:56:10.507<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 4<br>[DEBUG] 2014-03-25 04:56:10.678<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 5<br>[DEBUG] 2014-03-25 04:56:10.871<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 6<br>[DEBUG] 2014-03-25 04:56:20.001<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 50<br>[DEBUG] 2014-03-25 04:56:20.042<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 51<br>[DEBUG] 2014-03-25 04:56:20.231<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 52<br>[DEBUG] 2014-03-25 04:56:20.405<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 53<br>[DEBUG] 2014-03-25 04:56:20.647<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 54<br>[DEBUG] 2014-03-25 04:56:20.823<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 55<br>[DEBUG] 2014-03-25 04:56:20.992<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 56<br><br><br><br>As you can see, the "count epm" rules fires once per incoming event for a<br>full second (e.g. for the second cycle we see the first activation at<br>04:56:20.001 and the last one at 04:56:20.992).<br><br>This is not a major issue, since it can be solved with a sort-of<br>publish/subscribe pattern which, BTW, increases the system stability (if<br>anyone is interested I can post more details on the list).<br><br>Anyhow, the test ran for more than 20' consistently until we decided it was<br>enough.<br><br><br>Now, the problem is that as we increase the throughput (e.g. 50 events per<br>second), the test runs for a few minutes before it becomes inconsistent.<br>The evidence is that the first rule stops to trigger, and EventCounter<br>aren't created anymore. Here's a log extract:<br><br>[DEBUG] 2014-03-25 07:37:40.008<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 199<br>[DEBUG] 2014-03-25 07:37:40.017<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 200<br>[DEBUG] 2014-03-25 07:37:40.034<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 201<br>[DEBUG] 2014-03-25 07:37:40.058<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 202<br>[DEBUG] 2014-03-25 07:37:40.076<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 203<br>*... here the system is stable as we get about 3K events per minute as<br>expected*<br>[DEBUG] 2014-03-25 07:38:36.022 (StreamTester.java:run:70) Total events:<br>3000<br>[DEBUG] 2014-03-25 07:38:40.001<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2999<br>[DEBUG] 2014-03-25 07:38:40.016<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2998<br>[DEBUG] 2014-03-25 07:38:40.024<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2999<br>[DEBUG] 2014-03-25 07:38:40.034<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2998<br>[DEBUG] 2014-03-25 07:38:40.047<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2999<br>[DEBUG] 2014-03-25 07:38:40.057<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2998<br>...<br>[DEBUG] 2014-03-25 07:39:50.974<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 3008<br>[DEBUG] 2014-03-25 07:39:50.988<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 3007<br>[DEBUG] 2014-03-25 07:39:50.996<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 3008<br>[DEBUG] 2014-03-25 07:39:55.842 (StreamTester.java:run:70) Total events:<br>7000<br>*... Somewhere in between the system becomes inconsistent and the number of<br>events decreases to 0*<br>[DEBUG] 2014-03-25 07:40:00.001<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2734<br>[DEBUG] 2014-03-25 07:40:00.017<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2733<br>[DEBUG] 2014-03-25 07:40:00.037<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 2732<br>...<br>[DEBUG] 2014-03-25 07:40:50.937<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 181<br>[DEBUG] 2014-03-25 07:40:50.953<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 180<br>[DEBUG] 2014-03-25 07:40:50.975<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 179<br>[DEBUG] 2014-03-25 07:40:50.997<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 178<br>[DEBUG] 2014-03-25 07:40:55.438 (StreamTester.java:run:70) Total events:<br>10000<br>[DEBUG] 2014-03-25 07:41:00.001<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 0<br>[DEBUG] 2014-03-25 07:41:10.001<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 0<br><br>We added a quick rule to count "live EventCounter"<br><br>*rule* "Count live counters"<br><br> timer ( cron: 0/60 * * * * ? )<br><br> *when*<br><br> Number( $count : intValue ) *from* *accumulate*(<br><br> EventCounter( key == "event" ) *from* entry-point "counters",<br>count(1) )<br><br> *then*<br><br> logger.debug("Live counters = {}", $count );<br><br>*end*<br><br><br><br>and, again, the evidence is that when things go wrong the EventCounter<br>events aren't created anymore.<br><br>[DEBUG] 2014-03-25 07:40:55.438 (StreamTester.java:run:70) Total events:<br>10000<br>[DEBUG] 2014-03-25 07:41:00.001<br>(Rule_Count_live_counters1625367465.java:defaultConsequence:14) Live<br>counters = 0<br>[DEBUG] 2014-03-25 07:41:00.001<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 0<br>[DEBUG] 2014-03-25 07:41:10.001<br>(Rule_Count_epm442808096.java:defaultConsequence:14) epm = 0<br><br>Adding a debug line in the "Create counter" rule confirm this hypotesis<br>(after a while the rule won't trigger anymore). Modified rule is:<br><br><br>*rule* "Create counter"<br><br> *when*<br><br> $e : SynthEvent() *from* entry-point "synth"<br><br> *then*<br><br> entryPoints["counters"].*insert*( *new* EventCounter( $e.getId(),<br>"event", $e.getTimestamp() ) );<br><br> *if* (Math.random() < 0.01) logger.debug("New event: {}", $e.getId());<br><br>*end*<br><br><br>When the system becomes inconsistent, we stop seeing "New event" log lines.<br><br><br>What are we missing? Any suggestion? Anyone experienced the same problems<br>we have?<br><br>Your help will be greatly appreciated.<br><br>Thanks in advance,<br><br>Vieri<br>_______________________________________________<br>rules-dev mailing list<br><a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-dev<br></blockquote><br></blockquote></div><br></div></body></html>