TruffleRuby has shown to have some incredible performance benefits over MRI Ruby. Has the rails core team considered working closer with TruffleRuby project to bring support for Rails? Looks like it would be a huge benefit to improve overall Rails performance and app start up times.
Shopify are heavily invested in truffleruby and multiple core team members work there.
I think vanilla rails probably works with truffle latest, @Benoit_Daloze can probably expand on current limitations
I know for sure the truffle team are super keen to get all gems working. Our current biggest blocker Discourse wise is libv8 which is being worked on
Rails 6 should in general work on TruffleRuby, including rails new
.
Please report to Issues · oracle/truffleruby · GitHub if not.
fork()
is not currently supported.
Puma works well on TruffleRuby and TruffleRuby is tested in Puma’s CI.
That said, TruffleRuby doesn’t run Rails tests in CI yet. That would be something valuable to improve on.
Application startup and VM startup are quite different things. Right now, TruffleRuby is good at VM startup but not so much at application startup. Currently we’re focusing on peak performance (when the server is running for a while and JIT’ed the relevant methods/blocks) and on warmup time (how long to find those relevant methods/blocks and to JIT-compile them).
We have very experimental support for fork
at Shopify done by Carol Chen - we’ve had Puma running in forking mode with it.
Our focus at Shopify isn’t on running Rails on TruffleRuby right at this moment but we’re interested in supporting any efforts towards it.
Just interested, how does TruffleRuby do memory-wise compared to MRI?
Baseline memory is often pretty high, and it takes memory to run our optimisations, but TruffleRuby when it’s running then has optimisations to reduce memory used for each request, such as removing object allocations, zero-copy strings, and so on. Realistically TruffleRuby is designed for larger deployments serving many users, and probably isn’t suite for a 500 MB $5 instance, this is true.
With fork not supported, when running rails with puma on truffleruby, how do we configure puma to not attempt to fork? Or should we start rails without puma? Ultimately, I’d like to run a rails app with truffleruby is all haha. If there is any documentation I should be reading please let me know (or any sample puma config or sample rails command, etc). I will be running a rails app on truffleruby on both macOS and Linux.
Also, thank you both for all your work on truffleruby (and any graalvm related work as well)!
Just look at config/puma.rb
inside the Rails app, and only set thread-related settings and no process/workers/cluster-related settings.
For example like this.
That did it! Thank you @Benoit_Daloze