Forum: JRuby RE: mri development -> jruby prod, is this common?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
S Ahmed (Guest)
on 2013-06-15 17:28
(Received via mailing list)
I like how developing with mri is a bit faster, is it common for people
develop using mri, and then to deploy using jruby?  (and maybe run tests
via jruby also to ensure things are working on the jvm side).

If so, are there any tips/tricks to do switching between different

I use rvm, but I can't use a .rvmrc file then if I want to be able to
switch back and forth etc.
773c21073bd45af7c4f90ce516827752?d=identicon&s=25 Eric W. (edubkendo)
on 2013-06-15 19:13
Hello. I don't know how common it is to develop with MRI but use JRuby
in production, and it isn't something I've done, but I immediately
thought of this talk when I saw your question.
Xavier Shay discusses doing exactly that while at Square. This is from
JRuby Conf 2012 I believe.
Karol Bucek (Guest)
on 2013-06-17 08:58
(Received via mailing list)
Hi Ahmed, I've done this while testing gems as well as developing Rails

It's not an issue - I've hit incompatibilities maybe twice - some gem
behaved differently on JRuby than on MRI - usually a monkey-patch
It requires a bit of discipline e.g. when you have different gems/code
do the same tasks in MRI and JRuby - it's not common but we've used this
well e.g.
to zip files RubyZip had some issues for us (was 2 years back) thus
'zip' on MRI but Java's API on JRuby since it performed better not
to shell out.

You hide such platform specific code behind an API used in the rest of
app while it sets up different "delegates" based on e.g.
`defined?(JRUBY_VERSION)` ...
Of couse `rvm use jruby && rake test` every once a while is a good idea
depends on how much experience you have with JRuby - it's not that much
necessary unless you're doing something concurrently e.g. with threads
or a
lot of unix-y process-ing.

On the topics of servers / JRuby for development - there are options and
you can even combine them.

I've seen the presentation from SQ if I recall correctly there's a
bias to "not use Tomcat" - I would say that's a bit of an myth (esp.
irrelevant for running Rails on Java Servlets), but you do not need to
my word for it -  companies such as SpringSource rely on TC.
What's important is that JetPack last time I checked uses JRuby-Rack
it's portable - even if you use Java Servlet API extensions provided by
API as Warbler uses the very same and Trinidad (on top of TC) as well.
you'll be mostly fine doing (JRuby specific) development on Trinidad and
deploying to JetPack or "plain" Jetty / Tomcat .

1866d19a5d38a41157e2b4a270ee9e0a?d=identicon&s=25 Michael P. (mcp)
on 2013-06-19 14:23
(Received via mailing list)
Hi Ahmed,

It's the we've been running for quite a few years now. MRI is much, much
faster for development, but jruby is great is a production environment,
only due to the simplicity of deployment (just a war file + sql/ddl) and
speed of the production runtime, but also because it allows us to send
compiled artefacts to our clients without having to divulge source code.

The only incompatibility we've found has been with nokogiri, which is
a wrapper around the native XML processors that are not quite

We've developed wrapper scripts over time that let us run things under
jruby, just using the jruby-complete jar file. So we have jbundle and
that launch everything under jruby. Our wrappers also lock the version
jruby and the version of java, so different projects can have different
jruby and java versions (this is important if you use compiled
particularly compiled gems). We use rbenv just for MRI.


This topic is locked and can not be replied to.