<div dir="ltr"><div><div><div>Wolfgang,<br></div>the code to reproduce is below.  I&#39;m hoping to process between 20k and 50k events through Drools per second thus the extreme high-throughput testing.  I could settle for a single Drools node handling only say 5K per second IFF I could cluster Drools but I&#39;ve not yet found a way to distribute workload across an active-active Drools cluster (seems there is no such thing?).  <br>
<br></div>Since you&#39;re recommendation I&#39;ve shifted to using Drools 5.3 just FYI:<br><br><br></div><div>### Average.java ###<br>package drools53fusioneval;<br><br>import java.io.IOException;<br>import java.util.Random;<br>
import org.drools.KnowledgeBase;<br>import org.drools.KnowledgeBaseConfiguration;<br>import org.drools.KnowledgeBaseFactory;<br>import org.drools.builder.KnowledgeBuilder;<br>import org.drools.builder.KnowledgeBuilderFactory;<br>
import org.drools.builder.ResourceType;<br>import org.drools.conf.EventProcessingOption;<br>import org.drools.io.ResourceFactory;<br>import org.drools.runtime.StatefulKnowledgeSession;<br>import org.drools.runtime.rule.WorkingMemoryEntryPoint;<br>
<br>class AvgDFEChannel implements org.drools.runtime.Channel {<br><br>    @Override<br>    public void send(Object o) {<br>        System.err.println(&quot;Recieved channel message: &quot; + o);<br>    }<br>}<br><br>public class Average {<br>
<br>    public static void main(String[] args) throws InterruptedException, IOException {<br>        KnowledgeBaseConfiguration kbconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<br>        kbconfig.setOption(EventProcessingOption.STREAM);<br>
<br>        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbconfig);<br><br>        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();<br>        kbuilder.add(ResourceFactory.newClassPathResource(&quot;drools53fusioneval/basic.drl&quot;), ResourceType.DRL);<br>
        if (kbuilder.hasErrors()) {<br>            System.err.println(kbuilder.getErrors().toString());<br>        }<br>        kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());<br><br>        final StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();<br>
        session.registerChannel(&quot;heartbeat&quot;, new AvgDFEChannel());<br>        WorkingMemoryEntryPoint ep01 = session.getWorkingMemoryEntryPoint(&quot;ep01&quot;);<br><br>        new Thread() {<br>            public void run() {<br>
                session.fireUntilHalt();<br>            }<br>        }.start();<br><br>        Thread.sleep(5000); // give the engine time to get setup<br><br>        Server hiwaesdk = new Server(&quot;hiwaesdk&quot;);<br>
        session.insert(hiwaesdk);<br>        <br>        long LIMIT = 10000;<br>        long sentCount = 0;<br>        int batchSize = 10000;<br>        Random rnd = new Random(System.nanoTime());<br>        int temp = 0;<br>
        long startTS = System.nanoTime();<br>        while (sentCount &lt; LIMIT) {<br>            for (int i = 0; i &lt; batchSize; i++) {<br>                temp = rnd.nextInt(212);<br>                IntEvent evt = new IntEvent (temp);<br>
                ep01.insert(evt);<br>                sentCount++;<br>            }<br>            Thread.sleep (0x1);<br>        }<br>        double duration = (System.nanoTime() - startTS)/1000000.0;<br>        System.out.println(LIMIT +&quot; events generated in &quot;+ duration +&quot; milliseconds&quot;);<br>
        System.out.println(&quot;Last temperature submitted: &quot;+ temp);<br>        for (int i = 0; i &lt; 5; i++) {<br>            System.out.println (&quot;Sec &quot;+ i +&quot;: &quot;+ hiwaesdk.currentTemp +&quot;, &quot;+ hiwaesdk.readingCount);<br>
            Thread.sleep (1000);<br>        }<br>        System.exit(0);<br>    }<br>}<br><br><br></div><div>### basic.drl ###<br>package drools53fusioneval<br><br>declare IntEvent<br>    @role ( event )<br>end<br><br>rule &quot;number rule&quot;<br>
when<br>    $e : IntEvent () from entry-point ep01<br>    $s : Server (hostname == &quot;hiwaesdk&quot;)<br>then<br>    $s.currentTemp = $e.data;<br>    $s.readingCount++;<br>end<br><br><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, May 16, 2013 at 4:25 AM, Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What you describe is definitely not &quot;expected behaviour&quot; - it&#39;s more<br>
like that race condition (or another one) already being in 5.3. Posting<br>
your code might be a good idea ;-)<br>
-W<br>
<div><div class="h5"><br>
On 16/05/2013, Jason Barto &lt;<a href="mailto:jason.p.barto@gmail.com">jason.p.barto@gmail.com</a>&gt; wrote:<br>
&gt; I&#39;ve been working to load test Drools 5.3 to determine if its a fit for a<br>
&gt; project.  As part of the test I programmatically insert events as rapidly<br>
&gt; as possible; an example, my earlier test inserted 10k events in about<br>
&gt; 300ms.  There is currently a single rule which reads the event and stores<br>
&gt; the event&#39;s value into the only fact in Drools. I&#39;m very happy to report,<br>
&gt; and I&#39;m sure it will be no surprise to anyone, that the engine processes<br>
&gt; all the events in roughly 1 sec. However I have noticed that any large<br>
&gt; number of events (~&gt;1000) usually sees that a small number of events don&#39;t<br>
&gt; get processed. I think after 10k events as many as 7 appear to have gone<br>
&gt; unprocessed. If 100 events are inserted, rather than 10k, no events get<br>
&gt; disregarded.  Being new to Drools I can easily accept that my java code or<br>
&gt; DRL code is off or unoptimized in some way. However not knowing how Drools<br>
&gt; does its magic I&#39;m currently inclined to think that Drools gets swamped<br>
&gt; (10k in 300ms is a lot) and a few events get dropped so Drools can keep<br>
&gt; operating. Is this a known or expected behavior from Drools? If not I am<br>
&gt; happy to post my code, it is similar to the other code sets I&#39;ve posted in<br>
&gt; the last few days. I&#39;m still new to Drools and trying to learn its behavior<br>
&gt; so any insight or enlightenment is greatly appreciated.<br>
&gt;<br>
&gt; Sincerely,<br>
&gt; Jason<br>
&gt;<br>
</div></div>_______________________________________________<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>
</blockquote></div><br></div>