3 ms·
As I understand it will yield back once it hits IO. But if you have something like a web server with a timeout of 60s you won't be able to open 10'000 connectio
by faebi 6y ago
As I understand it will yield back once it hits IO. But if you have something like a web server with a timeout of 60s you won't be able to open 10'000 connections at once to it. Some or all will be probably run into the timeout before the ruby could process the whole request. Therefore I would try to use some form of rate limiting via a FiberPool with a backlog.
- cogman10 6y agoUse a semaphore instead. That's what it is built for. That way you don't need to make a complex fiber scheme just for resource management. Spin up as many as you need an the runtime will do the task pool for you. https://ruby-concurrency.github.io/concurrent-ruby/1.1.4/Concurrent/Semaphore.html https://ruby-concurrency.github.io/concurrent-ruby/1.1.4/Con...