SlideShare ist ein Scribd-Unternehmen logo
1 von 57
Downloaden Sie, um offline zu lesen
Why JRuby?
Fiona Tay
@msfionatay
Engineer, Pivotal Labs
This is for the
person who just
wants to make web
apps.
This is about the
Good, The Bad, and
The Ugly.
I’m a Rubyist




                4
I’m also a JRubyist




http://github.com/GreenplumChorus/chorus



                                           5
An Introduction
It’s a Ruby implementation
1. Install it
2. Write Ruby code




                             7
It’s a Ruby implementation




                             8
Ruby implementations
Interchangeable to an extent
Popular implementations:
• MRI
• JRuby
• Rubinius
• MacRuby




                               9
Under the hood




                       




                 10
Under the hood




                                  




                 secret sauce

                            11
Interchangeability
1+1 should be 2 in all implementations




                                         12
Implementation differences
Some implementations are more equal than others
Differences:
• Speed of execution
• Support for libraries
• Implementation bugs




                                                  13
History of JRuby
Around since 2002
Has 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 libraries
Incredibly powerful tool
Everyone and his/her dog writes Java




                                       18
Java libraries: NLP
Stanford Parser is the NLP library of choice




                                               19
Java libraries: Email
JavaMail is a better alternative to ActionMailer




                                                   20
Access to Java libraries
JRuby has deep integration with Java
Directly call Java code from Ruby




                                       21
Directly calling Java code




                             22
Using other languages
Other languages built on the JVM
• Scala - special support
• Clojure
• Groovy




                                   23
Using Ruby gems
If you’re lucky, someone has made a Ruby gem that
wraps the Java library
Also wrapping a gem is a good idea




                                                    24
Easier app deployment
Not easier than git push heroku master
Only relevant if you’re deploying to large server system




                                                           25
Easier app deployment
Leverage existing Java-based deployment infrastructure




                                                         26
Leverage infrastructure
Warbler packages everything into a single WAR file
Standard file format for Java deploys




                                                    27
Other deployment options
TorqueBox provides additional services




                                         28
Better performance
Better compiler than MRI
Benefits from improvements to JVM




                                   29
Better performance
Access to highly optimized Java libraries




                                            30
The Bad
Gem availability




                   32
Gem availability
Gems written in pure Ruby work with JRuby
Gems with C extensions don’t work with JRuby
Typically, these are older, less-maintained gems




                                                   33
Fixing gems
Sometimes, you can fix the existing gem
Could be as simple as replacing its dependencies
Or could be complex




                                                   34
Fixing gems
Patched a job queueing system
Took more work than we expected
YMMV




                                  35
Long app startup time
Inhibits test-driven development
Due to Rails startup time
Difficult to set up Spork with JRuby




                                       36
Long app startup time
C’est la vie




                        37
Less mature technology
MRI still the default
Though JRuby has matured
Libraries developed against MRI




                                  38
The Ugly
Concurrency
“Concurrency is when several computations are
executing simultaneously, and potentially interacting
with each other.” - Wikipedia




                                                        40
Concurrency
JRuby has real threads
MRI Ruby has threads with Global Interpreter Lock




                                                    41
Concurrency and Ruby
Threads are a major innovation
But MRI has never really had a focus on concurrency




                                                      42
Concurrency is great
Cheaper to scale
Good multi-threaded web servers




                                  43
More bang for your buck
One server: MRI runs two Ruby processes
One server: JRuby runs two Ruby processes with 4
threads each
Can use JRuby on Heroku




                                                   44
Concurrency is not free
Bugs in non-thread safe libraries
• Rails
• Airbrake
Libraries developed without a focus on concurrency




                                                     45
Concurrency is not free
Writing thread-safe code is difficult
Even for Java developers with experience
But concurrency is the new sexy




                                           46
Concurrency is worth it
Huge performance improvements
Some features would be much easier with threads
Threads 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 deployment
infrastructure?




                                                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 later
Lots of people switch for performance reasons




                                                      54
Getting started with JRuby
jruby-lint checks how ready your code is to run on
JRuby




                                                     55
Acknowledgments
Pivotal Labs
JRuby team




                  56
Thanks!
@MsFionaTay

Weitere ähnliche Inhalte

Was ist angesagt?

Inside The Java Virtual Machine
Inside The Java Virtual MachineInside The Java Virtual Machine
Inside The Java Virtual Machine
elliando dias
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
elliando dias
 
T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJS
Tim Sommer
 
