SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
JRuby on Rails Deployment:
What They Didn't Tell You

  Nick Sieger, Staff Engineer, Sun Microsystems, Inc.

  TS-6490
Agenda

 Rails deployment background
 Mechanics of JRuby on Rails
 Preparations
 Packaging
 Post-deployment




                               2008 JavaOneSM Conference | java.com.sun/javaone |   2
The Concurrency Question

Each Rails request must execute in isolation.


 “Rails is not thread-safe? WTF?”


       “Servlets have been multi-threaded since, like,1997!”




                                          2008 JavaOneSM Conference | java.com.sun/javaone |   3
Context for Concurrency

                      Writing thread-safe code is hard

 +   Ruby's userland threads don't yield much benefit

                                 Not worth the effort


 Rails scales up by adding processes



                                        2008 JavaOneSM Conference | java.com.sun/javaone |   4
CGI/FGCI




           http://flickr.com/photos/counteragent/2190576349/




                                                   2008 JavaOneSM Conference | java.com.sun/javaone |   5
Mongrel




          http://flickr.com/photos/bugbunnybambam/2172466178/
                                                     2008 JavaOneSM Conference | java.com.sun/javaone |   6
Mongrel Model




                2008 JavaOneSM Conference | java.com.sun/javaone |   7
=                                         * 180




http://highscalability.com/scaling-twitter-making-twitter-10000-percent-faster


                                                             2008 JavaOneSM Conference | java.com.sun/javaone |   8
Instead of multiple processes...




                                   2008 JavaOneSM Conference | java.com.sun/javaone |   9
The Java Virtual Machine (JVM™):
All Ur Rails Are Belong To Us




                                2008 JavaOneSM Conference | java.com.sun/javaone |   10
Application Startup




                      2008 JavaOneSM Conference | java.com.sun/javaone |   11
Dispatching to Rails




                       2008 JavaOneSM Conference | java.com.sun/javaone |   12
Developing Your Rails Application

 TS-4806: JRuby on Rails: Web Development Evolved
 TS-5249: The NetBeans™ Ruby IDE: You Thought Rails
 Development Was Fun Before
 Both yesterday




                                       2008 JavaOneSM Conference | java.com.sun/javaone |   13
Database Connectivity
   Install the ActiveRecord Java DataBase Connectivity (JDBCTM)
   adapter gem (mysql)
$ jruby -S gem install activerecord-jdbcmysql-adapter
Successfully installed activerecord-jdbc-adapter-0.8
Successfully installed jdbc-mysql-5.0.4
Successfully installed activerecord-jdbcmysql-adapter-0.8
3 gems installed
Installing ri documentation for activerecord-jdbc-adapter-0.8...
Installing ri documentation for jdbc-mysql-5.0.4...
Installing ri documentation for activerecord-jdbcmysql-adapter-
0.8...
Installing RDoc documentation for activerecord-jdbc-adapter-0.8...
Installing RDoc documentation for jdbc-mysql-5.0.4...
Installing RDoc documentation for activerecord-jdbcmysql-adapter-
0.8...




                                             2008 JavaOneSM Conference | java.com.sun/javaone |   14
Configure the Database

# config/database.yml
<% jdbc = defined?(JRUBY_VERSION) ? 'jdbc' : '' %>
development:
  adapter: <%= jdbc %>mysql
  encoding: utf8
  database: testapp_development
  username: root
  password:
  socket: /tmp/mysql.sock

# same for test/production...




                                 2008 JavaOneSM Conference | java.com.sun/javaone |   15
Examine dependencies

 Gems and libraries with native code == FAIL on JRuby
 Look for replacements/equivalents:
  • Mongrel, Hpricot OK
  • RMagick, ImageScience => ImageVoodoo
  • OpenSSL => JRuby-OpenSSL gem
  • Ruby/LDAP => JRuby/LDap
  • json => json_pure




                                         2008 JavaOneSM Conference | java.com.sun/javaone |   16
Try It!
$ jruby -S gem install mongrel
Successfully installed mongrel-1.1.3-java
1 gem installed
Installing ri documentation for mongrel-1.1.3-java...
Installing RDoc documentation for mongrel-1.1.3-java...
$ jruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
** Rails signals registered. HUP => reload (without restart). It might not work
well.
** Mongrel 1.1.3 available at 0.0.0.0:3000
** Use CTRL-C to stop.




                                                    2008 JavaOneSM Conference | java.com.sun/javaone |   17
Application Layout (Rails)




                             2008 JavaOneSM Conference | java.com.sun/javaone |   18
Application Layout (WAR)




                           2008 JavaOneSM Conference | java.com.sun/javaone |   19
Using Warbler

 Installed as a gem (jruby -S gem install warbler)
 JRuby and servlet adapter bits included
 Automates war configuration




                                     2008 JavaOneSM Conference | java.com.sun/javaone |   20
Installing Warbler as a Plugin

$ jruby -S warble pluginize
/Users/nicksieger/Projects/jruby/trunk/jruby/bin/jruby -S gem unpack warbler
Unpacked gem: '/Users/nicksieger/Projects/rails/testapp/vendor/plugins/warbler-
0.9.5'
$ jruby -S rake -T | grep war
rake war                             # Create testapp.war
rake war:app                         # Copy all application files into the ...
rake war:clean                       # Clean up the .war file and the stagi...
rake war:gems                        # Unpack all gems into WEB-INF/gems
rake war:jar                         # Run the jar command to create the .war
rake war:java_classes                # Copy java classes into the .war
rake war:java_libs                   # Copy all java libraries into the .war
rake war:public                      # Copy all public HTML files to the ro...
rake war:webxml                      # Generate a web.xml file for the webapp




                                                      2008 JavaOneSM Conference | java.com.sun/javaone |   21
Configuring Warbler

 Generate config file
  • jruby -S warble config -or-
  • jruby script/generate warble
  • => config/warble.rb
 # Warbler web application assembly configuration file
 Warbler::Config.new do |config|
   # ...

   # Gems to be packaged in the webapp. ...
   config.gems += [quot;activerecord-jdbcmysql-adapterquot;,
     quot;jruby-opensslquot;]
   config.gems[quot;railsquot;] = quot;2.0.2quot;

   # ...
 end


                                          2008 JavaOneSM Conference | java.com.sun/javaone |   22
Runtime Pool Size

 config/warble.rb:


  Warbler::Config.new do |config|
    # ...

    # Control the pool of Rails runtimes
    config.webxml.jruby.min.runtimes = 2
    config.webxml.jruby.max.runtimes = 4
  end




                                2008 JavaOneSM Conference | java.com.sun/javaone |   23
Logging
if defined?(JRUBY_VERSION) && defined?($servlet_context)
  # Logger expects an object that responds to #write and #close
  device = Object.new
  def device.write(message)
    $servlet_context.log(message)
  end
  def device.close; end

  # Make these accessible to wire in the log device
  class << RAILS_DEFAULT_LOGGER
    public :instance_variable_get, :instance_variable_set
  end

  old_device = RAILS_DEFAULT_LOGGER.instance_variable_get quot;@logquot;
  old_device.close rescue nil
  RAILS_DEFAULT_LOGGER.instance_variable_set quot;@logquot;, device
end




                                              2008 JavaOneSM Conference | java.com.sun/javaone |   24
Session handling

   Rails sessions != Servlet sessions
config.action_controller.session_store = :java_servlet_store

# ...

class   CGI::Session::JavaServletStore
  def   initialize(session, options) end
  def   restore; end
  def   update; end
  def   close; end
end




                                           2008 JavaOneSM Conference | java.com.sun/javaone |   25
Database: JNDI

 production:
   adapter: <%= jdbc %>mysql
   jndi: jdbc/testapp_production
   encoding: utf8
   database: testapp_production
   username: root
   password:
   socket: /tmp/mysql.sock




                                   2008 JavaOneSM Conference | java.com.sun/javaone |   26
Database connections

 Use JNDI DataSource with a connection pool
 But Rails doesn't close connections by default (!)

 # config/initializers/close_connections.rb
 if defined?($servlet_context)
   require 'action_controller/dispatcher'
   ActionController::Dispatcher.after_dispatch do
     ActiveRecord::Base.clear_active_connections!
   end
 end




                                          2008 JavaOneSM Conference | java.com.sun/javaone |   27
Caching and File stat'ing

  Ensure view caching is enabled (default in Rails 2.0.2)
  • config.action_view.cache_template_loading = true
  Avoid asset ID timestamp checks with RAILS_ASSET_ID
   • ENV['RAILS_ASSET_ID'] = “r#{source_revision}”
  Ensure full-page cache directory points to root of WAR
   • config.action_controller.page_cache_directory
   • Rails.public_path coming in 2.1




                                           2008 JavaOneSM Conference | java.com.sun/javaone |   28
Performance...




                 2008 JavaOneSM Conference | java.com.sun/javaone |   29
...is a developing story.




                      2008 JavaOneSM Conference | java.com.sun/javaone |   30
2008 JavaOneSM Conference | java.com.sun/javaone |   31
Precompiling Rails

 Compile Ruby code to bytecode before execution
 System property: -Djruby.compile.mode=FORCE
 Leverage existing tools for profiling, troubleshooting


class ErrorsController < ApplicationController
  def index
    java.lang.Thread.dumpStack
  end
end




                                          2008 JavaOneSM Conference | java.com.sun/javaone |   32
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1176)
at
ruby...testapp.app.controllers.errors_controller.index__1
   (.../app/controllers/errors_controller.rb:3)
at ruby...action_controller.base.perform_action__66
   (.../gems/1.8/gems/actionpack-
2.0.2/lib/action_controller/base.rb:1158)
   ...
at ruby...action_controller.base.process__25
   (.../gems/1.8/gems/actionpack-
2.0.2/lib/action_controller/base.rb:388)
at ruby...action_controller.dispatcher.handle_request__18
   (.../gems/1.8/gems/actionpack-
2.0.2/lib/action_controller/dispatcher.rb:171)
at ruby...action_controller.dispatcher.__rescue_5
   (.../gems/1.8/gems/actionpack-
2.0.2/lib/action_controller/dispatcher.rb:115)



                                        2008 JavaOneSM Conference | java.com.sun/javaone |   33
Introducing JRuby-Rack

 http://wiki.jruby.org/wiki/JRuby_Rack
 0.9 -- First public release today!
 Also released – Warbler 0.9.9 – bundles jruby-rack 0.9




                                          2008 JavaOneSM Conference | java.com.sun/javaone |   34
Introducing JRuby-Rack

 Adapter from servlets to Rack
  • Rack == Ruby web server abstraction layer
  • http://rack.rubyforge.org/
 Eliminate manual setup
 Runs Rails, Merb, any Rack-compatible framework
 Seamless integration with non-Rails servlet components




                                        2008 JavaOneSM Conference | java.com.sun/javaone |   35

Weitere ähnliche Inhalte

Was ist angesagt?

Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Robert Scholte
 
Devoxx17 - Préparez-vous à la modularité selon Java 9
Devoxx17 - Préparez-vous à la modularité selon Java 9Devoxx17 - Préparez-vous à la modularité selon Java 9
Devoxx17 - Préparez-vous à la modularité selon Java 9Alexis Hassler
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules uploadRyan Cuprak
 
Spring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFuSpring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFuVMware Tanzu
 
EWD 3 Training Course Part 4: Installing & Configuring QEWD
EWD 3 Training Course Part 4: Installing & Configuring QEWDEWD 3 Training Course Part 4: Installing & Configuring QEWD
EWD 3 Training Course Part 4: Installing & Configuring QEWDRob Tweed
 
Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)Robert Scholte
 
Java 9 and the impact on Maven Projects (Devoxx 2016)
Java 9 and the impact on Maven Projects (Devoxx 2016)Java 9 and the impact on Maven Projects (Devoxx 2016)
Java 9 and the impact on Maven Projects (Devoxx 2016)Robert Scholte
 
Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9Pavel Bucek
 
OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian SchneiderOSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian Schneidermfrancis
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"Daniel Bryant
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with ociDonghuKIM2
 
Extending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsExtending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsPetr Jiricka
 

Was ist angesagt? (20)

Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)
 
Devoxx17 - Préparez-vous à la modularité selon Java 9
Devoxx17 - Préparez-vous à la modularité selon Java 9Devoxx17 - Préparez-vous à la modularité selon Java 9
Devoxx17 - Préparez-vous à la modularité selon Java 9
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
Spring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFuSpring Boot Revisited with KoFu and JaFu
Spring Boot Revisited with KoFu and JaFu
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
 
EWD 3 Training Course Part 4: Installing & Configuring QEWD
EWD 3 Training Course Part 4: Installing & Configuring QEWDEWD 3 Training Course Part 4: Installing & Configuring QEWD
EWD 3 Training Course Part 4: Installing & Configuring QEWD
 
Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 9 and the impact on Maven Projects (JavaOne 2016)
 
Java 9 and the impact on Maven Projects (Devoxx 2016)
Java 9 and the impact on Maven Projects (Devoxx 2016)Java 9 and the impact on Maven Projects (Devoxx 2016)
Java 9 and the impact on Maven Projects (Devoxx 2016)
 
Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9Pitfalls of migrating projects to JDK 9
Pitfalls of migrating projects to JDK 9
 
Java EE 6
Java EE 6Java EE 6
Java EE 6
 
MySQL Aquarium Paris
MySQL Aquarium ParisMySQL Aquarium Paris
MySQL Aquarium Paris
 
Web Space10 Overview
Web Space10 OverviewWeb Space10 Overview
Web Space10 Overview
 
Java 7 Preview
Java 7 PreviewJava 7 Preview
Java 7 Preview
 
OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian SchneiderOSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian Schneider
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
Extending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsExtending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.js
 
Migrating to Java 9 Modules
Migrating to Java 9 ModulesMigrating to Java 9 Modules
Migrating to Java 9 Modules
 
GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6
 

Andere mochten auch

Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented PrinciplesSujit Majety
 
12 formas básicas de enseñar
12 formas básicas de enseñar12 formas básicas de enseñar
12 formas básicas de enseñarPatty LóMar
 
งานโลหะแผ่น5 3
งานโลหะแผ่น5 3งานโลหะแผ่น5 3
งานโลหะแผ่น5 3Pannathat Champakul
 
04.การกระจายเชื้อเพลิงในต่างประเทศ
04.การกระจายเชื้อเพลิงในต่างประเทศ04.การกระจายเชื้อเพลิงในต่างประเทศ
04.การกระจายเชื้อเพลิงในต่างประเทศKobwit Piriyawat
 
Kelas tahun 5 rajin 2014 for merge
Kelas tahun 5 rajin  2014   for mergeKelas tahun 5 rajin  2014   for merge
Kelas tahun 5 rajin 2014 for mergeSiti Norwati
 
หลักสูตร Sqs ผจก
หลักสูตร Sqs ผจกหลักสูตร Sqs ผจก
หลักสูตร Sqs ผจกNutthawuth Kanasup
 
Who Watches the Watchmen - Arup Chakrabarti, PagerDuty - DevOpsDays Tel Aviv ...
Who Watches the Watchmen - Arup Chakrabarti, PagerDuty - DevOpsDays Tel Aviv ...Who Watches the Watchmen - Arup Chakrabarti, PagerDuty - DevOpsDays Tel Aviv ...
Who Watches the Watchmen - Arup Chakrabarti, PagerDuty - DevOpsDays Tel Aviv ...DevOpsDays Tel Aviv
 
DevOps Boston - Heartbleed at Acquia
DevOps Boston - Heartbleed at AcquiaDevOps Boston - Heartbleed at Acquia
DevOps Boston - Heartbleed at AcquiaMarc Seeger
 
How Amazon Echo can be helpful for the healthcare industry
How Amazon Echo can be helpful for the healthcare industryHow Amazon Echo can be helpful for the healthcare industry
How Amazon Echo can be helpful for the healthcare industrySoftweb Solutions
 
Evangelio Ilutsrado, 4º Domingo de Pascua
Evangelio Ilutsrado, 4º Domingo de PascuaEvangelio Ilutsrado, 4º Domingo de Pascua
Evangelio Ilutsrado, 4º Domingo de Pascuacristinamoreubi
 

Andere mochten auch (20)

Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented Principles
 
Ch15
Ch15Ch15
Ch15
 
06 regression
06 regression06 regression
06 regression
 
12 formas básicas de enseñar
12 formas básicas de enseñar12 formas básicas de enseñar
12 formas básicas de enseñar
 
Transfer Printable fabrics Silhouette Cameo 2
Transfer Printable fabrics Silhouette Cameo 2Transfer Printable fabrics Silhouette Cameo 2
Transfer Printable fabrics Silhouette Cameo 2
 
งานโลหะแผ่น5 3
งานโลหะแผ่น5 3งานโลหะแผ่น5 3
งานโลหะแผ่น5 3
 
04.การกระจายเชื้อเพลิงในต่างประเทศ
04.การกระจายเชื้อเพลิงในต่างประเทศ04.การกระจายเชื้อเพลิงในต่างประเทศ
04.การกระจายเชื้อเพลิงในต่างประเทศ
 
Metodos
MetodosMetodos
Metodos
 
Sensoplan
SensoplanSensoplan
Sensoplan
 
Valtek MK1 Rebuild
Valtek MK1 RebuildValtek MK1 Rebuild
Valtek MK1 Rebuild
 
Grafica grupal
Grafica grupalGrafica grupal
Grafica grupal
 
Kelas tahun 5 rajin 2014 for merge
Kelas tahun 5 rajin  2014   for mergeKelas tahun 5 rajin  2014   for merge
Kelas tahun 5 rajin 2014 for merge
 
หลักสูตร Sqs ผจก
หลักสูตร Sqs ผจกหลักสูตร Sqs ผจก
หลักสูตร Sqs ผจก
 
Plastic1
Plastic1Plastic1
Plastic1
 
Objective runtime
Objective runtimeObjective runtime
Objective runtime
 
Who Watches the Watchmen - Arup Chakrabarti, PagerDuty - DevOpsDays Tel Aviv ...
Who Watches the Watchmen - Arup Chakrabarti, PagerDuty - DevOpsDays Tel Aviv ...Who Watches the Watchmen - Arup Chakrabarti, PagerDuty - DevOpsDays Tel Aviv ...
Who Watches the Watchmen - Arup Chakrabarti, PagerDuty - DevOpsDays Tel Aviv ...
 
DevOps Boston - Heartbleed at Acquia
DevOps Boston - Heartbleed at AcquiaDevOps Boston - Heartbleed at Acquia
DevOps Boston - Heartbleed at Acquia
 
Etl tool
Etl toolEtl tool
Etl tool
 
How Amazon Echo can be helpful for the healthcare industry
How Amazon Echo can be helpful for the healthcare industryHow Amazon Echo can be helpful for the healthcare industry
How Amazon Echo can be helpful for the healthcare industry
 
Evangelio Ilutsrado, 4º Domingo de Pascua
Evangelio Ilutsrado, 4º Domingo de PascuaEvangelio Ilutsrado, 4º Domingo de Pascua
Evangelio Ilutsrado, 4º Domingo de Pascua
 

Ähnlich wie JRuby on Rails Deployment: What They Didn't Tell You

Boldly go where the Java programming language has never gone before
Boldly go where the Java programming language has never gone beforeBoldly go where the Java programming language has never gone before
Boldly go where the Java programming language has never gone beforeelliando dias
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Arun Gupta
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Arun Gupta
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular applicationmirrec
 
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusD. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusUni Systems S.M.S.A.
 
Classloader leak detection in websphere application server
Classloader leak detection in websphere application serverClassloader leak detection in websphere application server
Classloader leak detection in websphere application serverRohit Kelapure
 
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGJava EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGArun Gupta
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerArun Gupta
 
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionJava EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionArun Gupta
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best PracticesDavid Delabassee
 
It pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enIt pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enGeorge Birbilis
 
Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Arun Gupta
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudHiro Asari
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaKeith Bennett
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developergicappa
 
blueMarine Or Why You Should Really Ship Swing Applications
blueMarine  Or Why You Should Really Ship Swing  Applications blueMarine  Or Why You Should Really Ship Swing  Applications
blueMarine Or Why You Should Really Ship Swing Applications Fabrizio Giudici
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DaliaAboSheasha
 
Практики применения JRuby
Практики применения JRubyПрактики применения JRuby
Практики применения JRuby.toster
 
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...London Microservices
 
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...Arun Gupta
 

Ähnlich wie JRuby on Rails Deployment: What They Didn't Tell You (20)

Boldly go where the Java programming language has never gone before
Boldly go where the Java programming language has never gone beforeBoldly go where the Java programming language has never gone before
Boldly go where the Java programming language has never gone before
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
 
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusD. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
 
Classloader leak detection in websphere application server
Classloader leak detection in websphere application serverClassloader leak detection in websphere application server
Classloader leak detection in websphere application server
 
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGJava EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More Power
 
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionJava EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
 
JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
It pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enIt pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_en
 
Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-java
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
blueMarine Or Why You Should Really Ship Swing Applications
blueMarine  Or Why You Should Really Ship Swing  Applications blueMarine  Or Why You Should Really Ship Swing  Applications
blueMarine Or Why You Should Really Ship Swing Applications
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11
 
Практики применения JRuby
Практики применения JRubyПрактики применения JRuby
Практики применения JRuby
 
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
 
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
 

Mehr von elliando dias

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slideselliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScriptelliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structureselliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de containerelliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Librarieselliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Webelliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduinoelliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorceryelliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Designelliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makeselliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebookelliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Studyelliando dias
 

Mehr von elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 

Kürzlich hochgeladen

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Kürzlich hochgeladen (20)

Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

JRuby on Rails Deployment: What They Didn't Tell You

  • 1. JRuby on Rails Deployment: What They Didn't Tell You Nick Sieger, Staff Engineer, Sun Microsystems, Inc. TS-6490
  • 2. Agenda Rails deployment background Mechanics of JRuby on Rails Preparations Packaging Post-deployment 2008 JavaOneSM Conference | java.com.sun/javaone | 2
  • 3. The Concurrency Question Each Rails request must execute in isolation. “Rails is not thread-safe? WTF?” “Servlets have been multi-threaded since, like,1997!” 2008 JavaOneSM Conference | java.com.sun/javaone | 3
  • 4. Context for Concurrency Writing thread-safe code is hard + Ruby's userland threads don't yield much benefit Not worth the effort Rails scales up by adding processes 2008 JavaOneSM Conference | java.com.sun/javaone | 4
  • 5. CGI/FGCI http://flickr.com/photos/counteragent/2190576349/ 2008 JavaOneSM Conference | java.com.sun/javaone | 5
  • 6. Mongrel http://flickr.com/photos/bugbunnybambam/2172466178/ 2008 JavaOneSM Conference | java.com.sun/javaone | 6
  • 7. Mongrel Model 2008 JavaOneSM Conference | java.com.sun/javaone | 7
  • 8. = * 180 http://highscalability.com/scaling-twitter-making-twitter-10000-percent-faster 2008 JavaOneSM Conference | java.com.sun/javaone | 8
  • 9. Instead of multiple processes... 2008 JavaOneSM Conference | java.com.sun/javaone | 9
  • 10. The Java Virtual Machine (JVM™): All Ur Rails Are Belong To Us 2008 JavaOneSM Conference | java.com.sun/javaone | 10
  • 11. Application Startup 2008 JavaOneSM Conference | java.com.sun/javaone | 11
  • 12. Dispatching to Rails 2008 JavaOneSM Conference | java.com.sun/javaone | 12
  • 13. Developing Your Rails Application TS-4806: JRuby on Rails: Web Development Evolved TS-5249: The NetBeans™ Ruby IDE: You Thought Rails Development Was Fun Before Both yesterday 2008 JavaOneSM Conference | java.com.sun/javaone | 13
  • 14. Database Connectivity Install the ActiveRecord Java DataBase Connectivity (JDBCTM) adapter gem (mysql) $ jruby -S gem install activerecord-jdbcmysql-adapter Successfully installed activerecord-jdbc-adapter-0.8 Successfully installed jdbc-mysql-5.0.4 Successfully installed activerecord-jdbcmysql-adapter-0.8 3 gems installed Installing ri documentation for activerecord-jdbc-adapter-0.8... Installing ri documentation for jdbc-mysql-5.0.4... Installing ri documentation for activerecord-jdbcmysql-adapter- 0.8... Installing RDoc documentation for activerecord-jdbc-adapter-0.8... Installing RDoc documentation for jdbc-mysql-5.0.4... Installing RDoc documentation for activerecord-jdbcmysql-adapter- 0.8... 2008 JavaOneSM Conference | java.com.sun/javaone | 14
  • 15. Configure the Database # config/database.yml <% jdbc = defined?(JRUBY_VERSION) ? 'jdbc' : '' %> development: adapter: <%= jdbc %>mysql encoding: utf8 database: testapp_development username: root password: socket: /tmp/mysql.sock # same for test/production... 2008 JavaOneSM Conference | java.com.sun/javaone | 15
  • 16. Examine dependencies Gems and libraries with native code == FAIL on JRuby Look for replacements/equivalents: • Mongrel, Hpricot OK • RMagick, ImageScience => ImageVoodoo • OpenSSL => JRuby-OpenSSL gem • Ruby/LDAP => JRuby/LDap • json => json_pure 2008 JavaOneSM Conference | java.com.sun/javaone | 16
  • 17. Try It! $ jruby -S gem install mongrel Successfully installed mongrel-1.1.3-java 1 gem installed Installing ri documentation for mongrel-1.1.3-java... Installing RDoc documentation for mongrel-1.1.3-java... $ jruby script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel 1.1.3 available at 0.0.0.0:3000 ** Use CTRL-C to stop. 2008 JavaOneSM Conference | java.com.sun/javaone | 17
  • 18. Application Layout (Rails) 2008 JavaOneSM Conference | java.com.sun/javaone | 18
  • 19. Application Layout (WAR) 2008 JavaOneSM Conference | java.com.sun/javaone | 19
  • 20. Using Warbler Installed as a gem (jruby -S gem install warbler) JRuby and servlet adapter bits included Automates war configuration 2008 JavaOneSM Conference | java.com.sun/javaone | 20
  • 21. Installing Warbler as a Plugin $ jruby -S warble pluginize /Users/nicksieger/Projects/jruby/trunk/jruby/bin/jruby -S gem unpack warbler Unpacked gem: '/Users/nicksieger/Projects/rails/testapp/vendor/plugins/warbler- 0.9.5' $ jruby -S rake -T | grep war rake war # Create testapp.war rake war:app # Copy all application files into the ... rake war:clean # Clean up the .war file and the stagi... rake war:gems # Unpack all gems into WEB-INF/gems rake war:jar # Run the jar command to create the .war rake war:java_classes # Copy java classes into the .war rake war:java_libs # Copy all java libraries into the .war rake war:public # Copy all public HTML files to the ro... rake war:webxml # Generate a web.xml file for the webapp 2008 JavaOneSM Conference | java.com.sun/javaone | 21
  • 22. Configuring Warbler Generate config file • jruby -S warble config -or- • jruby script/generate warble • => config/warble.rb # Warbler web application assembly configuration file Warbler::Config.new do |config| # ... # Gems to be packaged in the webapp. ... config.gems += [quot;activerecord-jdbcmysql-adapterquot;, quot;jruby-opensslquot;] config.gems[quot;railsquot;] = quot;2.0.2quot; # ... end 2008 JavaOneSM Conference | java.com.sun/javaone | 22
  • 23. Runtime Pool Size config/warble.rb: Warbler::Config.new do |config| # ... # Control the pool of Rails runtimes config.webxml.jruby.min.runtimes = 2 config.webxml.jruby.max.runtimes = 4 end 2008 JavaOneSM Conference | java.com.sun/javaone | 23
  • 24. Logging if defined?(JRUBY_VERSION) && defined?($servlet_context) # Logger expects an object that responds to #write and #close device = Object.new def device.write(message) $servlet_context.log(message) end def device.close; end # Make these accessible to wire in the log device class << RAILS_DEFAULT_LOGGER public :instance_variable_get, :instance_variable_set end old_device = RAILS_DEFAULT_LOGGER.instance_variable_get quot;@logquot; old_device.close rescue nil RAILS_DEFAULT_LOGGER.instance_variable_set quot;@logquot;, device end 2008 JavaOneSM Conference | java.com.sun/javaone | 24
  • 25. Session handling Rails sessions != Servlet sessions config.action_controller.session_store = :java_servlet_store # ... class CGI::Session::JavaServletStore def initialize(session, options) end def restore; end def update; end def close; end end 2008 JavaOneSM Conference | java.com.sun/javaone | 25
  • 26. Database: JNDI production: adapter: <%= jdbc %>mysql jndi: jdbc/testapp_production encoding: utf8 database: testapp_production username: root password: socket: /tmp/mysql.sock 2008 JavaOneSM Conference | java.com.sun/javaone | 26
  • 27. Database connections Use JNDI DataSource with a connection pool But Rails doesn't close connections by default (!) # config/initializers/close_connections.rb if defined?($servlet_context) require 'action_controller/dispatcher' ActionController::Dispatcher.after_dispatch do ActiveRecord::Base.clear_active_connections! end end 2008 JavaOneSM Conference | java.com.sun/javaone | 27
  • 28. Caching and File stat'ing Ensure view caching is enabled (default in Rails 2.0.2) • config.action_view.cache_template_loading = true Avoid asset ID timestamp checks with RAILS_ASSET_ID • ENV['RAILS_ASSET_ID'] = “r#{source_revision}” Ensure full-page cache directory points to root of WAR • config.action_controller.page_cache_directory • Rails.public_path coming in 2.1 2008 JavaOneSM Conference | java.com.sun/javaone | 28
  • 29. Performance... 2008 JavaOneSM Conference | java.com.sun/javaone | 29
  • 30. ...is a developing story. 2008 JavaOneSM Conference | java.com.sun/javaone | 30
  • 31. 2008 JavaOneSM Conference | java.com.sun/javaone | 31
  • 32. Precompiling Rails Compile Ruby code to bytecode before execution System property: -Djruby.compile.mode=FORCE Leverage existing tools for profiling, troubleshooting class ErrorsController < ApplicationController def index java.lang.Thread.dumpStack end end 2008 JavaOneSM Conference | java.com.sun/javaone | 32
  • 33. java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1176) at ruby...testapp.app.controllers.errors_controller.index__1 (.../app/controllers/errors_controller.rb:3) at ruby...action_controller.base.perform_action__66 (.../gems/1.8/gems/actionpack- 2.0.2/lib/action_controller/base.rb:1158) ... at ruby...action_controller.base.process__25 (.../gems/1.8/gems/actionpack- 2.0.2/lib/action_controller/base.rb:388) at ruby...action_controller.dispatcher.handle_request__18 (.../gems/1.8/gems/actionpack- 2.0.2/lib/action_controller/dispatcher.rb:171) at ruby...action_controller.dispatcher.__rescue_5 (.../gems/1.8/gems/actionpack- 2.0.2/lib/action_controller/dispatcher.rb:115) 2008 JavaOneSM Conference | java.com.sun/javaone | 33
  • 34. Introducing JRuby-Rack http://wiki.jruby.org/wiki/JRuby_Rack 0.9 -- First public release today! Also released – Warbler 0.9.9 – bundles jruby-rack 0.9 2008 JavaOneSM Conference | java.com.sun/javaone | 34
  • 35. Introducing JRuby-Rack Adapter from servlets to Rack • Rack == Ruby web server abstraction layer • http://rack.rubyforge.org/ Eliminate manual setup Runs Rails, Merb, any Rack-compatible framework Seamless integration with non-Rails servlet components 2008 JavaOneSM Conference | java.com.sun/javaone | 35