Reputation: 13
Is it common practice to have one Akka actor per database entity? i.e. is it meant to be used like this?
Say we have tens of thousands of users and for each, logged in, user at our Play-website we create one actor with child actors representing related data out of a relational database. actors vs. entities
Is there a better approach? What are the pros and cons?
Upvotes: 0
Views: 828
Reputation: 998
Please have a look at akka actor system documentation http://doc.akka.io/docs/akka/2.4.7/general/actor-systems.html
A common pattern is to create a router for N actors, each of which wraps a single DB connection and handles queries as sent to the router. The number N must then be tuned for maximum throughput, which will vary depending on which DBMS is deployed on what hardware.
Upvotes: 4