Question

The Typesafe whitepaper (v5) states:

"In different scenarios, actors may be an alternative to: a thread; a Java EE session bean; ..."

I don't understand how an actor is an alternative to a session bean, because they work completely differently: an actor is called serially by passing messages to it and it processes the messages one at a time in the order in which they are sent. That means the running of any business logic inside the actor is synchronised. Session beans on the other hand are pooled - there is a number of them and multiple threads can run the same business logic at any time meaning that the logic is run concurrently.

Can anyone clear up my misunderstanding of this statement?

Was it helpful?

Solution

You can pool Actors (children) or behind Akka Routers (also technically children), so that way you can tune "concurrency".

OTHER TIPS

Too much ejb concurrency can often be a cause of various lock contention and performance degradation.

Meanwhile akka is aimed at async processing and nio. This approach benefits most of all when number of threads is near the number of CPU cores.

Note that akka doesn't enforce exactly one processing thread. See e.g. Akka control threadpool threads

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top