Speeding up Rails 7 Controller Actions using ActiveRecord load_async
24-Jun-2021 2189
The queries are executed synchronously, which mostly isn’t a huge concern. But, as the database grows larger in size, the response time of requests is getting longer. A significant part of the query time is often just I/O waits. Since these two queries are totally independent, ideally you could execute them in parallel, so that assuming that each take 50ms, the total query time would be 50ms rather than 100ms. In the above scenario, the queries can be executed asynchronously, and the time saved on the I/O waits can be reutilized for the next query execution.
Speeding up Rails 7 Controller Actions using ActiveRecord load_async #ruby #rubydeveloper #rubyonrails #Speeding #Rails #Controller #Actions #using #ActiveRecord #load_async #activerecord https://rubyonrails.ba/link/speeding-up-rails-7-controller-actions-using-activerecord-load_async