Speeding up Rails 7 Controller Actions using ActiveRecord load_async

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 #activerecord https://rubyonrails.ba/single/speeding-up-rails-7-controller-actions-using-activerecord-load_async

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles