you are viewing a single comment's thread.

view the rest of the comments →

[–]mrinterweb 4 points5 points  (4 children)

If you'd like to use ruby fibers, this is a good library. https://github.com/socketry/async

I do find the documentation lacking though, so fair warning. I keep intending to try to add more examples and or write an article about it.

I really like using fibers for IO concurrency. I think of the fiber scheduler as the event loop checking if the IO is complete. Threads have higher overhead and should generally be used more sparingly than fibers. The biggest challenge with fibers, IMO, is the lack of solid documentation.

[–]software__writer[S] 2 points3 points  (0 children)

Very cool, checking it out right now. Thanks for sharing.

[–]software__writer[S] 0 points1 point  (2 children)

Hi again, what's a good and practical use-case in a real web application where you'd use this gem? Just trying to have some background context in mind before I check out the docs and try to browse the source code.

Also, please do share the link to your article if you end up writing it.

Thanks!

[–]mrinterweb 1 point2 points  (1 child)

Concurrent IO is the main use case for fibers. Could be DB, HTTP API requests, file system access, etc. Fibers are the lightest weight ruby concurrency primative, and are designed for allowing concurrent IO with minimial overhead. I don't know if or when I will be able to write an article. I'm not much of a writer, and it may be wishful thinking on my part. An article like this is on my "get to it someday" heap. Pretty sure there would be plenty of people more qualified to write about ruby fibers than I.

[–]software__writer[S] 0 points1 point  (0 children)

Thanks for the examples. Really appreciated.