New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Ruby 3.0 Fiber Scheduler support #2517
Comments
👍🏻👍🏻👍🏻 |
For the Reactor, maybe. I want to spike a Ractor-based implementation and could do a Fiber scheduler based one as well. I don't think I see a big upside for using a Fiber scheduler based worker pool. It's a) getting too far away from the core concept of Puma b) IMO presents very limited latency overhead improvement opportunity, less than a millisecond of latency per request c) I don't think would result in less GVL/shared-resource contention than our current approach. |
Thanks for your reply! I agree with you, Falcon support Fiber scheduler now (actually |
I would definitely love getting rid of the nio4r dependency, though we will be stuck with that for quite some time for Rubies less than 3.0. |
nio4r only use in reactor? |
On this, see commit ce53007 from #2279 (comment) which was a proof-of-concept using This could be useful as a starting point for experimentation along these lines, but I believe |
Great discussion. |
This is now being worked on in #2601, please take a look and try it out! |
Yeah, I read the source code of Ruby well, the scheduler use a GVL to switch between a global Thread pool. But server aimed gems developers dont like this design. Instead, we server gem developers can do it in c too. So I think the ioquatix is doing what we do. But only put himself's design into ruby source code. It is unfair. And it is not tidy in current design. In other words, we developers can also make our thread pool and manage our Fibers without ioquatix's intervention. The worst thing is that: ioquatix put his Fiber.schesuler hooking into Thread. Which is likely to impact the origin Fiber implementation and maybe change the behavior that Fiber did before. And this is very awful for me. Why not remain the origin Fiber code and write another class some like Coroutine and Coroutine.scheduler. So I think what ioquatix did was just like ONE MAN SHOW. Although the Fiber.scheduler improve the multi-thread between Fibers performance, but breaks other developers's work. And for this reason, I keep stay with Ruby v2.5.8 now. One day the ruby/Coroutine is removed. And the I think For other programming languages, like JavaScript never do this (Fiber.scheduler) and use multi-workers instead. And Golang design GMP in the first time, so that users never create the thread directly but manage by GMP scheduler. And I want to say that the way Fiber.scheduler can go on and be nice to me if Ruby remove |
@jakitliang About everything you said is incorrect. Would you mind take your outdated inaccurate rants/trolling somewhere else, or inform yourself better?
It doesn't. Inform yourself before accusing. Insulting Samuel like that and based on your misunderstandings is unacceptable. |
First, Fiber-scheduler is unrelatesd with multi-thread, it's aim for make IO non-blocking, it hooks IO would made now and future Ruby codes take advantage transparently, and it just an interface, without a scheduler implementation IO should work like claasic. Second, Guild is a more higher level abstraction, they can work together and MAY gain more performance. Third, I guess you should move your reply here: https://bugs.ruby-lang.org/issues/16786, It was a (nearly) one year dissussion, it's not one person show but get approved by many people including Matz, ko1 and Eregon who are key people for MRI and TruffleRuby. |
The couroutine has been hooked into pthread: https://github.com/ruby/ruby/blob/789da481fc59ffb1a0d4e4deb0a17ec4fcbd1d58/cont.c#L780 https://github.com/ruby/ruby/blob/master/coroutine/pthread/Context.c and the GVL is here: |
@jakitliang Samuel introduced his coroutine library to replace the ad-hoc implementation in CRuby. There are zero semantics change from that (Fibers are still changed only explicitly with resume/yield/transfer as before, and there is no Fiber scheduler by default), except now Fibers are faster to create & switch. |
Yeah, I appreciate it. I've asked him about these. And I known he works a lot improve the origin implementation of Fiber. |
Puma hat off
Many advancements across many fields are the result of a single person or a small team. If the governance of Ruby is the issue, take that up elsewhere. Puma hat on |
I think there would be a better way to improve this. You can see, in c++, std::thread is easy to manually create and join a new thread. If someone make a And What do you think about this What about make a golang's GMP into |
@jakitliang I'm unrelated to this project, don't know why you invited me here, I have no opinion about it... |
I have no opinion on this. My work projects use some libraries to organize a thread pool, and most side project I have try to avoid threading in the first place. |
Thanks a lot @bkaradzic and @nlohmann, and sorry 🤣 In this topic we talk about the concurrency and something about module design. |
Is your feature request related to a problem? Please describe.
Ruby 3.0 will release very soon, the new feature Fiber Scheduler may significant improve Ruby server app.
My friend working on the first Fiber Scheduler implementation called EVT https://github.com/dsh0416/evt
The benchmark shows impressive.
Although there's still lacking DB drivers, Redis, etc. to adapt the fiber scheduler so Rack-based app can't get such performance, but I think it is time now.
Describe the solution you'd like
Let Puma support Ruby 3.0 Fiber Scheduler
The text was updated successfully, but these errors were encountered: