SlideShare a Scribd company logo
JRuby at ThoughtWorks
Ola Bini
JRuby Core Developer
obini@thoughtworks.com
About me
• Ola Bini
• From Gothenburg, Sweden
• Works for ThoughtWorks Studios in London
• Programming language geek (LISP, Io, Erlang, ML,
  Smalltalk, etc)
ThoughtWorks
• Global consulting firm
• About 900 people worldwide (UK, US, Canada, Oz,
  India, China)
• Known for Agile practices
• Martin Fowler is our Chief Scientist
• 40% projected revenue in the US from Ruby/Rails
ThoughtWorks Studios
• Product development
• CruiseControl Enterprise
• Mingle
• RubyWorks
  - CruiseControl.rb
  - Production stack
  - JRuby
Agenda
• Problems with Ruby
• JRuby
• Mingle
• Other uses
• Current problems
• Q&A
What’s wrong with MRI
• Ruby 1.8: Green threading
  - Can’t scale across processors/cores
  - C libraries won’t/can’t yield to Ruby code (DNS)
  - One-size-fits-all scheduler - doesn’t really fit all
• Ruby 1.9: Native, non-parallel threads
  - Core classes and extensions not ready for parallel
    execution
  - Lots of work to ensure thread safety
What’s wrong with MRI
• Ruby 1.8: Partial Unicode
  - Internet-connected apps MUST have solid Unicode
  - Ruby provides partial, inconsistent support
  - App developers must roll their own: Rails Multibyte
• Ruby 1.9: Full Unicode but drastic changes
  - String interface changes to per-char, not per-byte
  - Each String can have it’s own encoding
What’s wrong with MRI
• Ruby 1.8: Slower than most languages
  - 1.8 is usually called “fast enough”
  - ... but routinely finishes last in benchmarks
  - ... and no plans to improve the situation in 1.8
• Ruby 1.9: Improvement, but still more to do
  - New engine averages 3-4x improvement
  - Only AOT - No JIT
  - More to do: GC and threading still slow
What’s wrong with MRI
• Ruby 1.8: Memory management
  - Simple design
  - Good for many apps, but doesn’t scale
  - Stop-the-world GC
• Ruby 1.9: No change
  - Improved performance => more garbage
  - GC problems could well multiply
What’s wrong with MRI
• Ruby 1.8: C language extensions
  - C is difficult to write well
  - No encapsulation in core
  - Threading, GC issues
  - Portable, but often needs recompilation
  - No security restrictions
• Ruby 1.9: No change
What’s wrong with MRI
• Politics
  - You want me to switch to what?
  - ... and it needs servers/software/training?
  - This will probably improve with time
• Legacy
  - Lots of Java apps in the world
  - Extensive library of Java frameworks/libraries
What is JRuby
• Java implementation of the Ruby language
• Current version 1.0.1, released in August
• Based on Ruby 1.8.5
• Started in 2001 by Jan-Arne Petersen
• Currently 6 Core developers
• Open Source - about 30-40 contributors
What can it do?
• All “pure Ruby” code works (with some caveats)
• Rake and RubyGems run well
• Rails works near nigh perfectly
• Many projects using JRuby+RSpec
• New combinations of JRuby+X popping up
What can’t it do?
• Deterministic threading
• Continuations
• Some file system operations
• fork, and other POSIX-ilk
JRuby solutions to MRI problems
• Native threading
• Scale across all processors/cores
• Concurrent execution, even in extensions
• Allow systems to schedule threads
• Ensure reasonable safety in core classes
JRuby solutions to MRI problems
• World-class, native Unicode support
• Provide Ruby’s byte[]-based String
• ... but also provide native Rails Multibyte backend
• ... and you can use the Java UTF-16 Strings directly
• ... and we’re working at implementing 1.9 Strings
• Java has complete, reliable Unicode
• ... and all libraries are Unicode-ready
JRuby solutions to MRI problems
• Scalable performance
• Make interpreter as fast as possible
  - Should be as fast as Ruby 1.8
• Support Ruby 1.9/2.0 bytecode engine
  - Same resulting performance boost
  - Future-proof
• Each new version of Java improves JRuby
   performance substantially
