SlideShare una empresa de Scribd logo
1 de 42
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

"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
 
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
 
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
 
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
 
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 KafkaItai Yaffe
 

La actualidad más candente (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
 

Destacado

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
 

Destacado (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 a 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-studycalamitas
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro MerbPaul 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 2016Charles Nutter
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
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.pdfssusercd195b
 
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 - LinagoraLINAGORA
 
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJSSSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJSEugene 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 MRubymatustomlein
 
From java-to-ruby-book-summary
From java-to-ruby-book-summaryFrom java-to-ruby-book-summary
From java-to-ruby-book-summary120bi
 
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 Coursepeter_marklund
 
EDB Postgres with Containers
EDB Postgres with ContainersEDB Postgres with Containers
EDB Postgres with ContainersEDB
 
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 a 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...
 

Último

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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 textsMaria Levchenko
 
[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.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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 BusinessPixlogix Infotech
 
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 SolutionsEnterprise Knowledge
 
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 MenDelhi Call girls
 
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)wesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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 MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Último (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
[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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
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
 
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
 
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)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

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