[jruby-user] RE: mri development -> jruby prod, is this common?

12 views
Skip to first unread message

S Ahmed

unread,
Jun 15, 2013, 11:26:05 AM6/15/13
to us...@jruby.codehaus.org
I like how developing with mri is a bit faster, is it common for people do 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 runtimes quicky?

I use rvm, but I can't use a .rvmrc file then if I want to be able to switch back and forth etc.


Eric West

unread,
Jun 15, 2013, 1:13:54 PM6/15/13
to us...@jruby.codehaus.org
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. http://vimeo.com/45719570
Xavier Shay discusses doing exactly that while at Square. This is from
JRuby Conf 2012 I believe.
Cheers,
edub

--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Karol Bucek

unread,
Jun 17, 2013, 2:56:25 AM6/17/13
to us...@jruby.codehaus.org

 Hi Ahmed, I've done this while testing gems as well as developing Rails apps.

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

You hide such platform specific code behind an API used in the rest of your 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 strong 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 take my word for it -  companies such as SpringSource rely on TC.
What's important is that JetPack last time I checked uses JRuby-Rack thus it's portable - even if you use Java Servlet API extensions provided by the API as Warbler uses the very same and Trinidad (on top of TC) as well. Thus you'll be mostly fine doing (JRuby specific) development on Trinidad and deploying to JetPack or "plain" Jetty / Tomcat .

K.

Michael Pitman

unread,
Jun 19, 2013, 8:20:11 AM6/19/13
to us...@jruby.codehaus.org
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, not 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 just a wrapper around the native XML processors that are not quite compatible.

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 jrake that launch everything under jruby. Our wrappers also lock the version of jruby and the version of java, so different projects can have different jruby and java versions (this is important if you use compiled artefacts, particularly compiled gems). We use rbenv just for MRI.

Regards,

Michael

Reply all
Reply to author
Forward
0 new messages