A apresentação comecará em alguns minutos ...




Wednesday, January 27, 2010
A apresentação comecará em alguns minutos ...




Wednesday, January 27, 2010
AkitaOnRails.com




Wednesday, January 27, 2010
~1h
                              > 100 slides



Wednesday, January 27, 2010
www.slideshare.net/akitaonrails
            www.akitaonrails.com/ les/entendendo-a-web-movies.zip




                    ...
Entendendo a Web
                 Lições sobre Desenvolvimento Web com Ruby



                              Fabio Akita

...
Pensamento
                               Tradicional



Wednesday, January 27, 2010
Browser




                              Web Server




                               MySQL




Wednesday, January 27, 2...
Browser




                              Web Server




                               MySQL




Wednesday, January 27, 2...
Browser




                              Web Server




                               MySQL




Wednesday, January 27, 2...
/site/default.asp




Wednesday, January 27, 2010
/site/default.asp

                               include header




Wednesday, January 27, 2010
/site/default.asp

                               include header


                                  while ...




Wednesd...
/site/default.asp

                               include header


                                  while ...


         ...
/site/default.asp

                               include header


                                  while ...


         ...
Ruby?



Wednesday, January 27, 2010
Wednesday, January 27, 2010
Ruby on Rails             2.3

                          Ruby   1.8

        “Novo” Ruby              1.9
Wednesday, Janua...
Ruby on Rails             2.3

                          Ruby   1.8

        “Novo” Ruby              1.9
Wednesday, Janua...
Ruby on Rails             2.3

                          Ruby   1.8

        “Novo” Ruby              1.9
Wednesday, Janua...
x mais lento que C++




Wednesday, January 27, 2010
x mais lento que C++


    Python 2


     Ruby 1.9


          Perl


       JRuby


    Python 3


         PHP


   Rub...
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Wednesday, January 27, 2010
6


Wednesday, January 27, 2010
Menos Requisições



Wednesday, January 27, 2010
Wednesday, January 27, 2010
Wednesday, January 27, 2010
DEVELOPMENT

Wednesday, January 27, 2010
PRODUCTION

Wednesday, January 27, 2010
Mini que CSS e
                                Javascript



Wednesday, January 27, 2010
Juicer
                              http://github.com/cjohansen/juicer/




Wednesday, January 27, 2010
Wednesday, January 27, 2010
•     git clone git://github.com/cjohansen/
                     juicer.git




Wednesday, January 27, 2010
•     git clone git://github.com/cjohansen/
                     juicer.git

               •     cd juicer ; rake build

...
•     git clone git://github.com/cjohansen/
                     juicer.git

               •     cd juicer ; rake build

...
•     git clone git://github.com/cjohansen/
                     juicer.git

               •     cd juicer ; rake build

...
•     git clone git://github.com/cjohansen/
                     juicer.git

               •     cd juicer ; rake build

...
•     juicer install yuicompressor

               •     juicer install jslint




Wednesday, January 27, 2010
/app/views/layouts/application.html.erb




                  <%= juiced_tag '/stylesheets/application.css' %>
           ...
/app/views/layouts/application.html.erb




                  <%= juiced_tag '/stylesheets/application.css' %>
           ...
/public/stylesheets/application.css




                                @import url("reset.css");
                        ...
/public/stylesheets/application.css




                                @import url("reset.css");
                        ...
Wednesday, January 27, 2010
•     juicer merge public/stylesheets/
                     application.css

                   •     public/stylesheets/a...
•     juicer merge public/stylesheets/
                     application.css

                   •     public/stylesheets/a...
DEVELOPMENT

Wednesday, January 27, 2010
PRODUCTION

Wednesday, January 27, 2010
Asset Hosts
                              Navegadores abrem poucas conexões
                                   simultâneas...
