Introduction to JRuby

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Introduction to JRuby - Presentation Transcript

    1. JRuby http://www.jruby.org Amit Solanki http://vinsol.com amit@vinsol.com
    2. Problems with Ruby • Green threading • No scaling across processors • Partial Unicode support • Internet connected application needs solid unicode support • No native support for unicode or multibyte string • Rails 1.2 introduced ActiveSupport:Multibyte • Performance • Interpreted not compiled • Ruby considered “fast enough” • ... but routinely finishes last in benchmark • ... and no work being done in 1.8 to improve
    3. Features missing from Java • Closures • Open classes and metaprogramming • Array, Hash, Regexp literals • Duck-typing
    4. Introduction to JRuby • 100% pure java implementation of ruby • current version 1.1 RC 1 • based on ruby 1.8.6 (MRI) • Originally created by Jan Arne Petersen, in 2001 • direct port of ruby 1.6 C code • Developed by JRuby Team • 6 core developers right now • open source developers • full support from Sun Microsystems
    5. Features • Running on JVM provides • Native threads • Unicode Support • Portability • Most builtin ruby classes provided • Wide variety of GC options • Concurrent • Generational • Real-time • Scalability with native threading (Ruby Thread <=> Java Thread) • assign work to multiple processors • better performance at I/O & context-switching operations
    6. Features (contd...) • Support with interacting with and defining java classes from within ruby • full two way access between the two • Interpreted, compiled and mixed mode Bean Scripting Framework (BSF) support • Distributed under tri-license (CPL/GPL/ LGPL) • Support for rubygems, mongrel and (J)Ruby on Rails • Domain Specific Language (DSL)
    7. JRuby Compiler • Ahead Of Time (AOT) • compile .rb file to .class file • directly executable, or require/loadable • Just In Time (JIT) • heavily hit methods compiled at runtime • run existing applications, scripts without modification • optimize methods generated at runtime • Incremental design • fall back on interpreter for unimplemented bits
    8. Demo
    9. Example hello_world.rb
    10. Example testJava.rb
    11. Example bench_fib_recursive.rb
    12. Comparison: JRuby vs Ruby
    13. Performance & Stability • JRuby 1.1 - fastest way to run Ruby 1.8 & Rails • Better garbage collection mechanism • Dynamic optimization • Mix-mode virtual machine: compiled JRuby • JRuby Compiler • Mode: • Interpret • Just-in-time (JIT) • Ahead-of-time (AOT)
    14. Use Cases • Scripting • JVM too long to start • console clunky when jruby and ruby used together • Client-side application • app runs long enough • swings getting pretty fast • Server-side application • server JVM optimizes app at runtime • lots of great servers: Glassfish, JBoss, Oracle, Tomcat, Jetty ... • great monitoring tools • deployment via WAR file
    15. Downsides • Slow development • Not enough documentation • Missing POSIX methods • filesytem support (symlinks, stats, chmod, chown) • process control • JNA library + JRuby = True POSIX • Database support • ActiveRecord-JDBC still needs more work • Rmagick support is in progress • Ruby C extensions, system calls • Does not support continuations/binding
    16. Core Developers • Charles Oliver Nutter (Sun Microsystens) http://headius.blogspot.com • Thomas Enebo (Sun Microsystems) http://www.bloglines.com/blog/ThomasEEnebo/ • Nick Sieger (Sun Microsystems) http://blog.nicksieger.com/ • Ola Bini(Thoughtworks) http://ola-bini.blogspot.com/ • Marcin Mielzynski • Bill Dortch
    17. Live Implementions • Media Cast - A media file hosting application http://mediacast.sun.com/ • Sonar - A free enterprise quality control tool for Java projects http://sonar.hortis.ch/ • Mingle - A project collaboration and management tool for Agile software development (Webserver: Jetty & DB Server: Derby) http://studios.thoughtworks.com/mingle-project-intelligence • SpringBook - Web application to publish your springnote to website http://springbook.playmaru.net/?lang=en • Openwferu - Open source ruby workflow and BPM engine http://openwferu.rubyforge.org/aq.html • Oracle Mix https://mix.oracle.com/
    18. Thank You (-:

    + Amit SolankiAmit Solanki, 2 years ago

    custom

    905 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 905
      • 905 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 19
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags