SlideShare a Scribd company logo
Deploying with JRuby
      with Joe Kutner
HTTP
            Request




          Apache/Nginx




 MRI                      MRI

Mongrel                  Mongrel
Ruby     Ruby     Ruby
Thread   Thread   Thread




          GIL




         Kernel
         Thread
HTTP
          Request




        Apache/Nginx




            JVM




JRuby
                       Thread
Deploying with JRuby
MRI
M = N = 16
...
data.size         #=> 256
data.compact.size #=> 256
MRI                        JRuby
M = N = 16                  M = N = 16
...                         ...
data.size         #=> 256   data.size         #=> 244
data.compact.size #=> 256   data.compact.size #=> 229
Deploying with JRuby
MRI

15.616822
15.675064
MRI         JRuby

15.616822    7.770000
15.675064    4.245000
Deployment
People
Processes
        Technologies
Archive File

  Capistrano

Background Jobs

   Clustering

     PaaS
Warbler         Trinidad         TorqueBox
Archive File                       Archive File

                 Capistrano         Capistrano

               Background Jobs   Background Jobs

                                    Clustering

   PaaS             PaaS
Warbler


$ warble war
Warbler

                     Tomcat/Jetty
                        Server

WAR
       SSH/FTP/SMB
File
Trinidad

$ rails s trinidad

         or


$ rackup -s trinidad
Trinidad

                             Trinidad
app1/
                                  Extensions
|-- app/
|-- config/
|-- db/         Capistrano
                                    Job Scheduler
|-- lib/
`-- config.ru                          (Quartz)


                                   Background Jobs
                                       (Resque)
app2/
|-- app/
|-- config/
|-- db/         Capistrano             DB Pool
|-- lib/                           (Commons DBCP)
`-- config.ru
TorqueBox

 $ torquebox run

       then


$ torquebox deploy
TorqueBox

                              TorqueBox
                                      Job Scheduler
app1/
|-- app/
|-- config/
|-- db/          Capistrano             Messaging
|-- lib/
`-- config.ru
                                    Session Replication


                                     High Availability

   Knob
                SSH/FTP/SMB
    File                                 Services


                                        Stomplets


                                        Clustering
TorqueBox Cluster

             TorqueBox



 TorqueBox               TorqueBox




 TorqueBox               TorqueBox



             TorqueBox
Alternatives


Google AppEngine

Kirk

Mizuno
Which Strategy is right
       for me?

 People

 Process

 Technology

More Related Content

KEY
Deploying JRuby Web Applications
PDF
How to deploy your Rails application on Windows
KEY
Deploy, Scale and Sleep at Night with JRuby
PPTX
CoreOS in a Nutshell
PDF
JavaCro'15 - Conquer the Internet of Things with Java and Docker - Johan Jans...
PDF
CoreOS + Kubernetes @ All Things Open 2015
PDF
Object Storage with Gluster
PDF
CoreOS @Codetalks Hamburg
Deploying JRuby Web Applications
How to deploy your Rails application on Windows
Deploy, Scale and Sleep at Night with JRuby
CoreOS in a Nutshell
JavaCro'15 - Conquer the Internet of Things with Java and Docker - Johan Jans...
CoreOS + Kubernetes @ All Things Open 2015
Object Storage with Gluster
CoreOS @Codetalks Hamburg

What's hot (20)

PDF
CoreOS: Control Your Fleet
PDF
Максим Барышиков-«WoT: Geographically distributed cluster of clusters»
PDF
Scylla Summit 2022: ScyllaDB Embraces Wasm
PPTX
OpenShift4 Installation by UPI on kvm
PDF
Galaxy CloudMan performance on AWS
DOCX
DockerCoreNet
PDF
From Kubernetes to OpenStack in Sydney
PDF
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
PDF
Install openstack
PDF
Xanadu - Java Chapter Meeting
PDF
Quay 3.3 installation
PPTX
CoreOS Intro
PDF
Small, Simple, and Secure: Alpine Linux under the Microscope
PPTX
Developing High Performance Application with Aerospike & Go
PPTX
What makes AWS invincible? from JAWS Days 2014
PDF
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
PDF
Ruby 2.4 Internals
PDF
VPC by Default時代のアクセス制御
PDF
Understand the iptables step by step
PDF
Painless ruby deployment on shelly cloud
CoreOS: Control Your Fleet
Максим Барышиков-«WoT: Geographically distributed cluster of clusters»
Scylla Summit 2022: ScyllaDB Embraces Wasm
OpenShift4 Installation by UPI on kvm
Galaxy CloudMan performance on AWS
DockerCoreNet
From Kubernetes to OpenStack in Sydney
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Install openstack
Xanadu - Java Chapter Meeting
Quay 3.3 installation
CoreOS Intro
Small, Simple, and Secure: Alpine Linux under the Microscope
Developing High Performance Application with Aerospike & Go
What makes AWS invincible? from JAWS Days 2014
Mасштабирование микросервисов на Go, Matt Heath (Hailo)
Ruby 2.4 Internals
VPC by Default時代のアクセス制御
Understand the iptables step by step
Painless ruby deployment on shelly cloud
Ad

Similar to Deploying with JRuby (20)

PDF
TorqueBox at DC:JBUG - November 2011
PDF
TorqueBox for Rubyists
PDF
TorqueBox
KEY
TorqueBox - Ruby Hoedown 2011
KEY
When Two Worlds Collide: Java and Ruby in the Enterprise
PDF
Torquebox OSCON Java 2011
PDF
Complex Made Simple: Sleep Better With TorqueBox
PDF
When Ruby Meets Java - The Power of Torquebox
PDF
SCALE 10x Build a Cloud Day
PDF
Cloud Best Practices
PDF
At Scale With Style (Erlang User Conference 2012)
PDF
At Scale With Style
KEY
Devignition 2011
PDF
Complex Made Simple: Sleep Better with TorqueBox
PDF
O que tem de novo no Ruby 2.0?
PDF
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
PDF
Chef in the cloud [dbccg]
KEY
Novalug 07142012
PPTX
eBay From Ground Level to the Clouds
PDF
Rebooting a Cloud
TorqueBox at DC:JBUG - November 2011
TorqueBox for Rubyists
TorqueBox
TorqueBox - Ruby Hoedown 2011
When Two Worlds Collide: Java and Ruby in the Enterprise
Torquebox OSCON Java 2011
Complex Made Simple: Sleep Better With TorqueBox
When Ruby Meets Java - The Power of Torquebox
SCALE 10x Build a Cloud Day
Cloud Best Practices
At Scale With Style (Erlang User Conference 2012)
At Scale With Style
Devignition 2011
Complex Made Simple: Sleep Better with TorqueBox
O que tem de novo no Ruby 2.0?
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
Chef in the cloud [dbccg]
Novalug 07142012
eBay From Ground Level to the Clouds
Rebooting a Cloud
Ad

More from Joe Kutner (20)

PDF
Fantastic Buildpacks and Where to Find Them
PDF
2019 Texas Star Party
PDF
10 Mistakes Hackers Want You to Make
PDF
NASA Space Apps Expo
PDF
NASA Space Apps
PDF
Why Heroku Loves JHipster
PDF
What the Struts?
PDF
Async and Non-blocking IO w/ JRuby
PDF
I can't believe it's not a queue: Kafka and Spring
PDF
Deploying JHipster Microservices
PPTX
Measuring doubles with 8" neaf copy
PDF
4 JVM Web Frameworks
PDF
JavaOne 2015: 12 Factor App
PDF
12-factor-jruby
PDF
Java 20
PDF
12 Factor Scala
PDF
Programming JVM Bytecode with Jitescript
PDF
jdays 2015
PDF
Programming JVM Bytecode
PDF
12 Factor App: Best Practices for JVM Deployment
Fantastic Buildpacks and Where to Find Them
2019 Texas Star Party
10 Mistakes Hackers Want You to Make
NASA Space Apps Expo
NASA Space Apps
Why Heroku Loves JHipster
What the Struts?
Async and Non-blocking IO w/ JRuby
I can't believe it's not a queue: Kafka and Spring
Deploying JHipster Microservices
Measuring doubles with 8" neaf copy
4 JVM Web Frameworks
JavaOne 2015: 12 Factor App
12-factor-jruby
Java 20
12 Factor Scala
Programming JVM Bytecode with Jitescript
jdays 2015
Programming JVM Bytecode
12 Factor App: Best Practices for JVM Deployment

Recently uploaded (20)

PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Cloud computing and distributed systems.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation theory and applications.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
Empathic Computing: Creating Shared Understanding
PDF
Encapsulation_ Review paper, used for researhc scholars
MIND Revenue Release Quarter 2 2025 Press Release
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Cloud computing and distributed systems.
Digital-Transformation-Roadmap-for-Companies.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation theory and applications.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
Empathic Computing: Creating Shared Understanding
Encapsulation_ Review paper, used for researhc scholars

Deploying with JRuby

  • 1. Deploying with JRuby with Joe Kutner
  • 2. HTTP Request Apache/Nginx MRI MRI Mongrel Mongrel
  • 3. Ruby Ruby Ruby Thread Thread Thread GIL Kernel Thread
  • 4. HTTP Request Apache/Nginx JVM JRuby Thread
  • 6. MRI M = N = 16 ... data.size #=> 256 data.compact.size #=> 256
  • 7. MRI JRuby M = N = 16 M = N = 16 ... ... data.size #=> 256 data.size #=> 244 data.compact.size #=> 256 data.compact.size #=> 229
  • 10. MRI JRuby 15.616822 7.770000 15.675064 4.245000
  • 12. People Processes Technologies
  • 13. Archive File Capistrano Background Jobs Clustering PaaS
  • 14. Warbler Trinidad TorqueBox Archive File Archive File Capistrano Capistrano Background Jobs Background Jobs Clustering PaaS PaaS
  • 16. Warbler Tomcat/Jetty Server WAR SSH/FTP/SMB File
  • 17. Trinidad $ rails s trinidad or $ rackup -s trinidad
  • 18. Trinidad Trinidad app1/ Extensions |-- app/ |-- config/ |-- db/ Capistrano Job Scheduler |-- lib/ `-- config.ru (Quartz) Background Jobs (Resque) app2/ |-- app/ |-- config/ |-- db/ Capistrano DB Pool |-- lib/ (Commons DBCP) `-- config.ru
  • 19. TorqueBox $ torquebox run then $ torquebox deploy
  • 20. TorqueBox TorqueBox Job Scheduler app1/ |-- app/ |-- config/ |-- db/ Capistrano Messaging |-- lib/ `-- config.ru Session Replication High Availability Knob SSH/FTP/SMB File Services Stomplets Clustering
  • 21. TorqueBox Cluster TorqueBox TorqueBox TorqueBox TorqueBox TorqueBox TorqueBox
  • 23. Which Strategy is right for me? People Process Technology

Editor's Notes

  • #2: I’m a programmer, but I don’t tell that to my family. I tell them I’m a “Software Architect” because it doesn’t disappoint them as much. \n\nWhat we do is really about solving problems. In fact, I think easiest part of our job is writing the code. Figuring out how to tackle a problem is much harder. Sometimes we need to punch out some code to get through a problem -- it helps us realize what we are doing. But there are lots of different ways to solve problems:\n\nDivide and conquer: break in down into more manageable parts.\nTrial and Error: see what sticks to the wall.\nRoot Cause Analysis: eliminating the cause of the problem.\n\nWhen it comes to Ruby applications, JRuby is a means of eliminating the root cause of many architectural and deployment problems.\n\nBut I don’t like the phrase “root cause analysis” -- it’s too stuffy. I prefer the analogy to “changing the conversation.” Who watches Mad Men?\n\nIf you don’t like what’s being said, change the conversation\nIf you don’t like the solutions, change the problem.\n\nHave you ever focused really hard on a difficult problem, then realized (probably in the shower) that you could solve the problem by avoiding it altogether?\nOf course you have.\nIf you don’t like what’s being said, change the conversation\nIf you don’t like the solutions, change the problem.\nThat’s what this talk is about. There are problems with deploying MRI-based web applications that i’ll describe in a moment. \n\n
  • #3: Memory Growth (each process has a copy of the app in memory)\nDatabase Pools (each process has it’s own DB pool)\nSlow Restarts\nZombies.\n\nThe result of these problems has been the additional layers. Unicorn and Passenger try to solve these problems. pgpool on the backend. God and Monit. \n\nBut really, we need to change the conversation. We need to eliminate the root cause.\n\nIt’s all because of the GIL\n\n\n\n
  • #4: It’s all because of the GIL\nMultiple Ruby threads to one OS thread.\nYea, garbage collection and IO can happen concurrently, but not our code.\nThis is to protect the programmer.\n\nJVM does not have a GIL \nIt maps User threads directly to OS threads.\n\nA lot of folks want to remove the GIL -- to make MRI more like the JVM. It ain’t gonna happen.\nAt RubyConf 2011 someone asked Matz if the GIL would be remove. He said no. He doesn’t want MRI to be “that kind of platform.” \n\nI’m with Matz on this one. Ruby is supposed to make it easy for the program - Matz doesn’t care if it’s fast.\nThere are tons of applications where having a GIL doesn’t matter. \nBut web apps are not one of them.\n\n
  • #5: one process. no balancing layers. no peripheral background processes. no external db pool (unless you’re running a cluster that shares a db instead of using replication).\n
  • #6: Interesting question: is this thread-safe on MRI?\n\nIt depends. Do you care about the order of the data array?\n
  • #7: Interesting question: is this thread-safe on MRI?\n\nIt depends. Do you care about the order of the data array?\n
  • #8: This program runs the same benchmark twice. In each run it calculates the factorial of 99 400,000 times. \nThe first time, it uses a single thread. The second time, it uses four threads. \n\nInteresting question: is this thread-safe on MRI?\n\nIt depends. Do you care about the order of the data array?\n
  • #9: This program runs the same benchmark twice. In each run it calculates the factorial of 99 400,000 times. \nThe first time, it uses a single thread. The second time, it uses four threads. \n\nInteresting question: is this thread-safe on MRI?\n\nIt depends. Do you care about the order of the data array?\n
  • #10: That’s how JRuby changes the conversation for our architectural problems. But how do we implement this?\nThat’s where deployment comes in.\nDeployment is the process of taking something we’ve built, and delivering it to the customer. That includes the application and the platform it runs. So we have two considerations:\n1. how do we deploy our code\n2. how do we deploy our infrastructure.\nTraditional Ruby deployment takes a directory of loose files and launches them in a sort of shotgun blast arcoss a network, and we just have to hope that everything arrived intact. \nBut JRuby allows us to package our application -- independently of the platform it runs on -- and distribute it as a single file. This means we can encrypt it, sign it, or even compile it.\n
  • #11: \n
  • #12: \n
  • #13: \n
  • #14: Archive File / Capistrano\nBackground Jobs\nClustering\nPaaS\n\n
  • #15: \n
  • #16: \n
  • #17: \n
  • #18: \n
  • #19: \n
  • #20: \n
  • #21: \n
  • #22: You can still deploy your JRuby applications with Capistrano if you want, and there may be good reasons for do so. But that’s just it -- you have to figure out the nature of your constraints and select the best deployment strategy to suit that world.\n