-
-
Notifications
You must be signed in to change notification settings - Fork 272
Description
From celluloid/celluloid-io#45, @stakach writes:
When you call the pool method on Celluloid::IO actors, messages are not sent to the actors even when they are waiting on IO and hence idle. Basically they act like regular Celluloid actors when using pool.
Is there any way to detect when a Celluloid::IO actor is waiting on IO completion and hence idle? Currently I have created my own Actor pool and round-robin send messages to them which is a little naive
{...}
After some playing around with celluloid-promise I noticed regular actors work the same way.
Basically a thread can run multiple tasks simultaneously using Fibers, lets say you async 10 tasks to an actor and each sleeps at some point, as they sleep the next task is started in a new Fiber.
Pool does not schedule tasks to actors if they are executing a task that is sleeping and instead waits for an actor to completely finish a task before scheduling again.
This behaviour makes sense as a single actor in the pool may end up juggling a bunch of fibers while other actors in the pool are doing nothing. Let me know if I am incorrect here.
{...}
https://gist.github.com/stakach/5204160
"single executed in 0.000000 0.000000 0.000000 ( 0.000856)\n"
"pool executed in 0.010000 0.000000 0.010000 ( 10.007874)\n"
D, [2013-03-20T23:06:19.005524 #2809] DEBUG -- : Terminating 8 actors...
D, [2013-03-20T23:06:19.007185 #2809] DEBUG -- : Shutdown completed cleanly
The bug seems to be present in all Celluloid
pools.