Windsor: Domain 0 Disaggregation for XenServer and XCP
	Windsor: Domain 0 Disaggregation for XenServer and XCP	Windsor: Domain 0 Disaggregation for XenServer and XCP
Windsor: Domain 0 Disaggregation for XenServer and XCP
The Linux Foundation
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvm
deimos
 

Was ist angesagt? (20)

Inside The Java Virtual Machine
Inside The Java Virtual MachineInside The Java Virtual Machine
Inside The Java Virtual Machine
 
Cloud Foundry 百日行 振り返り
Cloud Foundry 百日行 振り返りCloud Foundry 百日行 振り返り
Cloud Foundry 百日行 振り返り
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
Dynamic Languages on the JVM
Dynamic Languages on the JVMDynamic Languages on the JVM
Dynamic Languages on the JVM
 
Ruby On Rails Ecosystem
Ruby On Rails EcosystemRuby On Rails Ecosystem
Ruby On Rails Ecosystem
 
Noah - Robust and Flexible Operating System Compatibility Architecture - Cont...
Noah - Robust and Flexible Operating System Compatibility Architecture - Cont...Noah - Robust and Flexible Operating System Compatibility Architecture - Cont...
Noah - Robust and Flexible Operating System Compatibility Architecture - Cont...
 
MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?MacRuby: What is it? and why should you care?
MacRuby: What is it? and why should you care?
 
The Real Thing: Java Virtual Machine
The Real Thing: Java Virtual MachineThe Real Thing: Java Virtual Machine
The Real Thing: Java Virtual Machine
 
Ruby Plugins for Jenkins
Ruby Plugins for JenkinsRuby Plugins for Jenkins
Ruby Plugins for Jenkins
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
 
GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22GraalVM - MadridJUG 2019-10-22
GraalVM - MadridJUG 2019-10-22
 
T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJS
 
Inside the JVM
Inside the JVMInside the JVM
Inside the JVM
 
Why we use mruby with Perl5?
Why we use mruby with Perl5?Why we use mruby with Perl5?
Why we use mruby with Perl5?
 
Introduction to JRubMe
Introduction to JRubMeIntroduction to JRubMe
Introduction to JRubMe
 
MacRuby
MacRubyMacRuby
MacRuby
 
Windsor: Domain 0 Disaggregation for XenServer and XCP
	Windsor: Domain 0 Disaggregation for XenServer and XCP	Windsor: Domain 0 Disaggregation for XenServer and XCP
Windsor: Domain 0 Disaggregation for XenServer and XCP
 
The bigrabbit
The bigrabbitThe bigrabbit
The bigrabbit
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvm
 
デザインシステムの海で3年間もがいてみて
デザインシステムの海で3年間もがいてみてデザインシステムの海で3年間もがいてみて
デザインシステムの海で3年間もがいてみて
 

Ähnlich wie Why JRuby?

Seattlerb why jruby
Seattlerb why jrubySeattlerb why jruby
Seattlerb why jruby
snacktime
 
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
Darshan Karandikar
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQL
Peter Eisentraut
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
roialdaag
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
elliando dias
 

Ähnlich wie Why JRuby? (20)

Ruby V Ms A Comparison
Ruby V Ms A ComparisonRuby V Ms A Comparison
Ruby V Ms A Comparison
 
Seattlerb why jruby
Seattlerb why jrubySeattlerb why jruby
Seattlerb why jruby
 
Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
 
TSSJS 2011 - JRuby
TSSJS 2011 - JRubyTSSJS 2011 - JRuby
TSSJS 2011 - JRuby
 
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
 
Java and the Web
Java and the WebJava and the Web
Java and the Web
 
Simple tweaks to get the most out of your JVM
Simple tweaks to get the most out of your JVMSimple tweaks to get the most out of your JVM
Simple tweaks to get the most out of your JVM
 
JRuby in Java Projects
JRuby in Java ProjectsJRuby in Java Projects
JRuby in Java Projects
 
Real World Technologies
Real World TechnologiesReal World Technologies
Real World Technologies
 
Java features
Java featuresJava features
Java features
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
 
JRuby and Google App Engine
JRuby and Google App EngineJRuby and Google App Engine
JRuby and Google App Engine
 
Chapter-1 Introduction.pptx
Chapter-1 Introduction.pptxChapter-1 Introduction.pptx
Chapter-1 Introduction.pptx
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQL
 
Simple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvmSimple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvm
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
 

Kürzlich hochgeladen

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Why JRuby?