SlideShare uma empresa Scribd logo
1 de 184
Baixar para ler offline
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




                          fabio.akita@locaweb.com.br




Wednesday, January 27, 2010
Entendendo a Web
                 Lições sobre Desenvolvimento Web com Ruby



                              Fabio Akita



Wednesday, January 27, 2010
Pensamento
                               Tradicional



Wednesday, January 27, 2010
Browser




                              Web Server




                               MySQL




Wednesday, January 27, 2010
Browser




                              Web Server




                               MySQL




Wednesday, January 27, 2010
Browser




                              Web Server




                               MySQL




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




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

                               include header




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

                               include header


                                  while ...




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

                               include header


                                  while ...


                              Response.write




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

                               include header


                                  while ...


                              Response.write


                               include footer



Wednesday, January 27, 2010
Ruby?



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

                          Ruby   1.8

        “Novo” Ruby              1.9
Wednesday, January 27, 2010
Ruby on Rails             2.3

                          Ruby   1.8

        “Novo” Ruby              1.9
Wednesday, January 27, 2010
Ruby on Rails             2.3

                          Ruby   1.8

        “Novo” Ruby              1.9
Wednesday, January 27, 2010
x mais lento que C++




Wednesday, January 27, 2010
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
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




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

               •     cd juicer ; rake build

               •     gem install pkg/juicer-0.9.9.gem




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

               •     cd juicer ; rake build

               •     gem install pkg/juicer-0.9.9.gem




Wednesday, January 27, 2010
•     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
•     juicer install yuicompressor

               •     juicer install jslint




Wednesday, January 27, 2010
/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
/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
/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
/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
Wednesday, January 27, 2010
•     juicer merge public/stylesheets/
                     application.css

                   •     public/stylesheets/application.min.css




Wednesday, January 27, 2010
•     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
DEVELOPMENT

Wednesday, January 27, 2010
PRODUCTION

Wednesday, January 27, 2010
Asset Hosts
                              Navegadores abrem poucas conexões
                                   simultâneas por domínio




Wednesday, January 27, 2010
Wednesday, January 27, 2010
/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
/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
/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
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|
        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
/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
/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
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>
        <%= 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
/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
/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
/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
Gzip



Wednesday, January 27, 2010
•     a2enmod de ate

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




Wednesday, January 27, 2010
/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
Cabeçalhos de
                                Expiração



Wednesday, January 27, 2010
•     a2enmod expires

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




Wednesday, January 27, 2010
/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
Cache Busters



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




                         <%= stylesheet_link_tag 'application' %>


                         <%= javascript_include_tag 'application' %>


                         <%= image_tag "logo.png" %>




Wednesday, January 27, 2010
/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
/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
Use CDNs



Wednesday, January 27, 2010
/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
/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
/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
Search



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



Wednesday, January 27, 2010
select * from ...
                where ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
Wednesday, January 27, 2010
select * from ...
                where ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
Wednesday, January 27, 2010
Wednesday, January 27, 2010
•     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
Wednesday, January 27, 2010
Wednesday, January 27, 2010
select * from ...
                where ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
Wednesday, January 27, 2010
select * from ...
                where ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
                 or ... like “%...%”
Wednesday, January 27, 2010
Rack
                                  A API mais simples possível que
                              representa uma aplicação web genérica




Wednesday, January 27, 2010
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, January 27, 2010
Requisição




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




                 Status



Wednesday, January 27, 2010
Requisição




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




                 Status        Cabeçalhos



Wednesday, January 27, 2010
Requisição




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




                 Status        Cabeçalhos             Corpo



Wednesday, January 27, 2010
Request                Response
                              Rack
               (env)                  (Array)




Wednesday, January 27, 2010
Request                      Response
                               Rack
               (env)                        (Array)
                              .call(env)




Wednesday, January 27, 2010
Request           Rack




                              Rack




                              Rack   Response



Wednesday, January 27, 2010
Request           Rack




                              Rack




                              Rack   Response



Wednesday, January 27, 2010
Request           Rack




                              Rack




                              Rack   Response



Wednesday, January 27, 2010
Request           Rack




                              Rack




                              Rack   Response



Wednesday, January 27, 2010
Request           Rack




                              Rack




                              Rack   Response



Wednesday, January 27, 2010
$ 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
gem install rack



Wednesday, January 27, 2010
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
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 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
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
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
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
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
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
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
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
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
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
Apache2
          + mod_proxy_balancer

                              Squid

                              Varnish
Wednesday, January 27, 2010
Memcached

                              MySQL Proxy

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




Wednesday, January 27, 2010
Load
                                      Balancer




                    App Server

                              Cache




Wednesday, January 27, 2010
Load
                                       Balancer




                    App Server        App Server

                              Cache           Cache




Wednesday, January 27, 2010
Load
                                       Balancer




                    App Server        App Server      App Server

                              Cache           Cache           Cache




Wednesday, January 27, 2010
Load
                                       Balancer




                    App Server        App Server      App Server

                              Cache           Cache           Cache




Wednesday, January 27, 2010
Load
                                        Balancer




                    App Server         App Server      App Server

                               Cache           Cache           Cache




                              MySQL
                              Master


Wednesday, January 27, 2010
Load
                                        Balancer




                    App Server         App Server        App Server

                               Cache           Cache             Cache




                              MySQL     MySQL          MySQL
                              Master    Slave          Slave


Wednesday, January 27, 2010
Load
                                        Balancer




                    App Server         App Server        App Server

                               Cache           Cache             Cache



                                       MySQL Proxy



                              MySQL      MySQL         MySQL
                              Master     Slave         Slave


Wednesday, January 27, 2010
Load
                                        Balancer




                    App Server         App Server        App Server

                               Cache           Cache             Cache



                                       MySQL Proxy



                              MySQL      MySQL         MySQL
                              Master     Slave         Slave


Wednesday, January 27, 2010
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
Tendências



Wednesday, January 27, 2010
C10K Problem



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

                              Web Sockets
                   Reactor/Deferrable
                        Pattern
Wednesday, January 27, 2010
HTML 5

                              Web Sockets
                   Reactor/Deferrable
                        Pattern
Wednesday, January 27, 2010
HTML 5

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




                               App       App       App




                                        Banco




Wednesday, January 27, 2010
Browser   Browser   Browser




                               App       App       App




                                        Banco




Wednesday, January 27, 2010
Browser   Browser   Browser




                               App       App       App




                                        Banco




Wednesday, January 27, 2010
Browser   Browser   Browser




                               App       App       App




                                        Banco




Wednesday, January 27, 2010
Browser   Browser   Browser   Browser




                               App       App       App




                                        Banco




Wednesday, January 27, 2010
Browser   Browser   Browser   Browser




                               App       App       App
                                                             ?
                                        Banco




Wednesday, January 27, 2010
Browser   Browser   Browser




                                        Banco




Wednesday, January 27, 2010
Browser       Browser        Browser




                                        conexões/eventos




                                             Banco




Wednesday, January 27, 2010
Browser       Browser        Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
Browser       Browser        Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
Browser       Browser        Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
Browser       Browser        Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
Browser       Browser        Browser   Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
Browser       Browser        Browser   Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
Browser                 Browser       Browser        Browser   Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
Browser                 Browser       Browser        Browser   Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
Browser                 Browser       Browser        Browser   Browser




                                        conexões/eventos

                                    processamento/eventos




                                             Banco




Wednesday, January 27, 2010
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

                              Mundo Assíncrono

                          Mundo não Relacional
Wednesday, January 27, 2010
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

                              Mundo Assíncrono

                          Mundo não Relacional
Wednesday, January 27, 2010
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

                              Mundo Assíncrono

                          Mundo não Relacional
Wednesday, January 27, 2010
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

                              Mundo Assíncrono

                          Mundo não Relacional
Wednesday, January 27, 2010
Entenda os browsers

                                Entenda HTTP

                                 Arquiteturas

                              Mundo Assíncrono

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




                          fabio.akita@locaweb.com.br

Wednesday, January 27, 2010

Mais conteúdo relacionado

Mais procurados (7)

Refactoring
RefactoringRefactoring
Refactoring
 
04 Model View Controller
04 Model View Controller04 Model View Controller
04 Model View Controller
 
02 Objective C
02 Objective C02 Objective C
02 Objective C
 
Idiots guide to jquery
Idiots guide to jqueryIdiots guide to jquery
Idiots guide to jquery
 
Lecture 10 slides (february 4, 2010)
Lecture 10 slides (february 4, 2010)Lecture 10 slides (february 4, 2010)
Lecture 10 slides (february 4, 2010)
 
08 Table Views
08 Table Views08 Table Views
08 Table Views
 
Reef - ESUG 2010
Reef - ESUG 2010Reef - ESUG 2010
Reef - ESUG 2010
 

Destaque (7)

Fisl - Deployment
Fisl - DeploymentFisl - Deployment
Fisl - Deployment
 
Claretiano 2009
Claretiano 2009Claretiano 2009
Claretiano 2009
 
Fisl 10
Fisl 10Fisl 10
Fisl 10
 
Aprendendo a Aprender - Alagoas Dev Day
Aprendendo a Aprender - Alagoas Dev DayAprendendo a Aprender - Alagoas Dev Day
Aprendendo a Aprender - Alagoas Dev Day
 
Rails Summit - De Volta Ao Básico
Rails Summit - De Volta Ao BásicoRails Summit - De Volta Ao Básico
Rails Summit - De Volta Ao Básico
 
Encontro de TI - Arteccom
Encontro de TI - ArteccomEncontro de TI - Arteccom
Encontro de TI - Arteccom
 
Making Rails Really restful
Making Rails Really restfulMaking Rails Really restful
Making Rails Really restful
 

Semelhante a Campus Party 2010

20100627 sobe2
20100627 sobe220100627 sobe2
20100627 sobe2
Shu Shimbo
 
Html5/CSS3 in shanghai 2010
Html5/CSS3 in shanghai 2010Html5/CSS3 in shanghai 2010
Html5/CSS3 in shanghai 2010
Zi Bin Cheah
 
Behavior-Driven Development с RSpec и Cucumber
Behavior-Driven Development с RSpec и CucumberBehavior-Driven Development с RSpec и Cucumber
Behavior-Driven Development с RSpec и Cucumber
Stefan Kanev
 
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP GroupDeveloping Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
minddog
 

Semelhante a Campus Party 2010 (20)

Edted 2010 Dicas de Web
Edted 2010 Dicas de WebEdted 2010 Dicas de Web
Edted 2010 Dicas de Web
 
20100627 sobe2
20100627 sobe220100627 sobe2
20100627 sobe2
 
Mongo db
Mongo dbMongo db
Mongo db
 
Spring 3
Spring 3Spring 3
Spring 3
 
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)
 
Jrubykaigi 2010
Jrubykaigi 2010Jrubykaigi 2010
Jrubykaigi 2010
 
Caelum dicas web 2010
Caelum dicas web 2010Caelum dicas web 2010
Caelum dicas web 2010
 
Nick Sieger-Exploring Rails 3 Through Choices
Nick Sieger-Exploring Rails 3 Through Choices Nick Sieger-Exploring Rails 3 Through Choices
Nick Sieger-Exploring Rails 3 Through Choices
 
Jquery Introduction
Jquery IntroductionJquery Introduction
Jquery Introduction
 
Best Practices - Mobile Developer Summit
Best Practices - Mobile Developer SummitBest Practices - Mobile Developer Summit
Best Practices - Mobile Developer Summit
 
Html5/CSS3 in shanghai 2010
Html5/CSS3 in shanghai 2010Html5/CSS3 in shanghai 2010
Html5/CSS3 in shanghai 2010
 
Feature Bits at LSSC10
Feature  Bits at LSSC10Feature  Bits at LSSC10
Feature Bits at LSSC10
 
Building a Website The Easy Way With Wordpress
Building a Website The Easy Way With WordpressBuilding a Website The Easy Way With Wordpress
Building a Website The Easy Way With Wordpress
 
Continuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using HudsonContinuous Integration Testing for Plone Using Hudson
Continuous Integration Testing for Plone Using Hudson
 
Behavior-Driven Development с RSpec и Cucumber
Behavior-Driven Development с RSpec и CucumberBehavior-Driven Development с RSpec и Cucumber
Behavior-Driven Development с RSpec и Cucumber
 
Node.js and Ruby
Node.js and RubyNode.js and Ruby
Node.js and Ruby
 
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP GroupDeveloping Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
 
10x Performance Improvements - A Case Study
10x Performance Improvements - A Case Study10x Performance Improvements - A Case Study
10x Performance Improvements - A Case Study
 
Plone Conference 2010 – Where we go from here
Plone Conference 2010 – Where we go from herePlone Conference 2010 – Where we go from here
Plone Conference 2010 – Where we go from here
 
