Unbalanced work stealing
Hi,
I've been playing with around with Akka's work stealing and I've found
it to be unbalanced under some circumstances. I've written an example
(based very heavily on one I found on vasilrem.com) and found that if
the number of messages is close to or less than the number of actors
the work stealing doesn't work as expected. For example if I have 5
actors and 5 slow messages to process only 2 actors will pick up the
messages, then process, then the same 2 actors will pick the next
messages up, then for the final message one of the same 2 actors will
get it. This is the output from my example:
-- send 5 messages
Worker 'worker.5' working
Worker 'worker.1' working
Worker 'worker.1' done
Worker 'worker.5' done
Got result: job 1
Worker 'worker.5' working
Worker 'worker.1' working
Got result: job 5
Worker 'worker.5' done
Worker 'worker.1' done
Got result: job 2
Worker 'worker.5' working
Got result: job 4
Worker 'worker.5' done
Got result: job 3
I would expect all 5 actors to start work on all 5 messages. That's
exactly what happens if I have many more messages than actors, it
seems to be much more balanced. Is this expected behaviour or is it
something I've done.
One other point is that this code doesn't work at all in Akka 0.8.1,
the actors seem to work on the messages but await on some of the
Futures never finishes.
The code is here:
http://pastie.org/1040595
I've been playing with around with Akka's work stealing and I've found
it to be unbalanced under some circumstances. I've written an example
(based very heavily on one I found on vasilrem.com) and found that if
the number of messages is close to or less than the number of actors
the work stealing doesn't work as expected. For example if I have 5
actors and 5 slow messages to process only 2 actors will pick up the
messages, then process, then the same 2 actors will pick the next
messages up, then for the final message one of the same 2 actors will
get it. This is the output from my example:
-- send 5 messages
Worker 'worker.5' working
Worker 'worker.1' working
Worker 'worker.1' done
Worker 'worker.5' done
Got result: job 1
Worker 'worker.5' working
Worker 'worker.1' working
Got result: job 5
Worker 'worker.5' done
Worker 'worker.1' done
Got result: job 2
Worker 'worker.5' working
Got result: job 4
Worker 'worker.5' done
Got result: job 3
I would expect all 5 actors to start work on all 5 messages. That's
exactly what happens if I have many more messages than actors, it
seems to be much more balanced. Is this expected behaviour or is it
something I've done.
One other point is that this code doesn't work at all in Akka 0.8.1,
the actors seem to work on the messages but await on some of the
Futures never finishes.
The code is here:
http://pastie.org/1040595
Leave a comment
on 2010-07-12 09:29 *
By Jonas Bonér
Description changed from Hi,
I've been playing with... to From dave.corcoran@gmail.co...
on 2010-07-12 11:00 *
By Jonas Bonér
Description changed from From dave.corcoran@gmail.co... to Hi,
I've been playing with...
on 2010-09-02 14:19 *
By Jonas Bonér
What is the status of this one?