[rules-users] drools memory explosion for quite simple pattern

michal.antolik michal.antolik at siemens.com
Wed Dec 12 11:43:46 EST 2012


Hello All,

 I have a temporal pattern and I'm wondering what's the best way to find
something like:

*stream of messages of type A and B
search for B and give me 5 immediate occurrences of A or B which happened
before B.*

example: 
A,A,A,B,B,A,B,A,B,A,A,A,A,A,B,A

should give me:
A,A,A|B
A,A,A,B|B
A,A,B,B,A|B
B,B,A,B,A|B
A,A,A,A,A|B

So I made a pattern like: 

$e1 : Event( type== A || type == B) from entry-point "Stream"
 $e2 : Event(  type== A || type == B, this after[1ms,1m] $e1) from
entry-point "Stream"
  $e3 : Event( e type== A || type == B, this after[1ms,1m] $e2) from
entry-point "Stream"
   $e4 : Event(  type== A || type == B, this after[1ms,1m] $e3) from
entry-point "Stream"
    $e5 : Event(  type== A || type == B, this after[1ms,1m] $e4) from
entry-point "Stream"
      
$e : Event( type== B, this after[1ms,1m] $e5 ) from entry-point "Stream"
  
  not( Event(  type== A || type == B, this after $e1, this before $e2) from
entry-point "Stream" )
   not( Event(  type== A || type == B, this after $e2, this before $e3) from
entry-point "Stream" )
    not( Event(  type== A || type == B, this after $e3, this before $e4)
from entry-point "Stream" )
     not( Event(  type== A || type == B, this after $e4, this before $e5)
from entry-point "Stream" )
      not( Event(  type== A || type == B, this after $e5, this before $e)
from entry-point "Stream" )

I also put the time constraint for more constraint search, but the search is
quite slow plus the memory is exploding very fast - several GB in few
seconds.

I also tried to accumulate last 5 events using a floating window, which
helped a lot with performance, but if I would be interested to have only A
preceding B, then it wouldn't help.

Can you pls help me understand what is the best practice to define a drool
pattern for the one I described above?

Thanks a lot!
Michal



--
View this message in context: http://drools.46999.n3.nabble.com/drools-memory-explosion-for-quite-simple-pattern-tp4021186.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list