Do I need to take care of producer-consumer rate-matching when using Akka 1.3's actors?

爷,独闯天下 提交于 2019-12-22 16:45:02

问题


When using Akka 1.3, do I need to worry about what happens when the actors producing messages are producing them faster than than the actors consuming them can process?

Without any mechanism, in a long running process, the queue sizes would grow to consume all available memory.

The doc says the default dispatcher is the ExecutorBasedEventDrivenDispatcher.

This dispatcher has five queue configuration:

  • Bounded LinkedBlockingQueue
  • Unbounded LinkedBlockingQueue
  • Bounded ArrayBlockingQueue
  • Unbounded ArrayBlockingQueue
  • SynchronousQueue

and four overload policies:

  • CallerRuns
  • Abort
  • Discard
  • DicardOldest

Is this the right mechanism to be looking at? If so, what are this dispatchers' default settings?


回答1:


The dispatcher has a task queue. This is unrelated to your problem. In fact, you want as many mailboxes to be enqueued as possible.

What you might be looking for is: http://doc.akka.io/docs/akka/1.3.1/scala/dispatchers.html#Making_the_Actor_mailbox_bounded



来源:https://stackoverflow.com/questions/12694167/do-i-need-to-take-care-of-producer-consumer-rate-matching-when-using-akka-1-3s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!