Ram Vijapurapu
  @rvijapurapu
What is JRuby?

Its just Ruby
Running on the JVM
(Java Virtual Machine)
Conclusion




..I truly wish it is that simple.



 Image credit: http://www.flickr.com/photos/hordurk/3204191929/
Social Context
Social Context
Social Context
Why do we want to go back to the
        Haunted House again?
● Reuse what's already built
                 Enterprise Rea...
What is the first thing you hear
            about Java?




Image credit: http://bit.ly/btxcPf
Common Man! Java is Slooow
●   Maybe... Maybe not!

     ACHTUNG! Highly Unscientific Testing
Common Man! Java is Slooow


              No
              Optimizations
Common Man! Java is Slooow
             100
Common Man! Java is Slooow
             1,000
Common Man! Java is Slooow
             10,000
Common Man! Java is Slooow
             100,000
Common Man! Java is Slooow
              100,000
What's your Point?
See Java is sl0000w!
st
                      a
Common Man! Java is Slooow
                    F
            1,000,000
st
                     F a
 Common Man! Java is Slooow
                     Fast




             1,000,000
Clearly you
f...
You fudged it!
●   Maybe – but there is method in madness
You fudged it!
         Moral: Focus on your code
  ●   Maybe JVM there is care ofin madness
         & – but takes method...
What just happened?
●   Magic – JVM/Hotspot (Dark Magic?)
    ●   JIT (Just In Time Compilation) – Optimization on the
   ...
As all good things in life........
       there are few limitations
●   You cannot use libraries which use CRuby
    Exten...
Same stuff – Different Different
●   ruby                     ●   jruby
●   Irb                      ●   jirb
●   rake    ...
Show me stuff... JRuby
 integration with JVM




              Ruby'ized – by popular demand!
Choose your Hammer – Calling
   Ruby from within Java
Choose your Hammer – Calling
   Ruby from within Java




   JSR 223
Choose your Hammer – Calling
Ruby & Groovy from within Java
Choose your Hammer – Calling
Ruby & Groovy from within Java
         Why would we want to do
         this? Because we   c...
Choose your Hammer – Calling
 JRuby file from within Java
Choose your Hammer – Calling
 JRuby file from within Java
Ruby > Java
Ruby > Java & Back




     [SNIPPED]
Ruby > Java & Back
Performance & External Libraries
●   For the sake of performance it would be better
    to use Java Libraries over JRuby a...
JfreeChart – Chart Generation
●   All you need to do is either have the jars in your
    classpath
●   Or include it in yo...
JRuby & Library Jars
This guy is boring why doesn't he
       just show me rails
The Holy Blog
...
...
DB Stuff
Packaging...
Packaging & Deploying




                   config/warble.rb
Voila
In Summary
●   I strongly believe JVM should be your platform
    Strategy
    ●   This more or less comes out of my exper...
Useful Links
●   http://jruby.org/
●   http://www.infoq.com/vendorcontent/show.action?vc
●   http://code.google.com/p/appe...
Ram Vijapurapu
   @rvijapurapu
thinkbelievedo.com
Upcoming SlideShare
Loading in...5
×

JRuby - The Perfect Alternative

1,895

Published on

This presentation was first presented at The Auckland Ruby Group - http://ruby.meetup.com/96/

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,895
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

JRuby - The Perfect Alternative

  1. 1. Ram Vijapurapu @rvijapurapu
  2. 2. What is JRuby? Its just Ruby Running on the JVM (Java Virtual Machine)
  3. 3. Conclusion ..I truly wish it is that simple. Image credit: http://www.flickr.com/photos/hordurk/3204191929/
  4. 4. Social Context
  5. 5. Social Context
  6. 6. Social Context
  7. 7. Why do we want to go back to the Haunted House again? ● Reuse what's already built Enterprise Ready ● Need of a Scalable Platform ^ ● Need for an inclusive Platform – Ruby, Groovy, Python, JS, .. ● Generally Love of Engineering Genius
  8. 8. What is the first thing you hear about Java? Image credit: http://bit.ly/btxcPf
  9. 9. Common Man! Java is Slooow ● Maybe... Maybe not! ACHTUNG! Highly Unscientific Testing
  10. 10. Common Man! Java is Slooow No Optimizations
  11. 11. Common Man! Java is Slooow 100
  12. 12. Common Man! Java is Slooow 1,000
  13. 13. Common Man! Java is Slooow 10,000
  14. 14. Common Man! Java is Slooow 100,000
  15. 15. Common Man! Java is Slooow 100,000 What's your Point? See Java is sl0000w!
  16. 16. st a Common Man! Java is Slooow F 1,000,000
  17. 17. st F a Common Man! Java is Slooow Fast 1,000,000 Clearly you fudged it!
  18. 18. You fudged it! ● Maybe – but there is method in madness
  19. 19. You fudged it! Moral: Focus on your code ● Maybe JVM there is care ofin madness & – but takes method the rest – well into the future Performance Improvements in JVM from 1.5 to 1.6 have been significant. both are running i386
  20. 20. What just happened? ● Magic – JVM/Hotspot (Dark Magic?) ● JIT (Just In Time Compilation) – Optimization on the Fly ● Speaking further on this is beyond the scope of this presentation _ Summary: Normal usage on Web you will find JRuby performs same as CRuby
  21. 21. As all good things in life........ there are few limitations ● You cannot use libraries which use CRuby Extensions ● Java Threads ● Posix Methods ● Does not support continuations/bindings. (Feature Missing) http://docs.codehaus.org/display/JRUBY/Limitations
  22. 22. Same stuff – Different Different ● ruby ● jruby ● Irb ● jirb ● rake ● jruby -S rake ● gem ● jruby -S gem Include jruby-complete.jar or jruby.jar in your CLASSPATH & PATH for the executable
  23. 23. Show me stuff... JRuby integration with JVM Ruby'ized – by popular demand!
  24. 24. Choose your Hammer – Calling Ruby from within Java
  25. 25. Choose your Hammer – Calling Ruby from within Java JSR 223
  26. 26. Choose your Hammer – Calling Ruby & Groovy from within Java
  27. 27. Choose your Hammer – Calling Ruby & Groovy from within Java Why would we want to do this? Because we can
  28. 28. Choose your Hammer – Calling JRuby file from within Java
  29. 29. Choose your Hammer – Calling JRuby file from within Java
  30. 30. Ruby > Java
  31. 31. Ruby > Java & Back [SNIPPED]
  32. 32. Ruby > Java & Back
  33. 33. Performance & External Libraries ● For the sake of performance it would be better to use Java Libraries over JRuby at times. ● Totally depends on your requirement. ● Including external Java libraries within your JRuby Code is fairly straightforward ● You can also put the jar files in the rails lib directory for getting access to them in your rails application
  34. 34. JfreeChart – Chart Generation ● All you need to do is either have the jars in your classpath ● Or include it in your libs folder in rails. http://kfahlgren.com/blog/2007/04/13/jruby-jfreechart-sparklines/
  35. 35. JRuby & Library Jars
  36. 36. This guy is boring why doesn't he just show me rails
  37. 37. The Holy Blog
  38. 38. ...
  39. 39. ...
  40. 40. DB Stuff
  41. 41. Packaging...
  42. 42. Packaging & Deploying config/warble.rb
  43. 43. Voila
  44. 44. In Summary ● I strongly believe JVM should be your platform Strategy ● This more or less comes out of my experience. ● JRuby will fit into many cloud architectures with little effort (Not sure of Azure yet) – Portability from within
  45. 45. Useful Links ● http://jruby.org/ ● http://www.infoq.com/vendorcontent/show.action?vc ● http://code.google.com/p/appengine-jruby/ > http://rails-depot.appspot.com/ ● http://en.wikipedia.org/wiki/JRuby#Performance
  46. 46. Ram Vijapurapu @rvijapurapu thinkbelievedo.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×