Why JRuby?
Upcoming SlideShare
Loading in...5

Why JRuby?



When should you choose JRuby, a JVM-based implementation of Ruby, over MRI, the default C-based implementation? JRuby offers access to Java libraries, better performance, and can be deployed on ...

When should you choose JRuby, a JVM-based implementation of Ruby, over MRI, the default C-based implementation? JRuby offers access to Java libraries, better performance, and can be deployed on Java-based infrastructure.



Total Views
Views on SlideShare
Embed Views



6 Embeds 445

https://gitter.im 267
http://hcasset.electricnude.org 104
https://twitter.com 65
http://idos2013.alex-d.fr 5
https://abs.twimg.com 3
http://www.onlydoo.com 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Why JRuby? Why JRuby? Presentation Transcript

  • Why JRuby?Fiona Tay@msfionatayEngineer, Pivotal Labs
  • This is for theperson who justwants to make webapps.
  • This is about theGood, The Bad, andThe Ugly. View slide
  • I’m a Rubyist 4 View slide
  • I’m also a JRubyisthttp://github.com/GreenplumChorus/chorus 5
  • An Introduction
  • It’s a Ruby implementation1. Install it2. Write Ruby code 7
  • It’s a Ruby implementation 8
  • Ruby implementationsInterchangeable to an extentPopular implementations:• MRI• JRuby• Rubinius• MacRuby 9
  • Under the hood   10
  • Under the hood   secret sauce 11
  • Interchangeability1+1 should be 2 in all implementations 12
  • Implementation differencesSome implementations are more equal than othersDifferences:• Speed of execution• Support for libraries• Implementation bugs 13
  • History of JRubyAround since 2002Has had traction in real projects since ~2005 14
  • JRuby in the real world 15
  • JRuby in the real world 16
  • The Good
  • Access to Java librariesIncredibly powerful toolEveryone and his/her dog writes Java 18
  • Java libraries: NLPStanford Parser is the NLP library of choice 19
  • Java libraries: EmailJavaMail is a better alternative to ActionMailer 20
  • Access to Java librariesJRuby has deep integration with JavaDirectly call Java code from Ruby 21
  • Directly calling Java code 22
  • Using other languagesOther languages built on the JVM• Scala - special support• Clojure• Groovy 23
  • Using Ruby gemsIf you’re lucky, someone has made a Ruby gem thatwraps the Java libraryAlso wrapping a gem is a good idea 24
  • Easier app deploymentNot easier than git push heroku masterOnly relevant if you’re deploying to large server system 25
  • Easier app deploymentLeverage existing Java-based deployment infrastructure 26
  • Leverage infrastructureWarbler packages everything into a single WAR fileStandard file format for Java deploys 27
  • Other deployment optionsTorqueBox provides additional services 28
  • Better performanceBetter compiler than MRIBenefits from improvements to JVM 29
  • Better performanceAccess to highly optimized Java libraries 30
  • The Bad
  • Gem availability 32
  • Gem availabilityGems written in pure Ruby work with JRubyGems with C extensions don’t work with JRubyTypically, these are older, less-maintained gems 33
  • Fixing gemsSometimes, you can fix the existing gemCould be as simple as replacing its dependenciesOr could be complex 34
  • Fixing gemsPatched a job queueing systemTook more work than we expectedYMMV 35
  • Long app startup timeInhibits test-driven developmentDue to Rails startup timeDifficult to set up Spork with JRuby 36
  • Long app startup timeC’est la vie 37
  • Less mature technologyMRI still the defaultThough JRuby has maturedLibraries developed against MRI 38
  • The Ugly
  • Concurrency“Concurrency is when several computations areexecuting simultaneously, and potentially interactingwith each other.” - Wikipedia 40
  • ConcurrencyJRuby has real threadsMRI Ruby has threads with Global Interpreter Lock 41
  • Concurrency and RubyThreads are a major innovationBut MRI has never really had a focus on concurrency 42
  • Concurrency is greatCheaper to scaleGood multi-threaded web servers 43
  • More bang for your buckOne server: MRI runs two Ruby processesOne server: JRuby runs two Ruby processes with 4threads eachCan use JRuby on Heroku 44
  • Concurrency is not freeBugs in non-thread safe libraries• Rails• AirbrakeLibraries developed without a focus on concurrency 45
  • Concurrency is not freeWriting thread-safe code is difficultEven for Java developers with experienceBut concurrency is the new sexy 46
  • Concurrency is worth itHuge performance improvementsSome features would be much easier with threadsThreads is the future 47
  • The Decision
  • JRuby is a non-standard choice.
  • Should you use JRuby?Do you want to use Java libraries? 50
  • Should you use JRuby?Do you want to leverage Java-based deploymentinfrastructure? 51
  • Should you use JRuby?Do you need good performance? 52
  • Should you use JRuby?Otherwise, no 53
  • Should you use JRuby?Not to worry - you can always switch to JRuby laterLots of people switch for performance reasons 54
  • Getting started with JRubyjruby-lint checks how ready your code is to run onJRuby 55
  • AcknowledgmentsPivotal LabsJRuby team 56
  • Thanks!@MsFionaTay