2
我需要执行一些(比如说10)任务少(即)3演员。斯卡拉演员智能路由
但我不想在开始时分配所有任务,因为执行时间可能会有所不同。这就是为什么我需要发送他们所有的1个任务,当任何结束时,他会得到一个新的任务。这种方式当第一个任务需要3秒钟,只休息约0.5秒的工作可以在3秒内完成。
有10个任务列表:
(() => Thread.sleep(3000); println("done long"}) :: (1..9).map({() => println("done short")})
我想有输出:
done short
done short
done short
done short
done short
done short
done short
done short
done short
done long
我可以写经理演员,回到演员的经理,并再次重新分配工作,但我希望在斯卡拉或阿卡找到一个固定的解决方案。
谢谢! “偷工作”是这样一句话:-)另一篇文章在这里:http://janvanbesien.blogspot.com/2010/03/load-balancing-actors-with-work.html – 2012-01-31 11:11:35