Java Server Faces 2.0 - Der Standard für moderne und komponentenbasierte Weba...
Java Server Faces 2.0 - Der Standard für moderne und komponentenbasierte Weba...Java Server Faces 2.0 - Der Standard für moderne und komponentenbasierte Weba...
Java Server Faces 2.0 - Der Standard für moderne und komponentenbasierte Weba...
 

Mais de Fabio Akita

Mais de Fabio Akita (20)

Devconf 2019 - São Carlos
Devconf 2019 - São CarlosDevconf 2019 - São Carlos
Devconf 2019 - São Carlos
 
Meetup Nerdzão - English Talk about Languages
Meetup Nerdzão  - English Talk about LanguagesMeetup Nerdzão  - English Talk about Languages
Meetup Nerdzão - English Talk about Languages
 
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
 
Desmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPDesmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SP
 
Desmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaDesmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter Goiania
 
Blockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersBlockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7Masters
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
 
Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017
 
30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby
 
Uma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIUma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TI
 
THE CONF - Opening Keynote
THE CONF - Opening KeynoteTHE CONF - Opening Keynote
THE CONF - Opening Keynote
 
A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017
 
Desmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APDesmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - AP
 
A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017
 
A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017
 
A Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayA Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech Day
 
A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016
 
Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016
 
Conexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraConexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização Prematura
 
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilThe Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
 

Último

