Plans for TruffleRuby Support

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

5 Likes

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).

3 Likes

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.

2 Likes

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.

2 Likes