Giter VIP home page Giter VIP logo

Comments (8)

tarcieri avatar tarcieri commented on June 9, 2024

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.

stakach avatar stakach commented on June 9, 2024

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.

halorgium avatar halorgium commented on June 9, 2024

@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.

stakach avatar stakach commented on June 9, 2024

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.

halorgium avatar halorgium commented on June 9, 2024

@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.

stakach avatar stakach commented on June 9, 2024

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.

tarcieri avatar tarcieri commented on June 9, 2024

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 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


Reply to this email directly or view it on GitHubhttps://github.com//issues/45#issuecomment-15171665
.

Tony Arcieri

from celluloid-io.

halorgium avatar halorgium commented on June 9, 2024

Moved to celluloid/celluloid#193.

from celluloid-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.