понедельник, 5 декабря 2011 г.

Akka: Transactor

Transactors

"Generally, the STM is not needed very often when working with Akka. Some use-cases (that we can think of) are:
1. When you really need composable message flows across many actors updating their internal local state but need them to do that atomically in one big transaction. Might not often, but when you do need this then you are screwed without it.
2. When you want to share a datastructure across actors.
3. When you need to use the persistence modules.
"

"Actors are excellent for solving problems where you have many independent processes that can work in isolation and only interact with other Actors through message passing."

"But the actor model is unfortunately a terrible model for implementing truly shared state. E.g. when you need to have consensus and a stable view of state across many components."

"STM on the other hand is excellent for problems where you need consensus and a stable view of the state by providing compositional transactional shared state. Some of the really nice traits of STM are that transactions compose, and it raises the abstraction level from lock-based concurrency."

"Akka provides an explicit mechanism for coordinating transactions across Actors. Under the hood it uses a CountDownCommitBarrier, similar to a CountDownLatch."

Комментариев нет:

Отправить комментарий