Caelum dicas web 2010

2,388
-1

Published on

Palestra sobre Dicas de desenvolvimento Web na Caelum, em Abril de 2010.

Published in: Technology
1 Comment
5 Likes
Statistics
Notes
No Downloads
Views
Total Views
2,388
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
64
Comments
1
Likes
5
Embeds 0
No embeds

No notes for slide

Caelum dicas web 2010

  1. 1. A apresentação já vai começar ... Friday, April 16, 2010
  2. 2. AkitaOnRails.com Friday, April 16, 2010
  3. 3. ~ 50 min ~ 85 slides Friday, April 16, 2010
  4. 4. www.slideshare.net/akitaonrails http://dl.dropbox.com/u/1732133/dicas-de-desenvolvimento-web-com-rails.zip fabioakita@gmail.com Friday, April 16, 2010
  5. 5. Entendendo a Web Dicas sobre Desenvolvimento Web com Ruby Fabio Akita Friday, April 16, 2010
  6. 6. Friday, April 16, 2010
  7. 7. Recapitulando ... Friday, April 16, 2010
  8. 8. Rails não Escala Friday, April 16, 2010
  9. 9. (TM) Rails não Escala Friday, April 16, 2010
  10. 10. Friday, April 16, 2010
  11. 11. Friday, April 16, 2010
  12. 12. Blaine Cook http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter Friday, April 16, 2010
  13. 13. Para colocar as coisas em perspectiva, o Friendster foi escrito em Java e eles mudaram para PHP. MySpace foi escrito em ColdFusion e eles mudaram para ASP.NET. Blaine Cook http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter Friday, April 16, 2010
  14. 14. Para colocar as coisas em perspectiva, o Friendster foi escrito em Java e eles mudaram para PHP. MySpace foi escrito em ColdFusion e eles mudaram para ASP.NET. Quando as pessoas caem em problemas de escalabilidade, normalmente acham que a linguagem é o problema, mas eu acho que isso raramente é a realidade. Blaine Cook http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter Friday, April 16, 2010
  15. 15. “O The New York Times usou Ruby on Rails para agregar, analizar e mostrar os resultados das eleições em quase tempo real em um de seus sites mais acessados de todos os tempos.” http://www.computerworld.com.au/article/268003/ruby_rails_rolls_into_enterprise?fp=16&fpid=1 Friday, April 16, 2010
  16. 16. “O The New York Times usou Ruby on Rails para agregar, analizar e mostrar os resultados das eleições em quase tempo real em um de seus sites mais acessados de todos os tempos.” http://www.computerworld.com.au/article/268003/ruby_rails_rolls_into_enterprise?fp=16&fpid=1 Friday, April 16, 2010
  17. 17. Browser Web Server MySQL Friday, April 16, 2010
  18. 18. Browser Varnish/HAProxy Web Server MySQL Friday, April 16, 2010
  19. 19. Browser Varnish/HAProxy Web Server Memcached MySQL Friday, April 16, 2010
  20. 20. Browser Varnish/HAProxy Web Server Memcached MySQL CouchDB/MongoDB Friday, April 16, 2010
  21. 21. Ruby é Lento Friday, April 16, 2010
  22. 22. (TM) Ruby é Lento Friday, April 16, 2010
  23. 23. Existem mentiras, mentiras malditas e estatísticas. Friday, April 16, 2010
  24. 24. Existem mentiras, mentiras malditas e estatísticas. Friday, April 16, 2010
  25. 25. Existem mentiras, mentiras malditas e estatísticas. Friday, April 16, 2010
  26. 26. Friday, April 16, 2010
  27. 27. x mais lento que C++ Friday, April 16, 2010
  28. 28. x mais lento que C++ 0 32.5 65 97.5 130 Python 2 Ruby 1.9 JRuby Perl Python 3 PHP Ruby 1.8 Friday, April 16, 2010
  29. 29. Homepage: 331 ms Friday, April 16, 2010
  30. 30. Homepage: 331 ms Total: 5.45 s Friday, April 16, 2010
  31. 31. Performance != Escalabilidade Friday, April 16, 2010
  32. 32. Exemplo Friday, April 16, 2010
  33. 33. Friday, April 16, 2010
  34. 34. Friday, April 16, 2010
  35. 35. Friday, April 16, 2010
  36. 36. Friday, April 16, 2010
  37. 37. Friday, April 16, 2010
  38. 38. Friday, April 16, 2010
  39. 39. Friday, April 16, 2010
  40. 40. Friday, April 16, 2010
  41. 41. Friday, April 16, 2010
  42. 42. 6 Técnicas Friday, April 16, 2010
  43. 43. Menos Requisições Friday, April 16, 2010
  44. 44. Mini que CSS e Javascript Friday, April 16, 2010
  45. 45. Juicer http://github.com/cjohansen/juicer/ Friday, April 16, 2010
  46. 46. gem install juicer script/plugin install git://github.com/ktheory/juicer-rails.git Friday, April 16, 2010
  47. 47. gem install juicer script/plugin install git://github.com/ktheory/juicer-rails.git Friday, April 16, 2010
  48. 48. juicer install yuicompressor juicer install jslint juicer install closure_compiler Friday, April 16, 2010
  49. 49. juicer install yuicompressor juicer install jslint juicer install closure_compiler Friday, April 16, 2010
  50. 50. juicer install yuicompressor juicer install jslint juicer install closure_compiler Friday, April 16, 2010
  51. 51. /app/views/layouts/application.html.erb <%= juiced_tag '/stylesheets/application.css' %> <%= yield(:head) %> </head> <body> ... <%= juiced_tag '/javascripts/application.js' %> </body> Friday, April 16, 2010
  52. 52. /app/views/layouts/application.html.erb <%= juiced_tag '/stylesheets/application.css' %> <%= yield(:head) %> </head> <body> ... <%= juiced_tag '/javascripts/application.js' %> </body> Friday, April 16, 2010
  53. 53. /public/stylesheets/application.css @import url("reset.css"); @import url("base.css"); @import url("fonts.css"); ... /public/javascripts/application.js /* @depends jquery-1.4.min.js @depends jquery.edit_in_place.js @depends jqueryamail.js */ ... Friday, April 16, 2010
  54. 54. /public/stylesheets/application.css @import url("reset.css"); @import url("base.css"); @import url("fonts.css"); ... /public/javascripts/application.js /* @depends jquery-1.4.min.js @depends jquery.edit_in_place.js @depends jqueryamail.js */ ... Friday, April 16, 2010
  55. 55. juicer merge public/stylesheets/application.css public/stylesheets/application.min.css juicer merge -i public/javascripts/application.js public/javascripts/application.min.js Friday, April 16, 2010
  56. 56. juicer merge public/stylesheets/application.css public/stylesheets/application.min.css juicer merge -i public/javascripts/application.js public/javascripts/application.min.js Friday, April 16, 2010
  57. 57. juicer merge public/stylesheets/application.css public/stylesheets/application.min.css juicer merge -i public/javascripts/application.js public/javascripts/application.min.js Friday, April 16, 2010
  58. 58. juicer merge public/stylesheets/application.css public/stylesheets/application.min.css juicer merge -i public/javascripts/application.js public/javascripts/application.min.js Friday, April 16, 2010
  59. 59. DEVELOPMENT Friday, April 16, 2010
  60. 60. PRODUCTION Friday, April 16, 2010
  61. 61. Asset Hosts Navegadores abrem poucas conexões simultâneas por domínio Friday, April 16, 2010
  62. 62. Friday, April 16, 2010
  63. 63. /app/controllers/hello_controller.rb def gallery gallery_path = File.join(Rails.root, "public/images/gallery/") @images = Dir.glob(gallery_path + "*").map{ |f| f.gsub(gallery_path, "") } end Friday, April 16, 2010
  64. 64. /app/controllers/hello_controller.rb def gallery gallery_path = File.join(Rails.root, "public/images/gallery/") @images = Dir.glob(gallery_path + "*").map{ |f| f.gsub(gallery_path, "") } end /app/views/hello/gallery.html.erb <% title "Gallery" %> <% @images.each do |image| -%> <%= image_tag "gallery/#{image}" %> <% end -%> Friday, April 16, 2010
  65. 65. /app/controllers/hello_controller.rb def gallery gallery_path = File.join(Rails.root, "public/images/gallery/") @images = Dir.glob(gallery_path + "*").map{ |f| f.gsub(gallery_path, "") } end /app/views/hello/gallery.html.erb <% title "Gallery" %> <% @images.each do |image| -%> <%= image_tag "gallery/#{image}" %> <% end -%> Friday, April 16, 2010
  66. 66. DEVELOPMENT Friday, April 16, 2010
  67. 67. DEVELOPMENT Friday, April 16, 2010
  68. 68. /con g/environments/production.rb config.action_controller.asset_host = Proc.new do |source, request| protocol = if request.ssl? request.headers["USER_AGENT"] =~ /(Safari)/ ? "http" : "https" else "http" end "#{protocol}://asset#{rand(6) + 1}.akitaonrails.local:3000" end Friday, April 16, 2010
  69. 69. /con g/environments/production.rb config.action_controller.asset_host = Proc.new do |source, request| protocol = if request.ssl? request.headers["USER_AGENT"] =~ /(Safari)/ ? "http" : "https" else "http" end "#{protocol}://asset#{rand(6) + 1}.akitaonrails.local:3000" end Friday, April 16, 2010
  70. 70. /etc/hosts ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 127.0.0.1 asset1.akitaonrails.local asset2.akitaonrails.local asset3.akitaonrails.local asset4.akitaonrails.local asset5.akitaonrails.local asset6.akitaonrails.local www.akitaonrails.local Friday, April 16, 2010
  71. 71. PRODUCTION Friday, April 16, 2010
  72. 72. PRODUCTION Friday, April 16, 2010
  73. 73. Javascript embaixo! Friday, April 16, 2010
  74. 74. /app/views/layouts/application.html.erb <head> <title><%= h(yield(:title) || "Untitled") %></title> <%= stylesheet_link_tag 'application' %> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/ CFInstall.min.js" type="text/javascript"></script> <%= yield(:head) %> </head> <body> ... Friday, April 16, 2010
  75. 75. /app/views/layouts/application.html.erb <head> <title><%= h(yield(:title) || "Untitled") %></title> <%= stylesheet_link_tag 'application' %> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/ CFInstall.min.js" type="text/javascript"></script> <%= yield(:head) %> </head> <body> ... Friday, April 16, 2010
  76. 76. /app/views/layouts/application.html.erb ... <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/ CFInstall.min.js" type="text/javascript"></script> <script type="text/javascript"> // meu javascript customizado ... </script> </body> </html> Friday, April 16, 2010
  77. 77. /app/views/layouts/application.html.erb ... <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/ CFInstall.min.js" type="text/javascript"></script> <script type="text/javascript"> // meu javascript customizado ... </script> </body> </html> Friday, April 16, 2010
  78. 78. Gzip Friday, April 16, 2010
  79. 79. a2enmod de ate editar /etc/apache2/mods-available/de ate.conf Friday, April 16, 2010
  80. 80. a2enmod de ate editar /etc/apache2/mods-available/de ate.conf Friday, April 16, 2010
  81. 81. /etc/apache2/mods-available/de ate.conf <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-httpd-php AddOutputFilterByType DEFLATE application/x-httpd-fastphp AddOutputFilterByType DEFLATE application/x-httpd-eruby DeflateCompressionLevel 9 # Netscape 4.X has some problems BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch bMSIE !no-gzip !gzip-only-text/html </IfModule> Friday, April 16, 2010
  82. 82. Cabeçalhos de Expiração Friday, April 16, 2010
  83. 83. a2enmod expires editar /etc/apache2/mods-available/expires.conf Friday, April 16, 2010
  84. 84. a2enmod expires editar /etc/apache2/mods-available/expires.conf Friday, April 16, 2010
  85. 85. /etc/apache2/mods-available/expires.conf <IfModule mod_expires.c> ExpiresByType image/x-icon "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType application/pdf "access plus 1 year" ExpiresByType audio/x-wav "access plus 1 year" ExpiresByType audio/mpeg "access plus 1 year" ExpiresByType video/mpeg "access plus 1 year" ExpiresByType video/mp4 "access plus 1 year" ExpiresByType video/quicktime "access plus 1 year" ExpiresByType video/x-ms-wmv "access plus 1 year" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType text/css "access plus 1 year" ExpiresByType text/javascript "access plus 1 year" </IfModule> Friday, April 16, 2010
  86. 86. Cache Busters Friday, April 16, 2010
  87. 87. /app/views/layouts/application.html.erb <%= stylesheet_link_tag 'application' %> <%= javascript_include_tag 'application' %> <%= image_tag "logo.png" %> Friday, April 16, 2010
  88. 88. /app/views/layouts/application.html.erb <link href="/stylesheets/application.css?1264345891" media="screen" rel="stylesheet" type="text/css" /> <script src="/javascripts/application.js?1264345058" type="text/javascript"></script> <img alt="Logo" src="/images/logo.png?1268943058" /> Friday, April 16, 2010
  89. 89. /app/views/layouts/application.html.erb <link href="/stylesheets/application.css?1264345891" media="screen" rel="stylesheet" type="text/css" /> <script src="/javascripts/application.js?1264345058" type="text/javascript"></script> <img alt="Logo" src="/images/logo.png?1268943058" /> Friday, April 16, 2010
  90. 90. Use CDNs Friday, April 16, 2010
  91. 91. /app/views/layouts/application.html.erb <script src="/javascripts/jquery-1.4.min.js" type="text/javascript"></script> <script src="/javascripts/jquery-ui-1.7.2.min.js" type="text/javascript"></script> <script src="/javascripts/swfobject-2.2.js" type="text/javascript"></script> <script src="/javascripts/CFInstall-1.0.2.min.js" type="text/javascript"></script> Friday, April 16, 2010
  92. 92. /app/views/layouts/application.html.erb <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js" type="text/javascript"></script> Friday, April 16, 2010
  93. 93. /app/views/layouts/application.html.erb <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js" type="text/javascript"></script> Friday, April 16, 2010
  94. 94. Search Friday, April 16, 2010
  95. 95. select * from ... where ... like “%...%” Friday, April 16, 2010
  96. 96. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Friday, April 16, 2010
  97. 97. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Friday, April 16, 2010
  98. 98. Friday, April 16, 2010
  99. 99. Open Source Enterprise Search Platform Baseado no famoso Lucene Full Text Search, com relevância Indexa documentos (Word, PDF, etc) Interface REST Roda em containers de Servlet (Tomcat) Friday, April 16, 2010
  100. 100. Open Source Enterprise Search Platform Baseado no famoso Lucene Full Text Search, com relevância Indexa documentos (Word, PDF, etc) Interface REST Roda em containers de Servlet (Tomcat) Friday, April 16, 2010
  101. 101. Open Source Enterprise Search Platform Baseado no famoso Lucene Full Text Search, com relevância Indexa documentos (Word, PDF, etc) Interface REST Roda em containers de Servlet (Tomcat) Friday, April 16, 2010
  102. 102. Open Source Enterprise Search Platform Baseado no famoso Lucene Full Text Search, com relevância Indexa documentos (Word, PDF, etc) Interface REST Roda em containers de Servlet (Tomcat) Friday, April 16, 2010
  103. 103. Open Source Enterprise Search Platform Baseado no famoso Lucene Full Text Search, com relevância Indexa documentos (Word, PDF, etc) Interface REST Roda em containers de Servlet (Tomcat) Friday, April 16, 2010
  104. 104. Open Source Enterprise Search Platform Baseado no famoso Lucene Full Text Search, com relevância Indexa documentos (Word, PDF, etc) Interface REST Roda em containers de Servlet (Tomcat) Friday, April 16, 2010
  105. 105. Friday, April 16, 2010
  106. 106. Friday, April 16, 2010
  107. 107. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Friday, April 16, 2010
  108. 108. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Friday, April 16, 2010
  109. 109. Tarefas Assíncronas Friday, April 16, 2010
  110. 110. Friday, April 16, 2010
  111. 111. Requisição Friday, April 16, 2010
  112. 112. Processamento Requisição Friday, April 16, 2010
  113. 113. Processamento Requisição Resposta Friday, April 16, 2010
  114. 114. Crontab Friday, April 16, 2010
  115. 115. Friday, April 16, 2010
  116. 116. RMagick Friday, April 16, 2010
  117. 117. Friday, April 16, 2010
  118. 118. Friday, April 16, 2010
  119. 119. Redis Workers Resque-Web Friday, April 16, 2010
  120. 120. Friday, April 16, 2010
  121. 121. Friday, April 16, 2010
  122. 122. 291 s Processamento Requisição Friday, April 16, 2010
  123. 123. 32 s Processamento Requisição Resposta Worker Friday, April 16, 2010
  124. 124. Friday, April 16, 2010
  125. 125. Imagens Relatórios Web Services Transações Friday, April 16, 2010
  126. 126. Imagens Relatórios Web Services Transações Friday, April 16, 2010
  127. 127. Imagens Relatórios Web Services Transações Friday, April 16, 2010
  128. 128. Imagens Relatórios Web Services Transações Friday, April 16, 2010
  129. 129. Aprendendo Mais Friday, April 16, 2010
  130. 130. RAILS LABS Friday, April 16, 2010
  131. 131. RAILSCASTS.com Friday, April 16, 2010
  132. 132. caelum.com.br Friday, April 16, 2010
  133. 133. egenial.com.br Friday, April 16, 2010
  134. 134. Friday, April 16, 2010
  135. 135. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Friday, April 16, 2010
  136. 136. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Friday, April 16, 2010
  137. 137. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Friday, April 16, 2010
  138. 138. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Friday, April 16, 2010
  139. 139. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Friday, April 16, 2010
  140. 140. Friday, April 16, 2010
  141. 141. Thx! www.slideshare.net/akitaonrails http://dl.dropbox.com/u/1732133/dicas-de-desenvolvimento-web-com-rails.zip fabioakita@gmail.com Friday, April 16, 2010
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×