Stas
Stas

Reputation: 751

Akka.io: Thread per Actor

There is a requirement to run 1 thousand operations asynchoniosly, I've chosen to use Akka. Warpping in Actor Ref executor and sending 1 thousand messages to ref.

How can I be sure that:

Upvotes: 0

Views: 3046

Answers (3)

Stas
Stas

Reputation: 751

Thanks all for the responses, actually for my case combination of RoundRobinRouter (where number of routes is equal to number of expected threads) and PinnedDispatcher with flag thread-pool-executor.allow-core-timeout=off is working fine.

Upvotes: 0

rs_atl
rs_atl

Reputation: 8985

You can use the PinnedDispatcher to guarantee one thread per actor, and everything in Akka is async, so you can be guaranteed the messages are async. If you send your messages using the ! operator, the message is sent in a fire-and-forget manner.

See this for more details.

Upvotes: 3

Andriy Plokhotnyuk
Andriy Plokhotnyuk

Reputation: 7989

Try to use PinnedDispatcher

Configuration example & code is here

No blocking until bounded mailbox will be used

Upvotes: 1

Related Questions