17 ms·
> For example ActiveRecord database requests have been non-blocking for many years. Right, but it still blocks the entire calling thread, no? Been a few years
by adrianpike 6y ago
> For example ActiveRecord database requests have been non-blocking for many years.
Right, but it still blocks the entire calling thread, no? Been a few years since I've been deep into Rails.
- Lio 6y agoAh, I see the confusion in what I’ve said. Yes the IO calls themselves are blocking but you can easily wrap them in separate OS threads. The GVL will release when the IO call blocks allowing another OS thread, including the parent, to continue. That allows you to make blocking calls in parallel but is heavier weight than using the new scheduler and fibres for those parallel IO calls. In the case of ActiveRecord I think it’s down to the database driver implementation, anyone who knows care to comment?