Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-41

Activation Leakage using temporal windows

XMLWordPrintable

    • Hide

      You can find sample code in https://github.com/lome/lome_intext
      Sample codes insert 1K Myfacts/seconds and aggregates them using the following rule:

      rule "Dummy"
      timer( cron:0/5 * * * * ? )
      when
      Number( $count : intValue ) from accumulate( MyFact( ) over window:time(5s) from entry-point EventStream, sum(1) )
      then
      System.out.println($count+" myfact(s) seen in the last 5 seconds");
      end

      After a while, the process goes out of memory.
      Profiler Screenshot
      Profiler Memory Inspect

      As comparison, using the same event injector, this rule was also used:

      declare MyFact
      @role( event )
      @timestamp( timestamp )
      @expires( 5s )
      end

      rule "Dummy"
      timer( cron:0/5 * * * * ? )
      when
      Number( $count : intValue ) from accumulate( MyFact( ) from entry-point EventStream, sum(1) )
      then
      System.out.println($count+" myfact(s) seen in the last 5 seconds");
      end

      Reaching the same result of aggregating over a fixed time window, but, this time, the memory consumption and usage turns out to be way better

      Profiler Screenshot
      Profiler Memory Inspect

      Show
      You can find sample code in https://github.com/lome/lome_intext Sample codes insert 1K Myfacts/seconds and aggregates them using the following rule: rule "Dummy" timer( cron:0/5 * * * * ? ) when Number( $count : intValue ) from accumulate( MyFact( ) over window:time(5s) from entry-point EventStream, sum(1) ) then System.out.println($count+" myfact(s) seen in the last 5 seconds"); end After a while, the process goes out of memory. Profiler Screenshot Profiler Memory Inspect As comparison, using the same event injector, this rule was also used: declare MyFact @role( event ) @timestamp( timestamp ) @expires( 5s ) end rule "Dummy" timer( cron:0/5 * * * * ? ) when Number( $count : intValue ) from accumulate( MyFact( ) from entry-point EventStream, sum(1) ) then System.out.println($count+" myfact(s) seen in the last 5 seconds"); end Reaching the same result of aggregating over a fixed time window, but, this time, the memory consumption and usage turns out to be way better Profiler Screenshot Profiler Memory Inspect
    • High

      When aggregating over time windows on frequent events (about 1K events per second), lot of EventFactHandle are generated and retained in memory.

              mfusco@redhat.com Mario Fusco
              lorenzo.melegari Lorenzo Melegari (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: