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.

Like this presentation? Why not share!

RubyConf Uruguay 2010 - JRuby

on

  • 4,313 views

 

Statistics

Views

Total Views
4,313
Views on SlideShare
4,286
Embed Views
27

Actions

Likes
10
Downloads
60
Comments
0

1 Embed 27

http://lanyrd.com 27

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

RubyConf Uruguay 2010  - JRuby RubyConf Uruguay 2010 - JRuby Presentation Transcript

  • JRuby The Best of Both Worlds
  • Me • Charles Oliver Nutter • JRuby Architect at Engine Yard • Java developer since 1997 • JRuby developer since 2005 • @headius, headius@headius.com
  • JRuby • Ruby on JVM • Latest release: 1.5.3 • Ruby 1.8.7 compat, 1.9.2 coming • It’s Just Ruby! • (It’s Not Just Ruby!)
  • If you... ...want or need to run on JVM... ...JRuby is the answer!
  • If you... ...need to use a Java library... ...JRuby is the answer!
  • If you... ...want the best GC(s) in the world... ...JRuby is the answer!
  • If you... ...hate dealing with native libraries... ...JRuby is the answer!
  • If you... ...need to develop or deploy on Windows... ...JRuby is the answer!
  • If you... ...need to develop or deploy on zLinux... ...JRuby is the answer!
  • If you... ...need to develop or deploy on AS/400... ...JRuby is the answer!
  • If you... ...need to develop or deploy on OpenVMS... ...JRuby is the answer!
  • If you... ...want to build Android apps in Ruby... ...JRuby is the answer!
  • If you... ...want to integrate with other languages like Clojure, Scala, Mirah... ...JRuby is the answer!
  • Boring Stuff • Trivial install: unpack, run (only prereq: Java) • Performance is great, ~1.9 • Rails etc run great • Production users since 2007 • Most mature, most stable alternative Ruby
  • Installation • Step 1: unpack JRuby
  • Installation • Java (easy on any platform) • Download, unpack JRuby • Or use rvm, pik, apt-get, yum, etc • Add bin/ to PATH • Done!
  • Installation (alternative) • Download an IDE • NetBeans • Eclipse (RadRails) • IntelliJ (main product or RubyMine)
  • Cool Stuff • Java/JVM integration • Deployment • Native threads (real concurrency!) • Tooling and maturity • New frontiers
  • Platform Integration • Use any Java library like it’s a Ruby library • No-compile, single-file deployments • Cross-platform GUI libraries
  • Fun With JRuby
  • Deployment • Typical Ruby servers work • Thin, Mongrel • GlassFish, Trinidad, Aspen, Jetty-Rails, ... • Java WAR file deployment • Any Java app server can run Rails!
  • Rails in a WAR File ~/projects/jruby/testapp ➔ gem install warbler Successfully installed warbler-1.2.1 1 gem installed Installing ri documentation for warbler-1.2.1... Installing RDoc documentation for warbler-1.2.1... ~/projects/jruby/testapp ➔ warble rm -f testapp.war Creating testapp.war ~/projects/jruby/testapp ➔ ls -l testapp.war -rw-r--r-- 1 headius staff 17812893 Oct 30 13:08 testapp.war
  • Command-line Server ~/projects/jruby/testapp ➔ gem install trinidad Successfully installed trinidad_jars-0.3.2 Successfully installed jruby-rack-1.0.3 Successfully installed trinidad-0.9.12 3 gems installed Installing ri documentation for trinidad_jars-0.3.2... Installing ri documentation for jruby-rack-1.0.3... Installing ri documentation for trinidad-0.9.12... Installing RDoc documentation for trinidad_jars-0.3.2... Installing RDoc documentation for jruby-rack-1.0.3... Installing RDoc documentation for trinidad-0.9.12...
  • Command-line Server ~/projects/jruby/testapp ➔ trinidad -e production Oct 30, 2010 1:15:26 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-3000 Oct 30, 2010 1:15:26 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Tomcat Oct 30, 2010 1:15:26 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.2 Oct 30, 2010 1:15:26 PM org.apache.catalina.startup.ContextConfig webConfig INFO: No global web.xml found Oct 30, 2010 1:15:28 PM org.apache.catalina.core.ApplicationContext log INFO: Info: using runtime pool timeout of 30 seconds Oct 30, 2010 1:15:28 PM org.apache.catalina.core.ApplicationContext log INFO: Info: received min runtimes = 1 Oct 30, 2010 1:15:28 PM org.apache.catalina.core.ApplicationContext log INFO: Info: received max runtimes = 5 Oct 30, 2010 1:15:36 PM org.apache.catalina.core.ApplicationContext log INFO: Info: add application to the pool. size now = 1 Oct 30, 2010 1:15:36 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-3000
  • Native Threads • Ruby Thread :: Native Thread • Thread.new # real system-level thread • One process can saturate all cores • One Rails instance for a whole site
  • Threadsafe Mode ~/projects/jruby/testapp ➔ trinidad -e production --threadsafe Oct 30, 2010 1:17:05 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-3000 Oct 30, 2010 1:17:05 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Tomcat Oct 30, 2010 1:17:05 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.2 Oct 30, 2010 1:17:05 PM org.apache.catalina.startup.ContextConfig webConfig INFO: No global web.xml found Oct 30, 2010 1:17:15 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-3000 No pool of JRuby runtimes!
  • A “Slow” Action class TestController < ApplicationController def slow # simulate a blocking call sleep 1 render :text => 'All done!' end end
  • No Concurrent Requests ~ ➔ ab -n 50 http://localhost:3000/test/slow This is ApacheBench, Version 2.3 <$Revision: 655654 $> ... Requests per second: 0.96 [#/sec] (mean) Time per request: 1037.188 [ms] (mean) Time per request: 1037.188 [ms] (mean, across all concurrent requests) Transfer rate: 0.30 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 0 Processing: 1005 1037 116.3 1008 1705 Waiting: 1005 1037 116.2 1008 1705 Total: 1006 1037 116.3 1008 1705 ...
  • 5 Concurrent Requests ~ ➔ ab -c 5 -n 50 http://localhost:3000/test/slow This is ApacheBench, Version 2.3 <$Revision: 655654 $> ... Requests per second: 4.95 [#/sec] (mean) Time per request: 1010.680 [ms] (mean) Time per request: 202.136 [ms] (mean, across all concurrent requests) Transfer rate: 1.54 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 1 Processing: 1005 1010 5.6 1007 1029 Waiting: 1004 1009 5.5 1007 1029 Total: 1005 1010 5.6 1007 1029
  • Tooling and Maturity • Editor/IDE support with bonuses • Debugging tools • Profiling, memory tools • Commercial JVM environments • Richest tools of any Ruby
  • VisualVM
  • CPU Monitor
  • Heap Monitor
  • Heap Dump
  • CPU/Memory Profiling Live results!
  • New Frontiers • Google AppEngine • Java or Python only (...or JRuby!) • Android • “Java”-mostly (...or JRuby!) • Anywhere with a Java server • Deploy like any other application
  • Ruboto!
  • Ruboto: Ruby for Android • Ruboto IRB • ruboto-core • Ruby Summer of Code • Daniel Jackoway • App generator, utilities • More to come, you can help!
  • ruboto-core gem ~/projects ➔ gem install ruboto-core Successfully installed ruboto-core-0.0.2 1 gem installed Installing ri documentation for ruboto-core-0.0.2... Installing RDoc documentation for ruboto-core-0.0.2...
  • Generate App ~/projects ➔ ruboto gen app --name RubyConfUY --target android-8 -- package org.headius.demo.rubyconfuy --activity RubyConfUY --path rubyconfuy_demo Generating Android app RubyConfUY in /Users/headius/projects/ ruboto-core/rubyconfuy_demo...Done Copying files: Rakefile...Done .gitignore...Done assets...Done JRuby jars...Done Ruboto java classes...Done Adding RubotoActivity and RubotoDialog to the manifest...Done Setting the package name in ruboto.rb...Done Generating the default Activity and script...Done Hello, RubyConfUY
  • Build App ~/projects ➔ cd rubyconfuy_demo/ ~/projects/rubyconfuy_demo ➔ rake (in /Users/headius/projects/rubyconfuy_demo) Android SDK Tools Revision 6 Project Target: Android 2.2 API level: 8 WARNING: No minSdkVersion value set. Application will install on all Android versions. Importing rules file: platforms/android-8/ant/ant_rules_r2.xml mkdir -p generated_libs ...
  • Deploy App ~/projects/rubyconfuy_demo ➔ adb install -r bin/RubyConfUY-debug.apk 788 KB/s (2718474 bytes in 3.367s) pkg: /data/local/tmp/RubyConfUY-debug.apk Success
  • Ruboto
  • Your Turn • Just try it! • Tell everyone • Let us know what you need
  • JRuby Book!
  • For The Managers • Three fulltime devs at Engine Yard • Support, professional services • And OSS-style IRC/email support • Engine Yard Cloud (soon!) • Well-established, mature, stable • Enterprise-ready!
  • Production Users • Oslo Airport refueling terminals • LinkedIn’s “Signal” social aggregator • BankSimple • Oracle Mix, Kenai • Thoughtworks • Github FI (Firewall Install)
  • More? • Madness: 3D game in JRuby • Redcar: JRuby-based textmate clone
  • JRubyMonkeyEngine • JRuby wrapper around JMonkeyEngine • 3D scenegraph and physics engine • Write 3D games entirely in Ruby • Deploy on multiple platforms • No recompile...just ship the JME libs!
  • Madness!
  • Redcar • Clone of textmate using JRuby + SWT • Almost entirely Ruby • Easy to hack, improve • gem install redcar • sudo redcar install
  • Redcar
  • Thanks! • http://jruby.org • http://wiki.jruby.org • http://bugs.jruby.org • http://engineyard.com/jruby • http://blog.headius.com