I've been looking at Akka today in the perspective of implementing a
custom scheduler for an Actor-based Web system. I found Scala scheduler
to be a little bit hairy, and looking at Akka's documentation, I was
impressed by its clarity and the richness of features.
So my problem is as follows:
- I have Actors (type A) that process incoming HTTP requests
- I have Actors (type B) that log these requests in a Redis DB
Currently, using Scala Actors, the scheduler does not fully interleave
execution of A and B. So when you have a burst of requests, the type A
actors get all busy, and then type B actors get busy, killing the
response time for the next requests.
So instead of scheduling like this:
A A A A A B B B B B
I would like to schedule like this:
A B A B A B A B A B
Or even better, be able to decide at each step if it's better to
execute an A or a B.
Could anyone point me on how to do this with Akka ?