Can I use Akka Mailbox to control race condition in a frontend?
Generally we have 100,000 TPS(message per second) need to handle. Each message belong to one user. Sometime two messages belonging to the same user come in at nearly the same time. So we need to control the race condition for such case by processing them one by one.
I thought Akka Mailbox can handle it, and I also tried in simple spring application with local service. it looks works. But not quite sure it can work in production in k8s. My questions are:
1, First to confirm the Akka Mailbox can do this work. My solution is to create Actor for each user, the actor name is the username. and then follow actor usage to send message to remote actor which is the service instance in a Akka cluster. I think Akka will follow the mailbox mechinism to queue the message until the previous message got processed. Is this correct for the solution?
2, If we have many users, e.g. 1M concurrently. That means the actors are 1M as well. If we find the frontend instance is busy or reach the threshold, can we scale out the frontend instances and how the Akka to control the same user actor consistence if the same user messages goes into different frontend instances. I know there is Akka cluster, but looks the cluster means backend services cluster in our case.