-
First of all, thank you for making these gems in the Async family. It's one of the most exciting developments in Ruby 3, in my opinion. I've been working to replace threads, in several IO-heavy tasks, with Async. For example, downloading up to 500 images in parallel, and saving them to a tempfile:
The threaded version of this took 0.7s with 500 threads (as an experiment), and 2.5s with 12 threads as we cap to limit resource usage in prod.
Finally, I updated This was surprising since I always assumed the Fiber scheduler would work about the same with any library that does IO: that it could capture most blocking operations and pass work to other fibers. But, it sounds like either Can you share any comment on this? It look me a while to even think of trying |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I could not reproduce your results. Here is a benchmark comparing the 3 scenarios:
Essentially, the performance looks about what I'd expect. Probably the main reason why Can you figure out what you are doing that deviates from my benchmark? https://github.com/socketry/async-http/blob/main/benchmark/async/http/client.rb You can run the benchmark using |
Beta Was this translation helpful? Give feedback.
A good default strategy is to use
Async::Idler
(as the semaphore). It's going to be a little more conservative than just rapid fire everything, but it will balance load better between different parts of your system.Should be fixed on
main
- forgot to commitgems.rb
:)