[ACCEPTED]-JRuby on Rails vs. Ruby on Rails, what's difference?-jrubyonrails
JRuby is the Ruby implementation that runs 3 on a JVM whereas Matz's Ruby is a C implementation.
Key 2 features to note are:
- JRuby runs on Java VM's and it's either compiled or interpreted down to Java byte code.
- JRuby can integrate with Java code. If you have Java class libraries (.jar's), you can reference and use them from within Ruby code with JRuby. In the other direction you can also call JRuby code from within Java. JRuby can also use the JVM and application server capabilities.
- JRuby is usually hosted within Java application servers such as Sun's GlassFish or even the Tomcat web server.
- Although you cannot use native Ruby gems with JRuby there are JRuby implementations for most of the popular Ruby libraries.
There are other differences 1 which are listed at the JRuby wiki:
I'm surprised there's a crucial thing missing 15 in all answers to this question, related 14 to GIL.
The main difference you should care 13 about esp. in web-applications such as ones 12 built with Rails is true concurrency ("Global Interpreter 11 Lock" free). When two threads are running 10 (e.g. serving 2 user requests) with JRuby 9 they are capable of running concurrently 8 within a single process, while in MRI there's 7 the GIL (even with 1.9's native threads) that 6 avoids executing Ruby code in parallel.
For 5 an application developer this is the first 4 thing to keep in mind while considering 3 JRuby, as it really shines with
config.threadsafe! but requires 2 you to make sure your code (and your gems 1 code) to be "truly" thread-safe.
I may be wrong, but I think you can package 6 a JRuby on Rails app in a way you can't 5 do with normal RoR - look at Mingle or similar. Makes 4 it possible to sell without dropping your 3 pants / opening the komono.
That said, I'm 2 not familiar enough with RoR packaging, so 1 dont hold me to it :)
mostly it should work the same. in jRoR 7 you can access stuff you wouldn't have in 6 RoR. Usually its mainly a deployment concern.
However, if 5 your RoR app uses native libraries that 4 don't have an equivalent that runs on the 3 JVM, that can be a pain. However most libs 2 have a non native version available (at 1 least the popular ones I have come across).
There are some great answers here already.
eebbesen 16 already covered the basics, and kares (himself!) has 15 told us JRuby has no GIL.
I'll add from 14 a more practical perspective, I've launched 13 apps on Ruby on Rails, and then migrated 12 to JRuby for performance reasons.
There 11 were two main performance benefits: JRuby 10 is (or was) simply faster than Ruby in some 9 circumstances, and two, the lack of the 8 Global Interpreter Lock kares mentions allowed 7 me to do multithreading, which, while tricky, unlocked 6 orders of magnitude performance benefits.
A 5 very large Ruby on Rails app ported and 4 ran in an hour, gems and all. The only actual 3 glitch was that Java's regexes are slightly 2 different than Ruby's. That's a monumental 1 achievement on JRuby's part.
More Related questions