Wednesday, January 27, 2010
/app/controllers/hello_controller.rb


          def gallery
             gallery_path = File.join(Rails.root, "public/ima...
/app/controllers/hello_controller.rb


          def gallery
             gallery_path = File.join(Rails.root, "public/ima...
/app/controllers/hello_controller.rb


          def gallery
             gallery_path = File.join(Rails.root, "public/ima...
DEVELOPMENT

Wednesday, January 27, 2010
DEVELOPMENT

Wednesday, January 27, 2010
/con g/environments/production.rb




    config.action_controller.asset_host = Proc.new do |source, request|
        prot...
/con g/environments/production.rb




    config.action_controller.asset_host = Proc.new do |source, request|
        prot...
/etc/hosts




    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the...
PRODUCTION

Wednesday, January 27, 2010
PRODUCTION

Wednesday, January 27, 2010
Javascript embaixo!



Wednesday, January 27, 2010
/app/views/layouts/application.html.erb



      <head>
        <title><%= h(yield(:title) || "Untitled") %></title>
     ...
/app/views/layouts/application.html.erb



      <head>
        <title><%= h(yield(:title) || "Untitled") %></title>
     ...
/app/views/layouts/application.html.erb



          ...
          <script src="http://ajax.googleapis.com/ajax/libs/jquer...
/app/views/layouts/application.html.erb



          ...
          <script src="http://ajax.googleapis.com/ajax/libs/jquer...
Gzip



Wednesday, January 27, 2010
•     a2enmod de ate

               •     editar /etc/apache2/mods-available/
                     de ate.conf




Wednes...
/etc/apache2/mods-available/de ate.conf


                      <IfModule mod_deflate.c>
                        AddOutput...
Cabeçalhos de
                                Expiração



Wednesday, January 27, 2010
•     a2enmod expires

               •     editar /etc/apache2/mods-available/
                     expires.conf




Wedn...
/etc/apache2/mods-available/expires.conf




                    <IfModule mod_expires.c>
                      ExpiresByT...
Cache Busters



Wednesday, January 27, 2010
/app/views/layouts/application.html.erb




                         <%= stylesheet_link_tag 'application' %>


          ...
/app/views/layouts/application.html.erb




                 <link href="/stylesheets/application.css?1264345891"
        ...
/app/views/layouts/application.html.erb




                 <link href="/stylesheets/application.css?1264345891"
        ...
Use CDNs



Wednesday, January 27, 2010
/app/views/layouts/application.html.erb




       <script src="/javascripts/jquery-1.4.min.js" type="text/javascript"></s...
/app/views/layouts/application.html.erb




    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min....
/app/views/layouts/application.html.erb




    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min....
Search



Wednesday, January 27, 2010
select * from ...
                where ... like “%...%”



Wednesday, January 27, 2010
select * from ...
                where ... like “%...%”
                 or ... like “%...%”
                 or ... like...
select * from ...
                where ... like “%...%”
                 or ... like “%...%”
                 or ... like...
Wednesday, January 27, 2010
•     Open Source Enterprise Search Platform

               •     Baseado no famoso Lucene

               •     Full Tex...
Wednesday, January 27, 2010
Wednesday, January 27, 2010
select * from ...
                where ... like “%...%”
                 or ... like “%...%”
                 or ... like...
select * from ...
                where ... like “%...%”
                 or ... like “%...%”
                 or ... like...
Rack
                                  A API mais simples possível que
                              representa uma aplica...
Server
                              HTTP




Wednesday, January 27, 2010
Server
              Request         HTTP




Wednesday, January 27, 2010
Server
              Request         HTTP




Wednesday, January 27, 2010
Server
              Request         HTTP




Wednesday, January 27, 2010
Server
              Request         HTTP     Response




Wednesday, January 27, 2010
lambda { |env|
          [200, {"Content-type" => "text/plain"}, "Hello World"] }




Wednesday, January 27, 2010
Requisição




        lambda { |env|
          [200, {"Content-type" => "text/plain"}, "Hello World"] }




Wednesday, Ja...
Requisição




        lambda { |env|
          [200, {"Content-type" => "text/plain"}, "Hello World"] }




             ...
Requisição




        lambda { |env|
          [200, {"Content-type" => "text/plain"}, "Hello World"] }




             ...
Requisição




        lambda { |env|
          [200, {"Content-type" => "text/plain"}, "Hello World"] }




             ...
Request                Response
                              Rack
               (env)                  (Array)




Wedne...
Request                      Response
                               Rack
               (env)                        (Arr...
Request           Rack




                              Rack




                              Rack   Response



Wednesd...
Request           Rack




                              Rack




                              Rack   Response



Wednesd...
Request           Rack




                              Rack




                              Rack   Response



Wednesd...
Request           Rack




                              Rack




                              Rack   Response



Wednesd...
Request           Rack




                              Rack




                              Rack   Response



Wednesd...
$ rake middleware

      use ActionDispatch::Static
      use Rack::Lock
      use Rack::Runtime
      use Rails::Rack::Lo...
gem install rack



Wednesday, January 27, 2010
con g.ru




         # run with 'rackup -p 9292 config.ru'
         require 'rubygems'
         require 'rack'


        ...
rackup con g.ru



Wednesday, January 27, 2010
Wednesday, January 27, 2010
Sinatra
                              http://www.sinatrarb.com/




Wednesday, January 27, 2010
Wednesday, January 27, 2010
Otimizações Backend



Wednesday, January 27, 2010
Wednesday, January 27, 2010
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Browser pede página
                     Se existir no cache, retorna
            Procura Rota
            Chama Controlle...
Apache2
          + mod_proxy_balancer

                              Squid

                              Varnish
Wednesd...
Memcached

                              MySQL Proxy

         Assíncrono (ex. Resque,
               RabbitMQ)
Wednesday,...
Load
                              Balancer




Wednesday, January 27, 2010
Load
                                      Balancer




                    App Server

                              Cach...
Load
                                       Balancer




                    App Server        App Server

               ...
Load
                                       Balancer




                    App Server        App Server      App Server
...
Load
                                       Balancer




                    App Server        App Server      App Server
...
Load
                                        Balancer




                    App Server         App Server      App Serve...
Load
                                        Balancer




                    App Server         App Server        App Ser...
Load
                                        Balancer




                    App Server         App Server        App Ser...
Load
                                        Balancer




                    App Server         App Server        App Ser...
Load
                                        Balancer




                    App Server         App Server        App Ser...
Tendências



Wednesday, January 27, 2010
C10K Problem



Wednesday, January 27, 2010
Wednesday, January 27, 2010
HTML 5

                              Web Sockets
                   Reactor/Deferrable
                        Pattern
We...
HTML 5

                              Web Sockets
                   Reactor/Deferrable
                        Pattern
We...
HTML 5

                              Web Sockets
                   Reactor/Deferrable
                        Pattern
We...
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Browser   Browser   Browser




                               App       App       App




                               ...
Browser   Browser   Browser




                               App       App       App




                               ...
Browser   Browser   Browser




                               App       App       App




                               ...
Browser   Browser   Browser




                               App       App       App




                               ...
Browser   Browser   Browser   Browser




                               App       App       App




                     ...
Browser   Browser   Browser   Browser




                               App       App       App
                         ...
Browser   Browser   Browser




                                        Banco




Wednesday, January 27, 2010
Browser       Browser        Browser




                                        conexões/eventos




                    ...
Browser       Browser        Browser




                                        conexões/eventos

                       ...
Browser       Browser        Browser




                                        conexões/eventos

                       ...
Browser       Browser        Browser




                                        conexões/eventos

                       ...
Browser       Browser        Browser




                                        conexões/eventos

                       ...
Browser       Browser        Browser   Browser




                                        conexões/eventos

             ...
Browser       Browser        Browser   Browser




                                        conexões/eventos

             ...
Browser                 Browser       Browser        Browser   Browser




                                        conexõe...
Browser                 Browser       Browser        Browser   Browser




                                        conexõe...
Browser                 Browser       Browser        Browser   Browser




                                        conexõe...
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Aprendendo Mais



Wednesday, January 27, 2010
RAILS LABS

Wednesday, January 27, 2010
Wednesday, January 27, 2010
RAILSCASTS.com

Wednesday, January 27, 2010
Wednesday, January 27, 2010
Wednesday, January 27, 2010
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

        ...
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

        ...
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

        ...
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

        ...
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

        ...
Wednesday, January 27, 2010
Thx!
       www.slideshare.net/akitaonrails
            www.akitaonrails.com/ les/entendendo-a-web-movies.zip




        ...
Upcoming SlideShare
Loading in...5
×

Campus Party 2010

2,184

Published on

Palestra sobre assuntos aleatórios de Ruby, otimização de sites com YSlow, EventMachine, Search com acts_as_solr_reloaded

Published in: Technology
3 Comments
4 Likes
Statistics
Notes
No Downloads
Views
Total Views
2,184
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
100
Comments
3
Likes
4
Embeds 0
No embeds

No notes for slide

Campus Party 2010

  1. 1. A apresentação comecará em alguns minutos ... Wednesday, January 27, 2010
  2. 2. A apresentação comecará em alguns minutos ... Wednesday, January 27, 2010
  3. 3. AkitaOnRails.com Wednesday, January 27, 2010
  4. 4. ~1h > 100 slides Wednesday, January 27, 2010
  5. 5. www.slideshare.net/akitaonrails www.akitaonrails.com/ les/entendendo-a-web-movies.zip fabio.akita@locaweb.com.br Wednesday, January 27, 2010
  6. 6. Entendendo a Web Lições sobre Desenvolvimento Web com Ruby Fabio Akita Wednesday, January 27, 2010
  7. 7. Pensamento Tradicional Wednesday, January 27, 2010
  8. 8. Browser Web Server MySQL Wednesday, January 27, 2010
  9. 9. Browser Web Server MySQL Wednesday, January 27, 2010
  10. 10. Browser Web Server MySQL Wednesday, January 27, 2010
  11. 11. /site/default.asp Wednesday, January 27, 2010
  12. 12. /site/default.asp include header Wednesday, January 27, 2010
  13. 13. /site/default.asp include header while ... Wednesday, January 27, 2010
  14. 14. /site/default.asp include header while ... Response.write Wednesday, January 27, 2010
  15. 15. /site/default.asp include header while ... Response.write include footer Wednesday, January 27, 2010
  16. 16. Ruby? Wednesday, January 27, 2010
  17. 17. Wednesday, January 27, 2010
  18. 18. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Wednesday, January 27, 2010
  19. 19. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Wednesday, January 27, 2010
  20. 20. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Wednesday, January 27, 2010
  21. 21. x mais lento que C++ Wednesday, January 27, 2010
  22. 22. x mais lento que C++ Python 2 Ruby 1.9 Perl JRuby Python 3 PHP Ruby 1.8.6 0 50 100 150 200 Wednesday, January 27, 2010
  23. 23. Wednesday, January 27, 2010
  24. 24. Wednesday, January 27, 2010
  25. 25. Wednesday, January 27, 2010
  26. 26. Wednesday, January 27, 2010
  27. 27. Wednesday, January 27, 2010
  28. 28. Wednesday, January 27, 2010
  29. 29. Wednesday, January 27, 2010
  30. 30. Wednesday, January 27, 2010
  31. 31. 6 Wednesday, January 27, 2010
  32. 32. Menos Requisições Wednesday, January 27, 2010
  33. 33. Wednesday, January 27, 2010
  34. 34. Wednesday, January 27, 2010
  35. 35. DEVELOPMENT Wednesday, January 27, 2010
  36. 36. PRODUCTION Wednesday, January 27, 2010
  37. 37. Mini que CSS e Javascript Wednesday, January 27, 2010
  38. 38. Juicer http://github.com/cjohansen/juicer/ Wednesday, January 27, 2010
  39. 39. Wednesday, January 27, 2010
  40. 40. • git clone git://github.com/cjohansen/ juicer.git Wednesday, January 27, 2010
  41. 41. • git clone git://github.com/cjohansen/ juicer.git • cd juicer ; rake build Wednesday, January 27, 2010
  42. 42. • git clone git://github.com/cjohansen/ juicer.git • cd juicer ; rake build • gem install pkg/juicer-0.9.9.gem Wednesday, January 27, 2010
  43. 43. • git clone git://github.com/cjohansen/ juicer.git • cd juicer ; rake build • gem install pkg/juicer-0.9.9.gem Wednesday, January 27, 2010
  44. 44. • git clone git://github.com/cjohansen/ juicer.git • cd juicer ; rake build • gem install pkg/juicer-0.9.9.gem • ./script/plugin install git://github.com/ ktheory/juicer-rails.git Wednesday, January 27, 2010
  45. 45. • juicer install yuicompressor • juicer install jslint Wednesday, January 27, 2010
  46. 46. /app/views/layouts/application.html.erb <%= juiced_tag '/stylesheets/application.css' %> <%= yield(:head) %> </head> <body> ... <%= juiced_tag '/javascripts/application.js' %> </body> Wednesday, January 27, 2010
  47. 47. /app/views/layouts/application.html.erb <%= juiced_tag '/stylesheets/application.css' %> <%= yield(:head) %> </head> <body> ... <%= juiced_tag '/javascripts/application.js' %> </body> Wednesday, January 27, 2010
  48. 48. /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 */ ... Wednesday, January 27, 2010
  49. 49. /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 */ ... Wednesday, January 27, 2010
  50. 50. Wednesday, January 27, 2010
  51. 51. • juicer merge public/stylesheets/ application.css • public/stylesheets/application.min.css Wednesday, January 27, 2010
  52. 52. • juicer merge public/stylesheets/ application.css • public/stylesheets/application.min.css • juicer merge -i public/javascripts/ application.js • public/javascripts/application.min.js Wednesday, January 27, 2010
  53. 53. DEVELOPMENT Wednesday, January 27, 2010
  54. 54. PRODUCTION Wednesday, January 27, 2010
  55. 55. Asset Hosts Navegadores abrem poucas conexões simultâneas por domínio Wednesday, January 27, 2010
  56. 56. Wednesday, January 27, 2010
  57. 57. /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 Wednesday, January 27, 2010
  58. 58. /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 -%> Wednesday, January 27, 2010
  59. 59. /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 -%> Wednesday, January 27, 2010
  60. 60. DEVELOPMENT Wednesday, January 27, 2010
  61. 61. DEVELOPMENT Wednesday, January 27, 2010
  62. 62. /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 Wednesday, January 27, 2010
  63. 63. /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 Wednesday, January 27, 2010
  64. 64. /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 Wednesday, January 27, 2010
  65. 65. PRODUCTION Wednesday, January 27, 2010
  66. 66. PRODUCTION Wednesday, January 27, 2010
  67. 67. Javascript embaixo! Wednesday, January 27, 2010
  68. 68. /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> ... Wednesday, January 27, 2010
  69. 69. /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> ... Wednesday, January 27, 2010
  70. 70. /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> Wednesday, January 27, 2010
  71. 71. /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> Wednesday, January 27, 2010
  72. 72. Gzip Wednesday, January 27, 2010
  73. 73. • a2enmod de ate • editar /etc/apache2/mods-available/ de ate.conf Wednesday, January 27, 2010
  74. 74. /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> Wednesday, January 27, 2010
  75. 75. Cabeçalhos de Expiração Wednesday, January 27, 2010
  76. 76. • a2enmod expires • editar /etc/apache2/mods-available/ expires.conf Wednesday, January 27, 2010
  77. 77. /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> Wednesday, January 27, 2010
  78. 78. Cache Busters Wednesday, January 27, 2010
  79. 79. /app/views/layouts/application.html.erb <%= stylesheet_link_tag 'application' %> <%= javascript_include_tag 'application' %> <%= image_tag "logo.png" %> Wednesday, January 27, 2010
  80. 80. /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" /> Wednesday, January 27, 2010
  81. 81. /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" /> Wednesday, January 27, 2010
  82. 82. Use CDNs Wednesday, January 27, 2010
  83. 83. /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> Wednesday, January 27, 2010
  84. 84. /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> Wednesday, January 27, 2010
  85. 85. /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> Wednesday, January 27, 2010
  86. 86. Search Wednesday, January 27, 2010
  87. 87. select * from ... where ... like “%...%” Wednesday, January 27, 2010
  88. 88. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Wednesday, January 27, 2010
  89. 89. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Wednesday, January 27, 2010
  90. 90. Wednesday, January 27, 2010
  91. 91. • 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) Wednesday, January 27, 2010
  92. 92. Wednesday, January 27, 2010
  93. 93. Wednesday, January 27, 2010
  94. 94. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Wednesday, January 27, 2010
  95. 95. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Wednesday, January 27, 2010
  96. 96. Rack A API mais simples possível que representa uma aplicação web genérica Wednesday, January 27, 2010
  97. 97. Server HTTP Wednesday, January 27, 2010
  98. 98. Server Request HTTP Wednesday, January 27, 2010
  99. 99. Server Request HTTP Wednesday, January 27, 2010
  100. 100. Server Request HTTP Wednesday, January 27, 2010
  101. 101. Server Request HTTP Response Wednesday, January 27, 2010
  102. 102. lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Wednesday, January 27, 2010
  103. 103. Requisição lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Wednesday, January 27, 2010
  104. 104. Requisição lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Status Wednesday, January 27, 2010
  105. 105. Requisição lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Status Cabeçalhos Wednesday, January 27, 2010
  106. 106. Requisição lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Status Cabeçalhos Corpo Wednesday, January 27, 2010
  107. 107. Request Response Rack (env) (Array) Wednesday, January 27, 2010
  108. 108. Request Response Rack (env) (Array) .call(env) Wednesday, January 27, 2010
  109. 109. Request Rack Rack Rack Response Wednesday, January 27, 2010
  110. 110. Request Rack Rack Rack Response Wednesday, January 27, 2010
  111. 111. Request Rack Rack Rack Response Wednesday, January 27, 2010
  112. 112. Request Rack Rack Rack Response Wednesday, January 27, 2010
  113. 113. Request Rack Rack Rack Response Wednesday, January 27, 2010
  114. 114. $ rake middleware use ActionDispatch::Static use Rack::Lock use Rack::Runtime use Rails::Rack::Logger use ActionDispatch::ShowExceptions use ActionDispatch::Callbacks use ActionDispatch::Cookies use ActionDispatch::Session::CookieStore use ActionDispatch::Flash use ActionDispatch::Cascade use ActionDispatch::ParamsParser use Rack::MethodOverride use ActionDispatch::Head use ActiveRecord::ConnectionAdapters::ConnectionManagement use ActiveRecord::QueryCache run Class Wednesday, January 27, 2010
  115. 115. gem install rack Wednesday, January 27, 2010
  116. 116. con g.ru # run with 'rackup -p 9292 config.ru' require 'rubygems' require 'rack' app = Proc.new { |env| [200, {"Content-Type" => "text/html"}, "Hello Rack!"] } run app Wednesday, January 27, 2010
  117. 117. rackup con g.ru Wednesday, January 27, 2010
  118. 118. Wednesday, January 27, 2010
  119. 119. Sinatra http://www.sinatrarb.com/ Wednesday, January 27, 2010
  120. 120. Wednesday, January 27, 2010
  121. 121. Otimizações Backend Wednesday, January 27, 2010
  122. 122. Wednesday, January 27, 2010
  123. 123. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  124. 124. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  125. 125. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  126. 126. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  127. 127. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  128. 128. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  129. 129. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  130. 130. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  131. 131. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  132. 132. Browser pede página Se existir no cache, retorna Procura Rota Chama Controller Executa Ação Comunica com Banco de Dados Se existir no cache, pula Se processar assíncrono, pula Renderiza View Retorna resultado ao Browser Wednesday, January 27, 2010
  133. 133. Apache2 + mod_proxy_balancer Squid Varnish Wednesday, January 27, 2010
  134. 134. Memcached MySQL Proxy Assíncrono (ex. Resque, RabbitMQ) Wednesday, January 27, 2010
  135. 135. Load Balancer Wednesday, January 27, 2010
  136. 136. Load Balancer App Server Cache Wednesday, January 27, 2010
  137. 137. Load Balancer App Server App Server Cache Cache Wednesday, January 27, 2010
  138. 138. Load Balancer App Server App Server App Server Cache Cache Cache Wednesday, January 27, 2010
  139. 139. Load Balancer App Server App Server App Server Cache Cache Cache Wednesday, January 27, 2010
  140. 140. Load Balancer App Server App Server App Server Cache Cache Cache MySQL Master Wednesday, January 27, 2010
  141. 141. Load Balancer App Server App Server App Server Cache Cache Cache MySQL MySQL MySQL Master Slave Slave Wednesday, January 27, 2010
  142. 142. Load Balancer App Server App Server App Server Cache Cache Cache MySQL Proxy MySQL MySQL MySQL Master Slave Slave Wednesday, January 27, 2010
  143. 143. Load Balancer App Server App Server App Server Cache Cache Cache MySQL Proxy MySQL MySQL MySQL Master Slave Slave Wednesday, January 27, 2010
  144. 144. Load Balancer App Server App Server App Server Cache Cache Cache Job Server MySQL Proxy MySQL MySQL MySQL Master Slave Slave Wednesday, January 27, 2010
  145. 145. Tendências Wednesday, January 27, 2010
  146. 146. C10K Problem Wednesday, January 27, 2010
  147. 147. Wednesday, January 27, 2010
  148. 148. HTML 5 Web Sockets Reactor/Deferrable Pattern Wednesday, January 27, 2010
  149. 149. HTML 5 Web Sockets Reactor/Deferrable Pattern Wednesday, January 27, 2010
  150. 150. HTML 5 Web Sockets Reactor/Deferrable Pattern Wednesday, January 27, 2010
  151. 151. Wednesday, January 27, 2010
  152. 152. Wednesday, January 27, 2010
  153. 153. Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  154. 154. Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  155. 155. Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  156. 156. Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  157. 157. Browser Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  158. 158. Browser Browser Browser Browser App App App ? Banco Wednesday, January 27, 2010
  159. 159. Browser Browser Browser Banco Wednesday, January 27, 2010
  160. 160. Browser Browser Browser conexões/eventos Banco Wednesday, January 27, 2010
  161. 161. Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  162. 162. Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  163. 163. Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  164. 164. Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  165. 165. Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  166. 166. Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  167. 167. Browser Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  168. 168. Browser Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  169. 169. Browser Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  170. 170. Wednesday, January 27, 2010
  171. 171. Wednesday, January 27, 2010
  172. 172. Aprendendo Mais Wednesday, January 27, 2010
  173. 173. RAILS LABS Wednesday, January 27, 2010
  174. 174. Wednesday, January 27, 2010
  175. 175. RAILSCASTS.com Wednesday, January 27, 2010
  176. 176. Wednesday, January 27, 2010
  177. 177. Wednesday, January 27, 2010
  178. 178. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  179. 179. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  180. 180. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  181. 181. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  182. 182. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  183. 183. Wednesday, January 27, 2010
  184. 184. Thx! www.slideshare.net/akitaonrails www.akitaonrails.com/ les/entendendo-a-web-movies.zip fabio.akita@locaweb.com.br Wednesday, January 27, 2010
  1. A particular slide catching your eye?

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

×