Your SlideShare is downloading. ×
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Fisl - Deployment
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Fisl - Deployment

1,856

Published on

Histórico das maneiras de deployment de Ruby on Rails, até o Passenger, na FISL em Porto Alegre.

Histórico das maneiras de deployment de Ruby on Rails, até o Passenger, na FISL em Porto Alegre.

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

No Downloads
Views
Total Views
1,856
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
29
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Deployment de Rails Fabio Akita www.akitaonrails.com
  • 2. Deployment de Rails
  • 3. +7000 pessoas no WWR
  • 4. +7000 pessoas no WWR +3 anos
  • 5. +7000 pessoas no WWR +3 anos +8M hits no Google
  • 6. “Rails Escala?”
  • 7. “Sim, Rails Escala!”
  • 8. Rails 1.0 em 2005
  • 9. Rails 1.0 em 2005 MySQL
  • 10. Rails 1.0 em 2005 MySQL LightTPD + Fast CGI
  • 11. Database/Storage
  • 12. Database/Storage “Rails Stack”
  • 13. Database/Storage “Rails Stack” HTTP Server/Load Balancer
  • 14. Database
  • 15. MySQL PostgreSQL Oracle/SQL Server/Informix/Sybase ...
  • 16. MySQL PostgreSQL Oracle/SQL Server/Informix/Sybase ... MEMCACHED
  • 17. Rails App Database
  • 18. Rails App Database
  • 19. MEMCACHED Rails App Database
  • 20. MEMCACHED Rails App Database Slave
  • 21. class Post < ActiveRecord::Base end
  • 22. class Post < ActiveRecord::Base acts_as_cached after_destroy :expire_cache end
  • 23. http://errtheblog.com/posts/57-kickin-ass-w-cachefu
  • 24. HTTP Servers
  • 25. Maduro Apache 2.x Mais “pesado”
  • 26. Maduro Apache 2.x Mais “pesado” Nginx 0.5 Rápido
  • 27. Maduro Apache 2.x Mais “pesado” Nginx 0.5 Rápido Rápido Litespeed 3.x Comercial
  • 28. FastCGI Instável
  • 29. FastCGI Instável SAPI Rápido
  • 30. FastCGI Instável SAPI Rápido HTTP Estável Proxy Reverso
  • 31. FastCGI Instável SAPI Rápido HTTP Estável Proxy Reverso mod_rails recém-chegado
  • 32. HTTP “Rails Stack” Server
  • 33. FCGI HTTP “Rails Stack” Server
  • 34. FCGI HTTP SAPI “Rails Stack” Server
  • 35. FCGI HTTP SAPI “Rails Stack” Server HTTP
  • 36. “Rails Stack” FCGI HTTP SAPI “Rails Stack” Server HTTP “Rails Stack”
  • 37. Rails Stack
  • 38. “Rails Stack”
  • 39. “Rails Stack” Ruby VM (MRI)
  • 40. “Rails Stack” RubyGems Ruby VM (MRI)
  • 41. Ruby on Rails “Rails Stack” RubyGems Ruby VM (MRI)
  • 42. Ruby on Rails Mongrel “Rails Stack” RubyGems Ruby VM (MRI)
  • 43. Rails, ActiveSupport, ActiveRecord, ActionPack
  • 44. Rails, ActiveSupport, ActiveRecord, ActionPack ActionMailer, ActiveResource, ActionWS
  • 45. Rails, ActiveSupport, ActiveRecord, ActionPack ActionMailer, ActiveResource, ActionWS Capistrano, Net-SSH, Net-SFTP
  • 46. Rails, ActiveSupport, ActiveRecord, ActionPack ActionMailer, ActiveResource, ActionWS Capistrano, Net-SSH, Net-SFTP Mongrel, Mongrel Cluster
  • 47. Rails, ActiveSupport, ActiveRecord, ActionPack ActionMailer, ActiveResource, ActionWS Capistrano, Net-SSH, Net-SFTP Mongrel, Mongrel Cluster Rmagick, Mini Magick, Image Science
  • 48. Rails, ActiveSupport, ActiveRecord, ActionPack ActionMailer, ActiveResource, ActionWS Capistrano, Net-SSH, Net-SFTP Mongrel, Mongrel Cluster Rmagick, Mini Magick, Image Science Rspec, ZenTest
  • 49. Mongrel Multi-threaded
  • 50. Mongrel Multi-threaded Rails Non-concurrent
  • 51. Mongrel
  • 52. Ruby on Rails Mongrel
  • 53. Outras Gems Ruby on Rails Mongrel
  • 54. Sua Applicação Outras Gems Ruby on Rails Mongrel
  • 55. “Rails Stack”
  • 56. Mongrel Cluster
  • 57. Mongrel Cluster Load Balancer
  • 58. Monit God
  • 59. objetos Ruby VM
  • 60. objetos objetos Ruby VM
  • 61. GC objetos objetos Ruby VM
  • 62. objetos objetos Ruby VM
  • 63. Memória Livre não desalocada objetos objetos Ruby VM
  • 64. Monit Rails App
  • 65. Rails App Monit
  • 66. Monit Rails App
  • 67. Load Balancer
  • 68. Rails + Mongrel Rails + Mongrel Rails + Mongrel Load Balancer Rails + Mongrel Rails + Mongrel Rails + Mongrel
  • 69. Capistrano
  • 70. capify . cap setup cap deploy cap rollback
  • 71. capify . set :application, quot;mey_aplicativoquot; set :repository, quot;git://server.com/projeto.gitquot; set :deploy_to, quot;/var/www/#{application}quot; cap setup default_run_options[:pty] = true set :repository, quot;git@github.com:user/rails-app.gitquot; set :scm, quot;gitquot; set :scm_passphrase, quot;p00pquot; set :user, quot;deployerquot; cap deploy set :branch, quot;origin/masterquot; set :deploy_via, :remote_cache set :git_shallow_clone, 1 set :git_enable_submodules, 1 cap rollback
  • 72. capify . cap setup cap deploy cap rollback
  • 73. capify . cap setup cap deploy cap rollback
  • 74. capify . cap setup cap deploy cap rollback
  • 75. Desktop
  • 76. SCM (Git) Desktop
  • 77. SCM (Git) Desktop
  • 78. SCM (Git) Desktop
  • 79. SCM Staging (Git) Cap Desktop
  • 80. SCM Staging (Git) Cap Desktop
  • 81. SCM Staging (Git) Cap Desktop
  • 82. SCM Staging (Git) Cap Desktop Production Cap
  • 83. SCM Staging (Git) Cap Desktop Production Cap
  • 84. SCM Staging (Git) Cap Desktop Production Cap
  • 85. SCM Desktop (Git)
  • 86. SCM Desktop (Git) Production Production Production Production Cap Cap Cap Cap Production Production Production Production Cap Cap Cap Cap
  • 87. http://capify.org/
  • 88. Quantos Mongrels?
  • 89. Apache Bench • Blog Demo • Post resource • (1 query, 20 rows)
  • 90. Apache Bench
  • 91. Apache Bench ab -n 1000 http://127.0.0.1:3000/posts
  • 92. Apache Bench ab -n 1000 http://127.0.0.1:3000/posts 1 conexão 1000 requisições
  • 93. Apache Bench ab -n 5000 -c 10 http://127.0.0.1:3000/posts
  • 94. Apache Bench ab -n 5000 -c 10 http://127.0.0.1:3000/posts 10 conexões 5000 requisições
  • 95. Nginx - 3 Mongrels
  • 96. Nginx - 3 Mongrels req/s (mean) 1000 requests 1 conexão 5000 requests 10 conexões
  • 97. Nginx - 3 Mongrels req/s (mean) Hello World 1000 requests 414.56 1 conexão 5000 requests 701.88 10 conexões
  • 98. Nginx - 3 Mongrels Posts req/s (mean) Hello World (puro) 1000 requests 414.56 24.44 1 conexão 5000 requests 701.88 39.31 10 conexões
  • 99. Nginx - 3 Mongrels Posts Posts req/s (mean) Hello World (page (puro) cache) 1000 requests 414.56 24.44 1587.31 1 conexão 5000 requests 701.88 39.31 2220.24 10 conexões
  • 100. Nginx - 3 Mongrels Posts Posts Posts req/s (mean) Hello World (page (action (puro) cache) cache) 1000 requests 414.56 24.44 1587.31 106.29 1 conexão 5000 requests 701.88 39.31 2220.24 96.81 10 conexões
  • 101. Memória
  • 102. Memória 1 Mongrel, ~30 Mb 1 Rails vazio
  • 103. Memória 1 Mongrel, ~30 Mb 1 Rails vazio 1 Mongrel, ~70Mb 1 Mephisto
  • 104. http://www.scribd.com/doc/97641/ JHoffmanRailsConfMay2007
  • 105. Estratégias
  • 106. Rails Cache (Page/Action/Fragment)
  • 107. Rails Cache (Page/Action/Fragment) MEMCACHED
  • 108. Rails Cache (Page/Action/Fragment) MEMCACHED Asynchronous Processes (BackgrounDRb, cronjobs, etc)
  • 109. class PostsController < Application def action # código lento end end # http://www.site.com/posts
  • 110. class PostsController < Application def action PERIGO! # código lento end end # http://www.site.com/posts
  • 111. class PostsController < Application def action MiddleMan.new_worker( :class => :heavy) end end class Heavy < BackgrounDRb::Worker::RailsBase def do_work(options) # código lento end end
  • 112. Tempo de Execução Rails Request
  • 113. Tempo de Execução Rails Request CACHE
  • 114. Tempo de Execução Rails Request
  • 115. Tempo de Execução Rails Request Async
  • 116. Tempo de Execução Rails Request Outros
  • 117. 920 pageviews/dia ~30 req/s pico USD 370/mês
  • 118. Deployment comum
  • 119. Cap
  • 120. Nginx Cap
  • 121. MySQL Nginx Cap
  • 122. MySQL Nginx Memcached Cap
  • 123. MySQL Nginx Memcached Cap Git
  • 124. Desafios
  • 125. Performance Green Threads x Native Thread + GIL Memory Management C Extensions Interoperability
  • 126. Performance Green Threads x Native Thread + GIL Memory Management C Extensions Interoperability
  • 127. Performance Green Threads x Native Thread + GIL Memory Management C Extensions Interoperability
  • 128. Performance Green Threads x Native Thread + GIL Memory Management C Extensions Interoperability
  • 129. Performance Green Threads x Native Thread + GIL Memory Management C Extensions Interoperability
  • 130. Instalação
  • 131. Instalação aptitude install apache2 apache2­mpm­prefork  ruby1.8 dev apache2­prefork­dev gem install passenger ./passenger­install­apache2­module cd /var/www ; rails .
  • 132. Instalação aptitude install apache2 apache2­mpm­prefork  ruby1.8 dev apache2­prefork­dev gem install passenger ./passenger­install­apache2­module cd /var/www ; rails .
  • 133. Instalação aptitude install apache2 apache2­mpm­prefork  ruby1.8 dev apache2­prefork­dev gem install passenger ./passenger­install­apache2­module cd /var/www ; rails .
  • 134. Instalação aptitude install apache2 apache2­mpm­prefork  ruby1.8 dev apache2­prefork­dev gem install passenger ./passenger­install­apache2­module cd /var/www ; rails .
  • 135. LoadModule passenger_module /opt/local/lib/ruby/gems/1.8/gems/ passenger-1.0.1/ext/apache2/mod_passenger.so RailsSpawnServer /opt/local/lib/ruby/gems/1.8/gems/passenger-1.0.1/bin/ passenger-spawn-server RailsRuby /opt/local/bin/ruby <Directory quot;/Users/akitaonrails/rails/blog/publicquot;> Order allow,deny Allow from all </Directory> <VirtualHost *:80> ServerName localhost DocumentRoot /Users/akitaonrails/rails/blog/public </VirtualHost>
  • 136. Benchmarks Mongrel Thin Passenger
  • 137. Benchmarks Mongrel Thin Passenger
  • 138. Obrigado! www.akitaonrails.com

×