Comments (8)
There may very well be a pooling bug in Celluloid::IO, but in general you shouldn't need to use pools with Celluloid::IO actors as they can multiplex several I/O operations within a single thread. You'd need more than one if it was consuming all available CPU on a single core.
I have thought about adding a "prefork" (or rather, pre-thread) model to Reel for this purpose. I'll let you know what I find in that regard.
from celluloid-io.
Ok, I assume this is desired behaviour so we can probably close this issue.
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.
from celluloid-io.
@stakach do you have a short reproduction of this?
If this is in fact a bug in celluloid proper, we should move this over there.
from celluloid-io.
See https://gist.github.com/stakach/5204063
Output on my Mac Pro:
"single executed in 0.000000 0.000000 0.000000 ( 0.000529)\n"
"pool executed in 0.010000 0.000000 0.010000 ( 10.006144)\n"
D, [2013-03-20T22:43:12.782116 #2732] DEBUG -- : Terminating 8 actors...
D, [2013-03-20T22:43:12.784240 #2732] DEBUG -- : Shutdown completed cleanly
Which confirms my explanation above
from celluloid-io.
@stakach Thanks!
I am interested at your use of Mutex
and ConditionVariable
here.
Is this mostly for coordination of the actors instead of using your Promise library?
from celluloid-io.
Any time!
I'm using mutex and condition variables purely to synchronize between threads. Thinking about it I could just as easily done: 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 two examples are equivalent, the second being more correct in the context of Celluloid.
The first was based on a test from the Promise library
from celluloid-io.
Would definitely recommend using Celluloid's tools instead of
Mutexes/ConditionVariables wherever possible.
On Wed, Mar 20, 2013 at 5:09 AM, Stephen von Takach <
[email protected]> wrote:
Any time!
I'm using mutex and condition variables purely to synchronize between
threads. Thinking about it I could just as easily done:
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 cleanlyThe two examples are equivalent, the second being more correct in the
context of Celluloid.
The first was based on a test from the Promise library—
Reply to this email directly or view it on GitHubhttps://github.com//issues/45#issuecomment-15171665
.
Tony Arcieri
from celluloid-io.
Moved to celluloid/celluloid#193.
from celluloid-io.
Related Issues (20)
- Test suite timeouts revamp.
- C::IO::TCPSocket.new dies with IO::EAGAINWaitReadable on JRuby v9.0.3.0. HOT 12
- [Feature request] Access to socket option within UDPSocket and TCPSocket HOT 3
- "it shouldn't crash" crashes HOT 2
- Celluloid::IO behaves like a Celluloid Actor failures HOT 24
- #wait_readable and #wait_writable have different signature than the ruby methods HOT 3
- bundle install fails, missing culture/sync
- Establishing a connection in TCPSocket is not happening asynchronously HOT 2
- server-side closing of an SSLSocket doesn't cause an event HOT 1
- Does it work with ruby 2.1, 2.2, 2.3? HOT 1
- Provide an actor-level select which can accept multiple sockets
- Rubinius crashes with IO::EINPROGRESSWaitWritable when opening Celluloid::IO::TCPSocket
- tests fail randomly (about 28% of times) HOT 2
- Not bundling with ruby < 2.2 HOT 6
- strange behavour with encoding bytes in examples HOT 2
- Review of net-http-celluloid-io gem modifications HOT 2
- Run celluloid backported mode.
- test fail of actor_spec
- help with server-side disconnects in slack-ruby-client HOT 6
- Resolv::ResolvError: DNS result has no information for ... under load HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from celluloid-io.