3 ms·
If you wanted to run 5000 parallel async requests in MRI ruby surely you'd just use a simple thread pool wouldn't you? If you prefer some other paradigm then C
by Lio 6y ago
If you wanted to run 5000 parallel async requests in MRI ruby surely you'd just use a simple thread pool wouldn't you?
If you prefer some other paradigm then Concurrent Ruby[1] has a swiss army knife of them including event loops and Go style SCP.
I think things will improve in ruby 3 but even without ractors it's still possible to do either async IO in MRI or use JRuby for fully parallel ruby.
1. https://github.com/ruby-concurrency/concurrent-ruby https://github.com/ruby-concurrency/concurrent-ruby
- speedgoose 6y agoIt's good to see that Ruby is getting some async IO. Hopefully Rails and the other frameworks will use it.
- Lio 6y agoThis is not really a new thing but maybe it's not well known. Ruby's had aysnc IO support for at at least 10 years I think. Rails itself has been using Concurrent Ruby since at least Rails 5 but I think it had its own concurrency patterns even before that. e.g. ActiveRecord database drivers. Jesse Storimer's Working with Ruby Threads book from 2013 is still a really good resource for concurrency in ruby.