
On 2023-1-21 10:37 pm, Lionel Bouton via ruby-talk wrote:
Hi,
I just evaluated the possibility of using Ractors to distribute processing using various gems with native extensions (some matrix/vector computations with Numo::Linalg and approximate vector searches) and I've mixed feelings.
The Ractor design seems very sound to me and I would prefer to use them to distribute the load on multiple CPUs but in practice I see 2 major obstacles : - the first use of Ractor code isn't encouraging, even with Ruby 3.2.0, as it outputs : "warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues." - when heavy computations are involved you are probably already using gems with native extensions and when trying to use them in a non-main Ractor you will almost always get an exception : "ractor unsafe method called from not main ractor (Ractor::UnsafeError)"
The remaining comments in this thread are useful but I would recommend watching this talk by Samuel Williams (@ioquatix on Twitter/ Mastadon) since he probably has the best knowledge to answer your question :) https://www.youtube.com/watch?v=Y29SSOS4UOc In what I read, ractors are still slow but as with most things Ruby, it takes a couple of versions to be great to go. Best wishes, Mohit.