• Save
Deploying with JRuby
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Deploying with JRuby

on

  • 7,922 views

 

Statistics

Views

Total Views
7,922
Views on SlideShare
1,787
Embed Views
6,135

Actions

Likes
2
Downloads
0
Comments
0

46 Embeds 6,135

http://deployingjruby.blogspot.com 3403
http://deployingjruby.blogspot.de 469
http://deployingjruby.blogspot.com.br 239
http://deployingjruby.blogspot.co.uk 229
http://deployingjruby.blogspot.in 217
http://deployingjruby.blogspot.ca 188
http://deployingjruby.blogspot.com.au 150
http://deployingjruby.blogspot.fr 121
http://deployingjruby.blogspot.ru 84
http://deployingjruby.blogspot.com.es 82
http://deployingjruby.blogspot.jp 82
http://deployingjruby.blogspot.it 73
http://deployingjruby.blogspot.se 72
http://deployingjruby.blogspot.nl 63
http://deployingjruby.blogspot.pt 58
http://deployingjruby.blogspot.sg 55
http://deployingjruby.blogspot.ch 50
http://deployingjruby.blogspot.mx 48
http://deployingjruby.blogspot.fi 44
http://deployingjruby.blogspot.be 43
http://deployingjruby.blogspot.cz 39
http://deployingjruby.blogspot.co.nz 38
http://deployingjruby.blogspot.co.at 31
http://deployingjruby.blogspot.kr 25
http://deployingjruby.blogspot.hu 24
http://deployingjruby.blogspot.hk 24
http://deployingjruby.blogspot.com.ar 23
http://deployingjruby.blogspot.gr 23
http://deployingjruby.blogspot.ie 22
http://deployingjruby.blogspot.tw 19
http://deployingjruby.blogspot.co.il 17
http://deployingjruby.blogspot.no 16
http://deployingjruby.blogspot.dk 16
http://deployingjruby.blogspot.sk 13
http://deployingjruby.blogspot.ro 11
http://deployingjruby.blogspot.com.tr 5
http://webcache.googleusercontent.com 5
http://news.google.com 3
http://www.deployingjruby.blogspot.de 3
http://deployingjruby.blogspot.ae 2
http://feedwrangler.net 1
http://cloud.feedly.com 1
http://newsblur.com 1
http://feedly.com 1
http://safe.tumblr.com 1
http://prlog.ru 1
More...

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
  • 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
  • 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
  • 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
  • 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
  • Interesting question: is this thread-safe on MRI?\n\nIt depends. Do you care about the order of the data array?\n
  • Interesting question: is this thread-safe on MRI?\n\nIt depends. Do you care about the order of the data array?\n
  • 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
  • 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
  • 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
  • \n
  • \n
  • \n
  • Archive File / Capistrano\nBackground Jobs\nClustering\nPaaS\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • 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

Deploying with JRuby Presentation Transcript

  • 1. Deploying with JRuby with Joe Kutner
  • 2. HTTP Request Apache/Nginx MRI MRIMongrel Mongrel
  • 3. Ruby Ruby RubyThread Thread Thread GIL Kernel Thread
  • 4. HTTP Request Apache/Nginx JVMJRuby Thread
  • 5. MRIM = N = 16...data.size #=> 256data.compact.size #=> 256
  • 6. MRI JRubyM = N = 16 M = N = 16... ...data.size #=> 256 data.size #=> 244data.compact.size #=> 256 data.compact.size #=> 229
  • 7. MRI15.61682215.675064
  • 8. MRI JRuby15.616822 7.77000015.675064 4.245000
  • 9. Deployment
  • 10. PeopleProcesses Technologies
  • 11. Archive File CapistranoBackground Jobs Clustering PaaS
  • 12. Warbler Trinidad TorqueBoxArchive File Archive File Capistrano Capistrano Background Jobs Background Jobs Clustering PaaS PaaS
  • 13. Warbler$ warble war
  • 14. Warbler Tomcat/Jetty ServerWAR SSH/FTP/SMBFile
  • 15. Trinidad$ rails s trinidad or$ rackup -s trinidad
  • 16. Trinidad Trinidadapp1/ 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
  • 17. TorqueBox $ torquebox run then$ torquebox deploy
  • 18. TorqueBox TorqueBox Job Schedulerapp1/|-- app/|-- config/|-- db/ Capistrano Messaging|-- lib/`-- config.ru Session Replication High Availability Knob SSH/FTP/SMB File Services Stomplets Clustering
  • 19. TorqueBox Cluster TorqueBox TorqueBox TorqueBox TorqueBox TorqueBox TorqueBox
  • 20. AlternativesGoogle AppEngineKirkMizuno
  • 21. Which Strategy is right for me? People Process Technology