My concern is number of database connections. In the example it's 100 fibers per worker, at that rate you are going to exhaust db connections sooner. Happy to be wrong.
This looks fantastic for a common async workflow I use. I often use one job to fan out multiple individual http request jobs. The reason I prefer jobs for this is easy and consistent retry logic, and durability. I want to make sure those HTTP requests eventually go through. Fibers would be much better suited for this. So much of work that goes onto work queues is IO bound, and fibers are a great fit for that.
EventMachine provided a event-reactor based concurrency model, but its API was so different and imposed a different style of programming (namely, callback-based) that it didn't really mesh with the "Ruby way" and most importantly was incompatible with most of the Ruby ecosystem (and especially Rails).
9 comments
[ 0.20 ms ] story [ 9.6 ms ] threadIs it possible to either have multiple ractors dispatching jobs with fibres or to set up multiple queues with different strategies?
E.g. one for IO bound and one for CPU bound?
With Sidekiq I’ve had luck having workers running on Truffleruby but generally don’t use it for my main rails apps.
That said, these days you’ll pry the BEAM from my cold, dead hands. It’s hard to go back to any other concurrency story.
https://github.com/eventmachine/eventmachine