be able to send parallel requests in a unified way across different HTTP client gems ◦ For example: faraday gem, grpc gem, aws-sdk gem • Should be easy for in-house engineers to understand and use
wanted to address the issue of having many Faraday requests • faraday-em_synchrony is one of Faraday’s adapters that allows parallel requests ◦ This approach is currently running in the production environment • Issues with this approach: ◦ It depends on the EventMachine gem, which hasn't had a release since 2018 and is somewhat outdated ◦ It only works with Faraday ◦ It is not compatible with Faraday 2.x
is a mechanism that enables concurrent processing using Fibers • Implementations like the async gem allow the scheduler to delegate execution to other Fibers when I/O blocking occurs, such as with IO#wait, IO#read, or IO#write in Ruby
Fiber Scheduler is present, Ruby internally checks and delegates certain I/O operations to the scheduler ◦ For example: in the implementation of IO#wait, there's logic to invoke the Fiber Scheduler if it exists
a Fiber Scheduler is present, Ruby internally checks and delegates certain I/O operations to the scheduler ◦ For example: in the implementation of IO#wait, there's logic to invoke the Fiber Scheduler if it exists
with Fiber Scheduler? • Methods like Ruby’s IO#wait, which have specific behavior defined when a Fiber Scheduler is present ◦ cf. https://docs.ruby-lang.org/en/3.4/Fiber/Scheduler.html • Even methods implemented in native extensions, as long as they define behavior for when a Fiber Scheduler is available
in a unified way across different HTTP client gems ◦ For example: faraday gem, grpc gem, aws-sdk gem • Should be easy for in-house engineers to understand and use Now, let's revisit and reorganize the requirements for the parallel request client.
in a unified way across different HTTP client gems ◦ For example: faraday gem, grpc gem, aws-sdk gem • Should be easy for in-house engineers to understand and use Now, let's revisit and reorganize the requirements for the parallel request client.
logic for sending gRPC requests and waiting for responses is implemented in the C-based gRPC core This leaves no room to hook in Ruby’s Fiber Scheduler for concurrent handling!
parallel request client • Wanted to unify and parallelize various HTTP clients like Faraday, gRPC, and AWS SDK • But it turned out that gRPC's implementation doesn't work well with Fiber Scheduler for parallelization • So now, I'm building an easy-to-use parallel client using Threads that works smoothly with all of them! ◦ To be continued...