JRuby solutions to MRI problems
• Compile to Java bytecodes
• AOT and JIT compilation
• Let HotSpot take over
  - ... by simplifying
    - HotSpot JIT
    - Code inlining
    - Dynamic optimizations
JRuby solutions to MRI problems
• Let Java manage memory
• Best memory management and GC in the world
• Wide variety of GC options
  - Concurrent
  - Generational
  - Real-time
• Scales up to enormous apps and systems
JRuby solutions to MRI problems
• Java-based extensions
• Easier to write than C
• Truly portable: WORA
• Clean separation between core and extensions
• No GC, threading or security issues
• Easier to expose Java libraries
JRuby solutions to MRI problems
• Politics don’t get in the way
  - JRuby is “just another Java library”
  - Minimal impact dev, admin processes
  - Over ten years of mainstream Java
• Legacy integrates just fine
  - Use existing services and libraries
Why ThoughtWorks likes JRuby
• JRuby gives access to the “enterprise” features of
  Java
• Conservative environments will not use MRI
• Quick integration with legacy systems
• Cost: Java+Ruby is more cost effective than MRI
Why JRuby on Rails for TW?
• Deployment, deployment, deployment
• JDBC for database access
• Other libraries that provide needed, cross-platform
  functionality (Java2D instead of RMagick?)
• Management (JMX and others)
• Common to do JRuby on Rails applications that work
  with legacy data
Mingle
• Team Collaboration Tool
• First commercial JRuby on Rails application
• Originally choose JRuby for SVN plugin
• Originally developed in MRI - still MRI compatible
• Very well tested
• Mingle test suite is slower in JRuby than MRI
• ... but in production the JRuby version is quicker and
  scales better
Mingle stats
•   +----------------------+-------+-------+---------+---------+-----+-------+
    | Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Controllers          | 2809 | 2377 |        32 |     276 |   8 |     6 |
    | Helpers              | 1255 | 1038 |         8 |     138 | 17 |      5 |
    | Models               | 11203 | 9079 |      176 |    1564 |   8 |     3 |
    | Libraries            | 4784 | 3919 |        88 |     383 |   4 |     8 |
    | Integration tests    |     0 |      0 |      0 |       0 |   0 |     0 |
    | Functional tests     | 3494 | 2881 |        27 |     337 | 12 |      6 |
    | Unit tests           | 16109 | 13272 |     105 |    1449 | 13 |      7 |
    | Acceptance tests     | 13318 | 10689 |      87 |    1100 | 12 |      7 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Total                | 52972 | 43255 |     523 |    5247 | 10 |      6 |
    +----------------------+-------+-------+---------+---------+-----+-------+
      Code LOC: 16413     Test LOC: 26842     Code to Test Ratio: 1:1.6
Mingle license decryption
• Licenses uses strong cryptography
• Using a Java RSA library
• Would have been very hard in MRI
• JRuby Java integration made it dead simple to use the
  RSA library