Último (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Campus Party 2010

  • 1. A apresentação comecará em alguns minutos ... Wednesday, January 27, 2010
  • 2. A apresentação comecará em alguns minutos ... Wednesday, January 27, 2010
  • 4. ~1h > 100 slides Wednesday, January 27, 2010
  • 5. www.slideshare.net/akitaonrails www.akitaonrails.com/ les/entendendo-a-web-movies.zip fabio.akita@locaweb.com.br Wednesday, January 27, 2010
  • 6. Entendendo a Web Lições sobre Desenvolvimento Web com Ruby Fabio Akita Wednesday, January 27, 2010
  • 7. Pensamento Tradicional Wednesday, January 27, 2010
  • 8. Browser Web Server MySQL Wednesday, January 27, 2010
  • 9. Browser Web Server MySQL Wednesday, January 27, 2010
  • 10. Browser Web Server MySQL Wednesday, January 27, 2010
  • 12. /site/default.asp include header Wednesday, January 27, 2010
  • 13. /site/default.asp include header while ... Wednesday, January 27, 2010
  • 14. /site/default.asp include header while ... Response.write Wednesday, January 27, 2010
  • 15. /site/default.asp include header while ... Response.write include footer Wednesday, January 27, 2010
  • 18. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Wednesday, January 27, 2010
  • 19. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Wednesday, January 27, 2010
  • 20. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Wednesday, January 27, 2010
  • 21. x mais lento que C++ Wednesday, January 27, 2010
  • 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
  • 37. Mini que CSS e Javascript Wednesday, January 27, 2010
  • 38. Juicer http://github.com/cjohansen/juicer/ Wednesday, January 27, 2010
  • 40. git clone git://github.com/cjohansen/ juicer.git Wednesday, January 27, 2010
  • 41. git clone git://github.com/cjohansen/ juicer.git • cd juicer ; rake build Wednesday, January 27, 2010
  • 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. 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. 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. juicer install yuicompressor • juicer install jslint Wednesday, January 27, 2010
  • 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. /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. /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. /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
  • 51. juicer merge public/stylesheets/ application.css • public/stylesheets/application.min.css Wednesday, January 27, 2010
  • 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
  • 55. Asset Hosts Navegadores abrem poucas conexões simultâneas por domínio Wednesday, January 27, 2010
  • 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. /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. /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
  • 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. /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. /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
  • 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. /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. /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. /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
  • 73. a2enmod de ate • editar /etc/apache2/mods-available/ de ate.conf Wednesday, January 27, 2010
  • 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. Cabeçalhos de Expiração Wednesday, January 27, 2010
  • 76. a2enmod expires • editar /etc/apache2/mods-available/ expires.conf Wednesday, January 27, 2010
  • 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
  • 79. /app/views/layouts/application.html.erb <%= stylesheet_link_tag 'application' %> <%= javascript_include_tag 'application' %> <%= image_tag "logo.png" %> Wednesday, January 27, 2010
  • 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. /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
  • 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. /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. /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
  • 87. select * from ... where ... like “%...%” Wednesday, January 27, 2010
  • 88. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Wednesday, January 27, 2010
  • 89. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Wednesday, January 27, 2010
  • 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
  • 94. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Wednesday, January 27, 2010
  • 95. select * from ... where ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” or ... like “%...%” Wednesday, January 27, 2010
  • 96. Rack A API mais simples possível que representa uma aplicação web genérica Wednesday, January 27, 2010
  • 97. Server HTTP Wednesday, January 27, 2010
  • 98. Server Request HTTP Wednesday, January 27, 2010
  • 99. Server Request HTTP Wednesday, January 27, 2010
  • 100. Server Request HTTP Wednesday, January 27, 2010
  • 101. Server Request HTTP Response Wednesday, January 27, 2010
  • 102. lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Wednesday, January 27, 2010
  • 103. Requisição lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Wednesday, January 27, 2010
  • 104. Requisição lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Status Wednesday, January 27, 2010
  • 105. Requisição lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Status Cabeçalhos Wednesday, January 27, 2010
  • 106. Requisição lambda { |env| [200, {"Content-type" => "text/plain"}, "Hello World"] } Status Cabeçalhos Corpo Wednesday, January 27, 2010
  • 107. Request Response Rack (env) (Array) Wednesday, January 27, 2010
  • 108. Request Response Rack (env) (Array) .call(env) Wednesday, January 27, 2010
  • 109. Request Rack Rack Rack Response Wednesday, January 27, 2010
  • 110. Request Rack Rack Rack Response Wednesday, January 27, 2010
  • 111. Request Rack Rack Rack Response Wednesday, January 27, 2010
  • 112. Request Rack Rack Rack Response Wednesday, January 27, 2010
  • 113. Request Rack Rack Rack Response Wednesday, January 27, 2010
  • 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. gem install rack Wednesday, January 27, 2010
  • 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. rackup con g.ru Wednesday, January 27, 2010
  • 119. Sinatra http://www.sinatrarb.com/ Wednesday, January 27, 2010
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Apache2 + mod_proxy_balancer Squid Varnish Wednesday, January 27, 2010
  • 134. Memcached MySQL Proxy Assíncrono (ex. Resque, RabbitMQ) Wednesday, January 27, 2010
  • 135. Load Balancer Wednesday, January 27, 2010
  • 136. Load Balancer App Server Cache Wednesday, January 27, 2010
  • 137. Load Balancer App Server App Server Cache Cache Wednesday, January 27, 2010
  • 138. Load Balancer App Server App Server App Server Cache Cache Cache Wednesday, January 27, 2010
  • 139. Load Balancer App Server App Server App Server Cache Cache Cache Wednesday, January 27, 2010
  • 140. Load Balancer App Server App Server App Server Cache Cache Cache MySQL Master Wednesday, January 27, 2010
  • 141. Load Balancer App Server App Server App Server Cache Cache Cache MySQL MySQL MySQL Master Slave Slave Wednesday, January 27, 2010
  • 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. Load Balancer App Server App Server App Server Cache Cache Cache MySQL Proxy MySQL MySQL MySQL Master Slave Slave Wednesday, January 27, 2010
  • 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
  • 148. HTML 5 Web Sockets Reactor/Deferrable Pattern Wednesday, January 27, 2010
  • 149. HTML 5 Web Sockets Reactor/Deferrable Pattern Wednesday, January 27, 2010
  • 150. HTML 5 Web Sockets Reactor/Deferrable Pattern Wednesday, January 27, 2010
  • 153. Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  • 154. Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  • 155. Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  • 156. Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  • 157. Browser Browser Browser Browser App App App Banco Wednesday, January 27, 2010
  • 158. Browser Browser Browser Browser App App App ? Banco Wednesday, January 27, 2010
  • 159. Browser Browser Browser Banco Wednesday, January 27, 2010
  • 160. Browser Browser Browser conexões/eventos Banco Wednesday, January 27, 2010
  • 161. Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 162. Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 163. Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 164. Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 165. Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 166. Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 167. Browser Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 168. Browser Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 169. Browser Browser Browser Browser Browser conexões/eventos processamento/eventos Banco Wednesday, January 27, 2010
  • 178. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  • 179. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  • 180. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  • 181. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  • 182. Entenda os browsers Entenda HTTP Arquiteturas Mundo Assíncrono Mundo não Relacional Wednesday, January 27, 2010
  • 184. Thx! www.slideshare.net/akitaonrails www.akitaonrails.com/ les/entendendo-a-web-movies.zip fabio.akita@locaweb.com.br Wednesday, January 27, 2010