Discourse on Truffleruby

Has anyone tried having Discourse on the truffleruby?
Does it make sense to look in this direction?


Interesting. Why did they decide to fork not contribute I wonder?


@merefield Truffleruby is an implementation of Ruby for GraalVM by Oracle guys. Good performance and interoperability with other languages on GraalVM.
It’s not a fork.

I have some experience with Rails on Truffleruby and want to check Discourse next week.

Some additional information - Running Rack and Rails Faster with TruffleRuby - Speaker Deck

1 Like

Sounds fascinating. Would you expect to be able to run the existing Discourse codebase without significant changes? What kind of changes might be needed?

1 Like

Short answer: No, it currently doesn’t work on TruffleRuby.


@gerhard Thanks for the link, It will be easier for me to understand existing issues.

1 Like

The current blocker is mini_racer, see https://github.com/oracle/truffleruby/issues/1827

That said, at least all gems install on TruffleRuby, we test that in CI (for some slightly older Discourse).


This issue was fixed 5 days ago.


Unfortunately, mastodon, not discourse, will be the first to work on truffleruby :dotted_line_face:

1 Like

@volanar yeah - I don’t have enough time to return to this question just now - intensive day job.

1 Like

@eregon is here, and I am not aware of any blockers on truffle, we merged in the fixes for mini racer last year

1 Like

Brandon got Discourse running a year ago:

One issue IIRC was some gems rely on Hash being thread-safe, which we have a general solution for but is not merged/integrated yet in TruffleRuby. OTOH it’s very rarely correct to just use Hash concurrently, it often results in hiding concurrency bugs in harder-to-find ways. So it’s arguably better to just fix the gems relying on that, but that takes time.
We need to benchmark performance, and for that to be meaningful/representative we should benchmark multi-threaded. That needs A way to mark C extensions as thread-safe, so they can be executed in parallel · Issue #2136 · oracle/truffleruby · GitHub


I hope it will be solved quickly :face_with_peeking_eye:
How much do you think the performance indicators of discourse will improve with the use of truffleruby (TTFB, overall performance, etc.)?