I've got an FSM with Stash, something like this

when (Idle)
  case Event(cmd: ...)
    process() // asynchronous activity
    goto Processing


when(Processing)
  case Event(updated:...)
    // do something with result
    unstashAll()
    goto (Idle)
  case Event(cmd: ..)
    stash()
    stay


There are periods where my process() cannot keep up with the incoming 
queue. This is not an intrinsic problem. But a problem appears to exist 
that if the queue gets sufficiently big, I spend more time doing unstashAll 
and restashing all the messages than I do processing. If my queue consists 
of n elements then I end up with O(n^2) stash and process events.

I guess this means stash should not be used in cases other than queue is 
unlikely to get big. Is there a standard alternative or should I just go 
and write my own BigQueueStash ?

I should add I don't think it ever gets so big that I should worry about 
back pressure - it's just queue management









 


-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to