问题
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