Obfuscation
• Override JRuby’s LoadService
• This allows us to encrypt/decrypt all Ruby files in app/*
• Will probably move to using AOT compilation when
  that is finished
• This is obfuscation - there is no real, safe protection in
  it
• ... but it seems to work well enough. =)
Mingle + ChartDirector
• ChartDirector is a proprietary library for making charts
• Have both a Java library and a C extension library for
  Ruby
• A thin wrapper over the Java library makes it possible
  to use the same chart code in MRI and JRuby
Mingle code example:
chartdirector4jr.rb
Mingle + SVNkit
• No MRI subversion library worked on all platforms
• Initial reason for going with JRuby
• SVNkit is a Java library that provides uniform
  subversion access on Linux, MacOS X, Windows,
  Solaris, and all other Java platforms
• SVNkit supports file system, DAV and SVN
Mingle deployment
• install4j - installation and bundling of JVM
• Runs locally using Jetty
• BYO database - (used to be Derby)
• 1.1 or 1.2 will support WAR deployment
• Uses custom built Jetty launching
• Uses custom built AntBuilder scripts to generate WAR
• Uses CC.rb for MRI and Java CC for JRuby
Finance client 1
• Conservative, large company
• IS department standardized on Java
• JRuby on Rails application
• JRuby improves integration
• Uses the UnitRecord plugin to speed-up test suites
• Lack of good RMagick replacement have been hard
• Tomcat+Lucene seems to be causing bugs
Finance client 2
• Large, conservative company
• Separate business units: most information is not
  shared
• Project aims to consolidate all accounts and customer
  information into one place
• It’s written in mainly Ruby with small amounts of Java
• 2 persons, probably 4 months from start to finish
• Interacting with 5 disparate data sources
Finance client 2 - why JRuby?
• Infrastructure barrier was primary reason
  - “ Those infrastructure guys are just seeing another
     Java app with some static textual content (happens
     to be Ruby source files)”
• Higher business value by directly lowering integration
  estimates
• Using Java APIs (especially JDBC) allowed quicker
  development, since no need to write new functionality
  for Ruby
Waffle
• Java web framework
• No XML - except minimal web.xml
• Easy to learn
• No base classes/interfaces needed
• Allows most functionality to work with Ruby
• ... ERb templates can be used as views
• Ruby classes as controllers
Forthcoming Studios projects
• Other tools for development/team collaboration
• Will use JRuby in different ways
• ... including allow Ruby to be used as extension
  language for Java based applications
• ... and improving the deployment and management
  story for JRuby
• Next product will probably be GA in Jan/Feb ‘08
Challenges with JRuby
• Performance of unit tests
  - Solution: running MRI precommit and JRuby in CI
  - Solution: using UnitRecord instead
• It’s not free to run on both MRI and JRuby
• Start-up time (especially of Rails)
  - Solution: staged start-up in background
  - Not always enough for day-to-day development use
Challenges with JRuby
• JRuby regular expressions have different performance
  characteristics and big-O running time in certain cases
• JRuby YAML isn’t completely stable yet (but it’s getting
  there)
• High memory consumption (but still lower than
  Mongrel)
• Good replacement for RMagick needed
• Lack of documentation
The future of JRuby (at TW)
• Continue looking at products around JRuby
• JRubyWorks
  - Alleviate current problems with GoldSpike
• ActiveHibernate?
• Performance
• Other neat things
Resources
• www.jruby.org
• studios.thoughtworks.com
• waffle.codehaus.org
• jruby-extras.rubyforge.org
• ola-bini.blogspot.com
• JRuby mailing lists at Codehaus
Shameless plug
24 September ‘07
Q&A

More Related Content

What's hot

"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia "What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia Vladimir Ivanov
 
Webcast Net-OSLC-CM
Webcast Net-OSLC-CMWebcast Net-OSLC-CM
Webcast Net-OSLC-CM
Stephanie Ouillon
 
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
jaxLondonConference
 
OSLC-CM connector in SD
OSLC-CM connector in SDOSLC-CM connector in SD
OSLC-CM connector in SD
Stephanie Ouillon
 
ICON UK '13 - Apache Software: The FREE Java toolbox you didn't know you had !!
ICON UK '13 - Apache Software: The FREE Java toolbox you didn't know you had !!ICON UK '13 - Apache Software: The FREE Java toolbox you didn't know you had !!
ICON UK '13 - Apache Software: The FREE Java toolbox you didn't know you had !!
panagenda
 
Ratpack
RatpackRatpack
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...elliando dias
 
JVM++: The Graal VM
JVM++: The Graal VMJVM++: The Graal VM
JVM++: The Graal VM
Martin Toshev
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 NotesRoss Lawley
 
Stream, stream, stream: Different streaming methods with Spark and Kafka
Stream, stream, stream: Different streaming methods with Spark and KafkaStream, stream, stream: Different streaming methods with Spark and Kafka
Stream, stream, stream: Different streaming methods with Spark and Kafka
Itai Yaffe
 

What's hot (10)

"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia "What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
"What's New in HotSpot JVM 8" @ JPoint 2014, Moscow, Russia
 
Webcast Net-OSLC-CM
Webcast Net-OSLC-CMWebcast Net-OSLC-CM
Webcast Net-OSLC-CM
 
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
 
OSLC-CM connector in SD
OSLC-CM connector in SDOSLC-CM connector in SD
OSLC-CM connector in SD
 
ICON UK '13 - Apache Software: The FREE Java toolbox you didn't know you had !!
ICON UK '13 - Apache Software: The FREE Java toolbox you didn't know you had !!ICON UK '13 - Apache Software: The FREE Java toolbox you didn't know you had !!
ICON UK '13 - Apache Software: The FREE Java toolbox you didn't know you had !!
 
Ratpack
RatpackRatpack
Ratpack
 
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
 
JVM++: The Graal VM
JVM++: The Graal VMJVM++: The Graal VM
JVM++: The Graal VM
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 Notes
 
Stream, stream, stream: Different streaming methods with Spark and Kafka
Stream, stream, stream: Different streaming methods with Spark and KafkaStream, stream, stream: Different streaming methods with Spark and Kafka
Stream, stream, stream: Different streaming methods with Spark and Kafka
 

Viewers also liked

Box.net
Box.netBox.net
Box.net
informaticavp
 
Boa Viagem
Boa ViagemBoa Viagem
Boa Viagem
lgrmattos50
 
Fazer amor
Fazer amorFazer amor
Fazer amor
lgrmattos50
 
Why the Plan Doesn’t Hold: A Study of Situated Planning, Articulation and Coo...
Why the Plan Doesn’t Hold: A Study of Situated Planning, Articulation and Coo...Why the Plan Doesn’t Hold: A Study of Situated Planning, Articulation and Coo...
Why the Plan Doesn’t Hold: A Study of Situated Planning, Articulation and Coo...Jakob Bardram
 
Speech Upward Slope
Speech   Upward SlopeSpeech   Upward Slope
Speech Upward Slopeguest6850dd
 
La Tercera Edad
La Tercera EdadLa Tercera Edad
La Tercera EdadHJTandil66
 
CSCW 2011 Talk on "Activity Analysis"
CSCW 2011 Talk on "Activity Analysis"CSCW 2011 Talk on "Activity Analysis"
CSCW 2011 Talk on "Activity Analysis"
Jakob Bardram
 
Chistines Galleguisimos
Chistines GalleguisimosChistines Galleguisimos
Chistines GalleguisimosHJTandil66
 
Clase 9 F Y P
Clase 9  F Y PClase 9  F Y P
Clase 9 F Y P
salomonaquino
 

Viewers also liked (13)

Box.net
Box.netBox.net
Box.net
 
Boa Viagem
Boa ViagemBoa Viagem
Boa Viagem
 
Fazer amor
Fazer amorFazer amor
Fazer amor
 
Why the Plan Doesn’t Hold: A Study of Situated Planning, Articulation and Coo...
Why the Plan Doesn’t Hold: A Study of Situated Planning, Articulation and Coo...Why the Plan Doesn’t Hold: A Study of Situated Planning, Articulation and Coo...
Why the Plan Doesn’t Hold: A Study of Situated Planning, Articulation and Coo...
 
Speech Upward Slope
Speech   Upward SlopeSpeech   Upward Slope
Speech Upward Slope
 
La Tercera Edad
La Tercera EdadLa Tercera Edad
La Tercera Edad
 
Vs
VsVs
Vs
 
Diosychavez
DiosychavezDiosychavez
Diosychavez
 
cars
carscars
cars
 
Tequila y sal
Tequila y salTequila y sal
Tequila y sal
 
CSCW 2011 Talk on "Activity Analysis"
CSCW 2011 Talk on "Activity Analysis"CSCW 2011 Talk on "Activity Analysis"
CSCW 2011 Talk on "Activity Analysis"
 
Chistines Galleguisimos
Chistines GalleguisimosChistines Galleguisimos
Chistines Galleguisimos
 
Clase 9 F Y P
Clase 9  F Y PClase 9  F Y P
Clase 9 F Y P
 

Similar to re7olabini

CSA on Rails: a practical case-study
CSA on Rails: a practical case-studyCSA on Rails: a practical case-study
CSA on Rails: a practical case-study
calamitas
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro Merb
Paul Pajo
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro MerbPaul Pajo
 
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
Charles Nutter
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
Real World Technologies
Real World TechnologiesReal World Technologies
Real World Technologies
José Maria Silveira Neto
 
J Ruby Power On The Jvm
J Ruby Power On The JvmJ Ruby Power On The Jvm
J Ruby Power On The JvmQConLondon2008
 
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf....NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
Karel Zikmund
 
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 Jvmdeimos
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdf
ssusercd195b
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
 
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJSSSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJS
Eugene Lazutkin
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deploymentAbhishek Singh
 
It's a Jungle Out There – IoT and MRuby
It's a Jungle Out There – IoT and MRubyIt's a Jungle Out There – IoT and MRuby
It's a Jungle Out There – IoT and MRuby
matustomlein
 
From java-to-ruby-book-summary
From java-to-ruby-book-summaryFrom java-to-ruby-book-summary
From java-to-ruby-book-summary
120bi
 
BDM37: Hadoop in production – the war stories by Nikolaï Grigoriev, Principal...
BDM37: Hadoop in production – the war stories by Nikolaï Grigoriev, Principal...BDM37: Hadoop in production – the war stories by Nikolaï Grigoriev, Principal...
BDM37: Hadoop in production – the war stories by Nikolaï Grigoriev, Principal...
Big Data Montreal
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
peter_marklund
 
EDB Postgres with Containers
EDB Postgres with ContainersEDB Postgres with Containers
EDB Postgres with Containers
EDB
 
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
InfinIT - Innovationsnetværket for it
 

Similar to re7olabini (20)

CSA on Rails: a practical case-study
CSA on Rails: a practical case-studyCSA on Rails: a practical case-study
CSA on Rails: a practical case-study
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro Merb
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro Merb
 
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
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Real World Technologies
Real World TechnologiesReal World Technologies
Real World Technologies
 
J Ruby Power On The Jvm
J Ruby Power On The JvmJ Ruby Power On The Jvm
J Ruby Power On The Jvm
 
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf....NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
 
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
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdf
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
 
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJSSSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJS
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deployment
 
L R U G - JRuby
L R U G - JRubyL R U G - JRuby
L R U G - JRuby
 
It's a Jungle Out There – IoT and MRuby
It's a Jungle Out There – IoT and MRubyIt's a Jungle Out There – IoT and MRuby
It's a Jungle Out There – IoT and MRuby
 
From java-to-ruby-book-summary
From java-to-ruby-book-summaryFrom java-to-ruby-book-summary
From java-to-ruby-book-summary
 
BDM37: Hadoop in production – the war stories by Nikolaï Grigoriev, Principal...
BDM37: Hadoop in production – the war stories by Nikolaï Grigoriev, Principal...BDM37: Hadoop in production – the war stories by Nikolaï Grigoriev, Principal...
BDM37: Hadoop in production – the war stories by Nikolaï Grigoriev, Principal...
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
EDB Postgres with Containers
EDB Postgres with ContainersEDB Postgres with Containers
EDB Postgres with Containers
 
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...Towards "write once - run whenever possible" with Safety Critical Java af Ben...
Towards "write once - run whenever possible" with Safety Critical Java af Ben...
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 

re7olabini

  • 1. JRuby at ThoughtWorks Ola Bini JRuby Core Developer obini@thoughtworks.com
  • 2. About me • Ola Bini • From Gothenburg, Sweden • Works for ThoughtWorks Studios in London • Programming language geek (LISP, Io, Erlang, ML, Smalltalk, etc)
  • 3. ThoughtWorks • Global consulting firm • About 900 people worldwide (UK, US, Canada, Oz, India, China) • Known for Agile practices • Martin Fowler is our Chief Scientist • 40% projected revenue in the US from Ruby/Rails
  • 4. ThoughtWorks Studios • Product development • CruiseControl Enterprise • Mingle • RubyWorks - CruiseControl.rb - Production stack - JRuby
  • 5. Agenda • Problems with Ruby • JRuby • Mingle • Other uses • Current problems • Q&A
  • 6. What’s wrong with MRI • Ruby 1.8: Green threading - Can’t scale across processors/cores - C libraries won’t/can’t yield to Ruby code (DNS) - One-size-fits-all scheduler - doesn’t really fit all • Ruby 1.9: Native, non-parallel threads - Core classes and extensions not ready for parallel execution - Lots of work to ensure thread safety
  • 7. What’s wrong with MRI • Ruby 1.8: Partial Unicode - Internet-connected apps MUST have solid Unicode - Ruby provides partial, inconsistent support - App developers must roll their own: Rails Multibyte • Ruby 1.9: Full Unicode but drastic changes - String interface changes to per-char, not per-byte - Each String can have it’s own encoding
  • 8. What’s wrong with MRI • Ruby 1.8: Slower than most languages - 1.8 is usually called “fast enough” - ... but routinely finishes last in benchmarks - ... and no plans to improve the situation in 1.8 • Ruby 1.9: Improvement, but still more to do - New engine averages 3-4x improvement - Only AOT - No JIT - More to do: GC and threading still slow
  • 9. What’s wrong with MRI • Ruby 1.8: Memory management - Simple design - Good for many apps, but doesn’t scale - Stop-the-world GC • Ruby 1.9: No change - Improved performance => more garbage - GC problems could well multiply
  • 10. What’s wrong with MRI • Ruby 1.8: C language extensions - C is difficult to write well - No encapsulation in core - Threading, GC issues - Portable, but often needs recompilation - No security restrictions • Ruby 1.9: No change
  • 11. What’s wrong with MRI • Politics - You want me to switch to what? - ... and it needs servers/software/training? - This will probably improve with time • Legacy - Lots of Java apps in the world - Extensive library of Java frameworks/libraries
  • 12. What is JRuby • Java implementation of the Ruby language • Current version 1.0.1, released in August • Based on Ruby 1.8.5 • Started in 2001 by Jan-Arne Petersen • Currently 6 Core developers • Open Source - about 30-40 contributors
  • 13. What can it do? • All “pure Ruby” code works (with some caveats) • Rake and RubyGems run well • Rails works near nigh perfectly • Many projects using JRuby+RSpec • New combinations of JRuby+X popping up
  • 14. What can’t it do? • Deterministic threading • Continuations • Some file system operations • fork, and other POSIX-ilk
  • 15. JRuby solutions to MRI problems • Native threading • Scale across all processors/cores • Concurrent execution, even in extensions • Allow systems to schedule threads • Ensure reasonable safety in core classes
  • 16. JRuby solutions to MRI problems • World-class, native Unicode support • Provide Ruby’s byte[]-based String • ... but also provide native Rails Multibyte backend • ... and you can use the Java UTF-16 Strings directly • ... and we’re working at implementing 1.9 Strings • Java has complete, reliable Unicode • ... and all libraries are Unicode-ready
  • 17. JRuby solutions to MRI problems • Scalable performance • Make interpreter as fast as possible - Should be as fast as Ruby 1.8 • Support Ruby 1.9/2.0 bytecode engine - Same resulting performance boost - Future-proof • Each new version of Java improves JRuby performance substantially
  • 18. JRuby solutions to MRI problems • Compile to Java bytecodes • AOT and JIT compilation • Let HotSpot take over - ... by simplifying - HotSpot JIT - Code inlining - Dynamic optimizations
  • 19. JRuby solutions to MRI problems • Let Java manage memory • Best memory management and GC in the world • Wide variety of GC options - Concurrent - Generational - Real-time • Scales up to enormous apps and systems
  • 20. JRuby solutions to MRI problems • Java-based extensions • Easier to write than C • Truly portable: WORA • Clean separation between core and extensions • No GC, threading or security issues • Easier to expose Java libraries
  • 21. JRuby solutions to MRI problems • Politics don’t get in the way - JRuby is “just another Java library” - Minimal impact dev, admin processes - Over ten years of mainstream Java • Legacy integrates just fine - Use existing services and libraries
  • 22. Why ThoughtWorks likes JRuby • JRuby gives access to the “enterprise” features of Java • Conservative environments will not use MRI • Quick integration with legacy systems • Cost: Java+Ruby is more cost effective than MRI
  • 23. Why JRuby on Rails for TW? • Deployment, deployment, deployment • JDBC for database access • Other libraries that provide needed, cross-platform functionality (Java2D instead of RMagick?) • Management (JMX and others) • Common to do JRuby on Rails applications that work with legacy data
  • 24. Mingle • Team Collaboration Tool • First commercial JRuby on Rails application • Originally choose JRuby for SVN plugin • Originally developed in MRI - still MRI compatible • Very well tested • Mingle test suite is slower in JRuby than MRI • ... but in production the JRuby version is quicker and scales better
  • 25. Mingle stats • +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+ | Controllers | 2809 | 2377 | 32 | 276 | 8 | 6 | | Helpers | 1255 | 1038 | 8 | 138 | 17 | 5 | | Models | 11203 | 9079 | 176 | 1564 | 8 | 3 | | Libraries | 4784 | 3919 | 88 | 383 | 4 | 8 | | Integration tests | 0 | 0 | 0 | 0 | 0 | 0 | | Functional tests | 3494 | 2881 | 27 | 337 | 12 | 6 | | Unit tests | 16109 | 13272 | 105 | 1449 | 13 | 7 | | Acceptance tests | 13318 | 10689 | 87 | 1100 | 12 | 7 | +----------------------+-------+-------+---------+---------+-----+-------+ | Total | 52972 | 43255 | 523 | 5247 | 10 | 6 | +----------------------+-------+-------+---------+---------+-----+-------+ Code LOC: 16413 Test LOC: 26842 Code to Test Ratio: 1:1.6
  • 26. Mingle license decryption • Licenses uses strong cryptography • Using a Java RSA library • Would have been very hard in MRI • JRuby Java integration made it dead simple to use the RSA library
  • 27. Obfuscation • Override JRuby’s LoadService • This allows us to encrypt/decrypt all Ruby files in app/* • Will probably move to using AOT compilation when that is finished • This is obfuscation - there is no real, safe protection in it • ... but it seems to work well enough. =)
  • 28. Mingle + ChartDirector • ChartDirector is a proprietary library for making charts • Have both a Java library and a C extension library for Ruby • A thin wrapper over the Java library makes it possible to use the same chart code in MRI and JRuby
  • 30. Mingle + SVNkit • No MRI subversion library worked on all platforms • Initial reason for going with JRuby • SVNkit is a Java library that provides uniform subversion access on Linux, MacOS X, Windows, Solaris, and all other Java platforms • SVNkit supports file system, DAV and SVN
  • 31. Mingle deployment • install4j - installation and bundling of JVM • Runs locally using Jetty • BYO database - (used to be Derby) • 1.1 or 1.2 will support WAR deployment • Uses custom built Jetty launching • Uses custom built AntBuilder scripts to generate WAR • Uses CC.rb for MRI and Java CC for JRuby
  • 32. Finance client 1 • Conservative, large company • IS department standardized on Java • JRuby on Rails application • JRuby improves integration • Uses the UnitRecord plugin to speed-up test suites • Lack of good RMagick replacement have been hard • Tomcat+Lucene seems to be causing bugs
  • 33. Finance client 2 • Large, conservative company • Separate business units: most information is not shared • Project aims to consolidate all accounts and customer information into one place • It’s written in mainly Ruby with small amounts of Java • 2 persons, probably 4 months from start to finish • Interacting with 5 disparate data sources
  • 34. Finance client 2 - why JRuby? • Infrastructure barrier was primary reason - “ Those infrastructure guys are just seeing another Java app with some static textual content (happens to be Ruby source files)” • Higher business value by directly lowering integration estimates • Using Java APIs (especially JDBC) allowed quicker development, since no need to write new functionality for Ruby
  • 35. Waffle • Java web framework • No XML - except minimal web.xml • Easy to learn • No base classes/interfaces needed • Allows most functionality to work with Ruby • ... ERb templates can be used as views • Ruby classes as controllers
  • 36. Forthcoming Studios projects • Other tools for development/team collaboration • Will use JRuby in different ways • ... including allow Ruby to be used as extension language for Java based applications • ... and improving the deployment and management story for JRuby • Next product will probably be GA in Jan/Feb ‘08
  • 37. Challenges with JRuby • Performance of unit tests - Solution: running MRI precommit and JRuby in CI - Solution: using UnitRecord instead • It’s not free to run on both MRI and JRuby • Start-up time (especially of Rails) - Solution: staged start-up in background - Not always enough for day-to-day development use
  • 38. Challenges with JRuby • JRuby regular expressions have different performance characteristics and big-O running time in certain cases • JRuby YAML isn’t completely stable yet (but it’s getting there) • High memory consumption (but still lower than Mongrel) • Good replacement for RMagick needed • Lack of documentation
  • 39. The future of JRuby (at TW) • Continue looking at products around JRuby • JRubyWorks - Alleviate current problems with GoldSpike • ActiveHibernate? • Performance • Other neat things
  • 40. Resources • www.jruby.org • studios.thoughtworks.com • waffle.codehaus.org • jruby-extras.rubyforge.org • ola-bini.blogspot.com • JRuby mailing lists at Codehaus
  • 42. Q&A