SlideShare a Scribd company logo
1 of 181
Download to read offline
Before I Begin...

Wednesday, May 18, 2011
@jonleighton

Wednesday, May 18, 2011
Wednesday, May 18, 2011
Wednesday, May 18, 2011
Wednesday, May 18, 2011
I   José
Wednesday, May 18, 2011
Double Dream Hands:
                         SO INTENSE


Wednesday, May 18, 2011
ZOMG!!!
Wednesday, May 18, 2011
HAPPY
Wednesday, May 18, 2011
RAILS
Wednesday, May 18, 2011
CONF
Wednesday, May 18, 2011
Wednesday, May 18, 2011
Aaron Patterson

Wednesday, May 18, 2011
@tenderlove

Wednesday, May 18, 2011
AT&T, AT&T logo and all AT&T related marks are trademarks of AT&T Intellectual Property and/or AT&T affiliated companies.
Wednesday, May 18, 2011
WWFMD?
Wednesday, May 18, 2011
Richard Gabriel      Guy Steele         DHH
                   Researcher      Software Architect   Partner




Wednesday, May 18, 2011
Aaron Batalion   Chad Dickerson   Dan Melton
                      CTO               CTO            CTO




Wednesday, May 18, 2011
Aaron Patterson
                    Corey Haines      Eric Ries
                                                     Señor Software
                    Corey Haines   Venture Advisor
                                                        Engineer




Wednesday, May 18, 2011
Wednesday, May 18, 2011
LOLWUT




Wednesday, May 18, 2011
Señor Software Engineer
Wednesday, May 18, 2011
Señor Software Engineer
Wednesday, May 18, 2011
Wednesday, May 18, 2011
Wednesday, May 18, 2011
Agenda




Wednesday, May 18, 2011
Agenda

                              New Features

                                Real Talk!

                          Development Pro Tips™
Wednesday, May 18, 2011
Implementation
                                    and thoughts on
                                    API design


                          I will be very
                          TECHNICAL

Wednesday, May 18, 2011
Because my
                                      audience is
                                      smart



                          I will be very
                            CRITICAL
                                      Because I care




Wednesday, May 18, 2011
New Features!

Wednesday, May 18, 2011
git log --since="1 year ago"



Wednesday, May 18, 2011
API Strategy

Wednesday, May 18, 2011
rails generate VC

Wednesday, May 18, 2011
def halts?(function)


Wednesday, May 18, 2011
Prepared
                          Statements

Wednesday, May 18, 2011
select * from 'users'
                              where id = 10


Wednesday, May 18, 2011
select * from 'users'
                               where id = ?


Wednesday, May 18, 2011
DATABASE




                          RAILS APP
Wednesday, May 18, 2011
DATABASE




                           Records
                          RAILS APP
Wednesday, May 18, 2011
4 Steps!

Wednesday, May 18, 2011
DATABASE




                          RAILS APP
Wednesday, May 18, 2011
DATABASE




                            Token
                          RAILS APP
Wednesday, May 18, 2011
DATABASE




                          RAILS APP
Wednesday, May 18, 2011
DATABASE




                           Records
                          RAILS APP
Wednesday, May 18, 2011
4 Steps!

Wednesday, May 18, 2011
2 Steps!

Wednesday, May 18, 2011
Impact

Wednesday, May 18, 2011
SQLite3

Wednesday, May 18, 2011
SQLite3 Simple Prepared Statement
              100.00

                  10.00
                                 y = 8.556E-5e2.2868x
                                 y = 0.0002e2.187x
                     1.00

                     0.10

                     0.01

                     0.00

                     0.00
                            10               100              1000          10000   100000

                                                        Number of Queries
                  Cached                Trend 1
                  Non-Cached            Trend 2
Wednesday, May 18, 2011
8665 q/s
                          12987 q/s

Wednesday, May 18, 2011
Δ 4322 q/s

Wednesday, May 18, 2011
SQLite3 Complex SQL Statement
                    1000


                          100
                                     y = 0.0003e2.2227x
                                     y = 0.0029e2.3111x
                          10


                            1


                            0


                            0


                            0
                                10                  100         1000          10000   100000
         Cached                           Trend 1         Number of Queries
         Non-Cached                       Trend 2
Wednesday, May 18, 2011
339 q/s
                          4184 q/s

Wednesday, May 18, 2011
Δ 3845 q/s

Wednesday, May 18, 2011
PostgreSQL

Wednesday, May 18, 2011
PostgreSQL Simple Query
             100.0
                           y = 0.0002e2.3018x
                           y = 0.0004e2.1424x
                10.0


                   1.0


                   0.1


                   0.0


                   0.0
                          10           100       1000     10000   100000
                 Cached            Trend 1      Queries
                 No Cache          Trend 2
Wednesday, May 18, 2011
4662 q/s
                          5586 q/s

Wednesday, May 18, 2011
Δ 924 q/s

Wednesday, May 18, 2011
PostgreSQL Complex Query
       1000

                          y = 0.0005e2.173x
          100
                          y = 0.0047e2.2153x

            10


               1


               0


               0


               0
                   10                     100       1000      10000   100000
                                                   Queries
                   Cached                Trend 1
                   No Cache              Trend 2
Wednesday, May 18, 2011
307 q/s
                          3322 q/s

Wednesday, May 18, 2011
Δ 3015 q/s

Wednesday, May 18, 2011
MySQL

Wednesday, May 18, 2011
MySQL Simple Query
           100


              10


                1


                0


                0


                0
                    10          100      1000     10000   100000
                   Cache   No Cache     Queries


Wednesday, May 18, 2011
6410 q/s
                          5154 q/s

Wednesday, May 18, 2011
Δ -1256 q/s

Wednesday, May 18, 2011
MySQL Complex SQL Query
           1000


              100


                 10


                   1


                   0


                   0


                   0
                          10              100       1000         10000   100000
                               Cached           Category Title
                               No Cache
Wednesday, May 18, 2011
626 q/s
                          1198 q/s

Wednesday, May 18, 2011
Δ 572 q/s

Wednesday, May 18, 2011
No Query
                          Planning

Wednesday, May 18, 2011
Two Network
                           Roundtrips

Wednesday, May 18, 2011
Problem?
Wednesday, May 18, 2011
Problem?
Wednesday, May 18, 2011
select updated_at from
                                  pirates


          [[#<Mysql::Time:2011-05-13 22:03:55>]]



          [["2011-05-13 22:03:55"]]



Wednesday, May 18, 2011
select updated_at from
                                  pirates
                               Prepared Statement

          [[#<Mysql::Time:2011-05-13 22:03:55>]]



          [["2011-05-13 22:03:55"]]



Wednesday, May 18, 2011
select updated_at from
                                    pirates


          [[#<Mysql::Time:2011-05-13 22:03:55>]]

                          Regular Statement

          [["2011-05-13 22:03:55"]]



Wednesday, May 18, 2011
API Changes

Wednesday, May 18, 2011
User.find 1

Wednesday, May 18, 2011
User.find 1

Wednesday, May 18, 2011
Serialized
                          Attributes

Wednesday, May 18, 2011
class User < ActiveRecord::Base
                       serialize :preferences
                     end




Wednesday, May 18, 2011
Saves as YAML


          user = User.find 1
          user.preferences = { :hello => 'world!' }
          user.save!




Wednesday, May 18, 2011
Why YAML?

Wednesday, May 18, 2011
class User < ActiveRecord::Base
                       serialize :preferences, Base64Encoder.new
                     end




Wednesday, May 18, 2011
Base 64 Storage
          class Base64Encoder
            def load(value)
              return unless value
              value.unpack('m').last
            end

            def dump(text)
              [text].pack('m')
            end
          end

Wednesday, May 18, 2011
JSON Storage
          class JSONEncoder
            def load(value)
              return unless value
              JSON.load value
            end

            def dump(text)
              JSON.dump(text)
            end
          end

Wednesday, May 18, 2011
Marshal Storage
          class MarshalEncoder
            def load(value)
              return unless value
              Marshal.load value
            end

            def dump(text)
              Marshal.dump(text)
            end
          end

Wednesday, May 18, 2011
XML Storage
          class XMLEncoder
            def load(value)
              return unless value
              Nokogiri.XML value
            end

            def dump(doc)
              doc.to_xml
            end
          end

Wednesday, May 18, 2011
Official NoSQL
                             Support

Wednesday, May 18, 2011
IT'S
                                    OFFI
                                         CIAL

                          Official NoSQL
                                             !




                             Support

Wednesday, May 18, 2011
Wednesday, May 18, 2011
2 Caveats

Wednesday, May 18, 2011
PostgreSQL Only

Wednesday, May 18, 2011
You might hurt
                             yourself

Wednesday, May 18, 2011
Wednesday, May 18, 2011
DO NOT DO THIS
          class User < ActiveRecord::Base
            class HStore
              def load value
                return unless value
                eval "{#{value}}"
              end

                  def dump value
                    return unless value
                    value.map { |xs| xs.join '=>' }.join ', '
                  end
                end

            serialize :preferences, HStore.new
          end
Wednesday, May 18, 2011
BCrypt Coder
          class BCryptCoder
            def load(value)
              return unless value
              BCrypt::Password.new value
            end

            def dump(value)
              BCrypt::Password.create(value).to_s
            end
          end

Wednesday, May 18, 2011
BCrypt Serialization


          class User < ActiveRecord::Base
            serialize :crazy_column, BCryptCoder.new
          end




Wednesday, May 18, 2011
stdlib serialization API
                                    Dumping   Loading

                           YAML      dump      load

                           JSON      dump      load

                          Marshal    dump      load

Wednesday, May 18, 2011
Storage type




                          YOU choose
                                 Column name




Wednesday, May 18, 2011
Good Abstractions
                            yield
                       Good Features
Wednesday, May 18, 2011
CONSISTENCY
                            is FREEDOM
                          and FLEXIBILITY
Wednesday, May 18, 2011
has_secure_password


Wednesday, May 18, 2011
SECURITY!


          class User < ActiveRecord::Base
            has_secure_password
          end




Wednesday, May 18, 2011
SECURITY!


          user = User.find 1
          user.password = 'lolwut'
          user.save!




Wednesday, May 18, 2011
Advantages

                          Introduces a new method
                          Saves password in `password_digest`
                          Uses BCrypt




Wednesday, May 18, 2011
Disadvantages
                                                      API is not flexible


                          Introduces a new method
                          Saves password in `password_digest`
                                                                 Not
                          Uses BCrypt                            reusable




Wednesday, May 18, 2011
GO GREEN!

Wednesday, May 18, 2011
Write Something
                           REUSABLE!

Wednesday, May 18, 2011
response
                                      streaming




                          Streaming    chunked
                                       encoding




                          Responses

Wednesday, May 18, 2011
Rack API


          class MyApp
            def call(env)
              [200, { 'X-ZOMG' => 'hi' }, ['web page!']]
            end
          end



Wednesday, May 18, 2011
Rails 3.0.x

          class PoniesController
            def call(env)
              body << render(:content)
              body << render(:layout)

              [200, {}, body]
            end
          end


Wednesday, May 18, 2011
Delayed
                          Evaluation

Wednesday, May 18, 2011
Body#each

Wednesday, May 18, 2011
Rails 3.1.x
          class DelayedBody
            def each
              yield render(:layout)
              yield render(:content)
            end
          end

          class PoniesController
            def call(env)
              [200, {}, DelayedBody.new]
            end
          end
Wednesday, May 18, 2011
Middleware

Wednesday, May 18, 2011
Middleware   ☹
Wednesday, May 18, 2011
Middleware Chain
                                                  Just consider
                                                  connection
                               Request Timer      manager and
                                                  application




                             Connection Manager



                                 Application

Wednesday, May 18, 2011
Middleware Chain


                            Connection Manager




                                Application

Wednesday, May 18, 2011
Middleware Chain
                                 call(env)

                            Connection Manager


                                 call(env)

                                Application

Wednesday, May 18, 2011
Middleware Chain
                               [200, {}, body]

                            Connection Manager


                               [200, {}, body]

                                Application

Wednesday, May 18, 2011
Connection Manager
                                         When ERb is evaluated,
                                         db connection does not
                                         exist




Wednesday, May 18, 2011
Connection Manager
                             Open DB Connection   When ERb is evaluated,
                                                  db connection does not
                                                  exist




Wednesday, May 18, 2011
Connection Manager
                             Open DB Connection   When ERb is evaluated,
                                                  db connection does not
                                                  exist
                                  Delegate




Wednesday, May 18, 2011
Connection Manager
                             Open DB Connection    When ERb is evaluated,
                                                   db connection does not
                                                   exist
                                  Delegate

                             Close DB Connection



Wednesday, May 18, 2011
Connection Manager
                              Open DB Connection      When ERb is evaluated,
                                                      db connection does not
                                                      exist
                                   Delegate

                             Close DB Connection

                             Return Delegate Values

Wednesday, May 18, 2011
Problem?
Wednesday, May 18, 2011
Problem?
Wednesday, May 18, 2011
Body#close

Wednesday, May 18, 2011
Body Proxy
          class ConnectionBodyProxy
            def initialize(delegate)
              @delegate = delegate
            end
            def each(&blk)
              @delegate.each(&blk)
            end
            def close
              # CLOSE CONNECTION
            end
          end
Wednesday, May 18, 2011
Connection Manager
          class ConnectionManager
            def initialize(app); @app = app; end

            def call(env)
              # OPEN CONNECTION
              response    = @app.call(env)
              response[2] = ConnectionBodyProxy.new(response[2])
              response
            end
          end

Wednesday, May 18, 2011
Wednesday, May 18, 2011
Wednesday, May 18, 2011
Wednesday, May 18, 2011
~25 middleware

Wednesday, May 18, 2011
Embrace
                          Diversity

Wednesday, May 18, 2011
Types of Middleware

                          Generators (our application)
                          Filters (gzip, etc)
                          Lifecycle Handlers (connection management)




Wednesday, May 18, 2011
Real Talk!

Wednesday, May 18, 2011
Rails is getting
                              slower

Wednesday, May 18, 2011
Time for N Requests
                                      Rails 2.3               Rails 3.0
                          100

                           10

                            1

                           0.1

                          0.01
                                 10        100               1000         10000
                                                  Requests
Wednesday, May 18, 2011
Avg Requests / time
                                       Rails 2.3               Rails 3.0
                           500

                          387.5

                           275

                          162.5

                            50
                                  10        100               1000         10000
                                                   Requests
Wednesday, May 18, 2011
Middleware
                          Increased

Wednesday, May 18, 2011
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
        Total samples: 740                                                                                                                                Rack
                                                                                                                                                                      garbage_collector    Object#require                 Object#map
                                                                                                                                                                                                                                               ActiveRecord
                                                                                                                                                                                                                                            ConnectionAdapters
        Focusing on: 740                                                                                                                             Runtime#call
                                                                                                                                                           0 (0.0%)                             27 (3.6%)   165               0 (0.0%)     SQLiteAdapter#execute

                                                                                                                                                                           146 (19.7%)
                                                                                                                                                                                                                          of 57 (7.7%)                  1 (0.1%)
                                                                                                                                                     of 463 (62.6%)

        Dropped nodes with <= 3 abs(samples)                                                                                                                                               of 128 (17.3%)                                           of 56 (7.6%)


        Dropped edges with <= 0 samples
                                                                                                                                               463                                          118 74          62

                                                                                                                               Rails
                                                                                                                               Rack
                                                                                                                                                                                      Kernel#require                  Rails30
                                                                                                                                                                                                            Application.method_missing
                                                                                                                            Logger#call
                                                                                                                                0 (0.0%)
                                                                                                                                                                                           28 (3.8%)   60                      0 (0.0%)
                                                                                                                                                                                                                           of 62 (8.4%)
                                                                                                                          of 463 (62.6%)
                                                                                                                                                                                        of 63 (8.5%)

                                                                                                                  381            80                                                                                      62

                                                                                                 ActionDispatch                                                                                                        Rails
                                                                                               ShowExceptions#call                                                                                            Application#initialize!
                                                                                                          0 (0.0%)                                                                                                           0 (0.0%)
                                                                                                   of 381 (51.5%)                                                                                                       of 62 (8.4%)



                                                                                                                              Rails
                                                                                                                              Rack
                                                                                                       381             Logger#after_dispatch
                                                                                                                                    0 (0.0%)
                                                                                                                                                                                                                         62                      17
                                                                                                                              of 80 (10.8%)



                                                                                         ActionDispatch
                                                                                                                                                                                                              Object#run_initializers
                                                                                          RemoteIp#call
                                                                                                0 (0.0%)                         80                                                                                         0 (0.0%)
                                                                                                                                                                                                                        of 62 (8.4%)
                                                                                                                                                                                                                                          60
                                                                                         of 382 (51.6%)



                                                                                                                      ActiveSupport
                                                                                                                  LogSubscriber.flush_all!
                                                                                                 382                             0 (0.0%)                                                                                60
                                                                                                                           of 80 (10.8%)



                                                                                                                                                                                                                        Rails
                                                                                              Rack
                                                                                                                                                                                                                   Initializable
                                                                                          Sendfile#call
                                                                                                                                                                                                                  Initializer#run
                                                                                                0 (0.0%)
                                                                                                                                                                                                                         0 (0.0%)
                                                                                         of 383 (51.8%)
                                                                                                                                                                                                                    of 60 (8.1%)



                                                                                              383                                                                                                                        60

                                                                                  ActionDispatch
                                                                                                                                                                                                            Object#instance_exec
                                                                                  Callbacks#call
                                                                                                                                                                                                                         2 (0.3%)
                                                                                        2 (0.3%)
                                                                                                                                                                                                                    of 60 (8.1%)
                                                                                  of 383 (51.8%)


                                                                                 381     381 381

                                                         ActiveRecord
                                                                                              ActionDispatch
                                                     ConnectionAdapters
                                                                                       Callbacks#_run_call_callbacks
                                                  ConnectionManagement#call
                                                                                                            0 (0.0%)
                                                                      0 (0.0%)
                                                                                                     of 381 (51.5%)
                                                               of 381 (51.5%)



                                                                375

                                                       ActiveRecord
                                                      QueryCache#call
                                                              2 (0.3%)
                                                       of 377 (50.9%)


                                                      372                  375
Wednesday, May 18, 2011
                                     ActionDispatch
230             230             230 219          219

                                                                              ActionController                            Benchmark.ms                 ActionController
                                                                        Metal#cleanup_view_runtime                                                   Metal#render_to_string
                                                                                            0 (0.0%)         230               10 (1.4%)                           0 (0.0%)
                                                                                      of 230 (31.1%)                      of 230 (31.1%)                    of 219 (29.6%)




                                                                                                                       219 220                             213

                                                                                                                                     ActionController
                                                                                                            Benchmark.realtime     Metal#render_to_body
                                                                                                                       0 (0.0%)
                                                                                                                of 220 (29.7%)                  2 (0.3%)              424
                                                                                                                                          of 213 (28.8%)


                                                                                                                                                210

                                                                                                                                        ActionController
                                                                                                                                     Metal#_render_template
                                                                                                                                                    0 (0.0%)
                                                                                                                                             of 210 (28.4%)



                                                                                                                                                190

                                                                                ActiveSupport
                                                                                                                                         Object#render
                                                                           Notifications.instrument
                                                                                                                                                0 (0.0%)
                                                                                           0 (0.0%)
                                                                                                                                         of 190 (25.7%)
                                                                                    of 322 (43.5%)



                                                                           487 507                    175     185                 189

                                                                     ActiveSupport
                                                                     Notifications                Object#_render_template
                                                    167        Instrumenter#instrument
                                                                                0 (0.0%)
                                                                                                                2 (0.3%)           167
                                                                         of 322 (43.5%)
                                                                                                          of 189 (25.5%)



                                                                                                        18

                                                                                   ActionView
                                                                                 Template#render
                                                                                         2 (0.3%)
                                                                                  of 167 (22.6%)


                                                                        148                                       155

             Object#_app_views_layouts_application_html_erb___604422253_2164033400_0
                                                                              0 (0.0%)
                                                                       of 148 (20.0%)
                                                                                                       149


                                           85             58                       1

              Object#stylesheet_link_tag        Object#javascript_include_tag                   Object#_render_layout
                                0 (0.0%)                             3 (0.4%)                                 6 (0.8%)
                          of 85 (11.5%)
                                                                 of 58 (7.8%)                          of 155 (20.9%)


                           83

           Object#expand_stylesheet_sources
                                    0 (0.0%)
                              of 83 (11.2%)



                           81


 Object#collect_asset_files
                81 (10.9%)
Wednesday, May 18, 2011
work/Versions/1.8/usr/bin/ruby
                                                                                       Rack
                                                                                  Runtime#call
                                                                                        0 (0.0%)
                                                                                                   garbage_collector    Object#require
                                                                                                                             27 (3.6%)   165
                                                                                                                                                       Object#map
                                                                                                                                                           0 (0.0%)
                                                                                                                                                                            ActiveRecord
                                                                                                                                                                         ConnectionAdapters
                                                                                                                                                                        SQLiteAdapter#execute

                                                                                                        146 (19.7%)
                                                                                                                                                       of 57 (7.7%)                  1 (0.1%)
                                                                                  of 463 (62.6%)
                                                                                                                        of 128 (17.3%)                                           of 56 (7.6%)




                                                                            463                                          118 74          62

                                                            Rails
                                                            Rack
                                                                                                                   Kernel#require                  Rails30
                                                                                                                                         Application.method_missing
                                                         Logger#call
                                                             0 (0.0%)
                                                                                                                        28 (3.8%)   60                      0 (0.0%)
                                                                                                                                                        of 62 (8.4%)
                                                       of 463 (62.6%)
                                                                                                                     of 63 (8.5%)

                                               381            80                                                                                      62

                                ActionDispatch                                                                                                      Rails
                              ShowExceptions#call                                                                                          Application#initialize!
                                         0 (0.0%)                                                                                                         0 (0.0%)
                                  of 381 (51.5%)                                                                                                     of 62 (8.4%)



                                                            Rails
                                                           Rack
                                     381            Logger#after_dispatch
                                                                 0 (0.0%)
                                                                                                                                                      62                      17
                                                           of 80 (10.8%)



                       ActionDispatch
                                                                                                                                           Object#run_initializers
                        RemoteIp#call
Wednesday, May 18, 2011      0 (0.0%)                         80                                                                                         0 (0.0%)      60
GC Pressure

Wednesday, May 18, 2011
Stack Depth
                                 Rails 2.3    Rails 3.0    Rails 3.1

                           70


                          52.5


                           35


                          17.5


                            0
                                             Stack Depth



Wednesday, May 18, 2011
Rails 2.3 Stack

Wednesday, May 18, 2011
51 deep

Wednesday, May 18, 2011
Rails 3.0 Stack

Wednesday, May 18, 2011
60 deep

Wednesday, May 18, 2011
Rails 3.1 Stack

Wednesday, May 18, 2011
67 deep

Wednesday, May 18, 2011
/Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:150:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rendering.rb:11:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:18:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:436:in `_run__84203013__process_action__199225275__callbacks'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410:in `send'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94:in `send'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94:in `run_callbacks'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:17:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52:in `instrument'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52:in `instrument'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rescue.rb:17:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:119:in `process'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:41:in `process'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:138:in `dispatch'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:178:in `action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:27:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:148:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:93:in `recognize'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:68:in `optimized_each'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:92:in `recognize'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:139:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:493:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/head.rb:14:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/methodoverride.rb:24:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/flash.rb:182:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/cookies.rb:302:in `call'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:32:in `call'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:12:in `cache'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:31:in `call'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:46:in `call'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/sendfile.rb:107:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
                     /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/rack/logger.rb:13:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/runtime.rb:17:in `call'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `synchronize'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/static.rb:30:in `call'
                     /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:168:in `call'
                     fuuu.rb:44
                     fuuu.rb:43:in `times'
                     fuuu.rb:43




Wednesday, May 18, 2011
/Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:150:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rendering.rb:11:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:18:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:436:in `_run__84203013__process_action__199225275__callbacks'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410:in `send'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94:in `send'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94:in `run_callbacks'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:17:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52:in `instrument'




                                                         TL;DR
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52:in `instrument'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rescue.rb:17:in `process_action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:119:in `process'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:41:in `process'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:138:in `dispatch'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:178:in `action'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:27:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:148:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:93:in `recognize'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:68:in `optimized_each'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:92:in `recognize'
                     /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:139:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:493:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/head.rb:14:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/methodoverride.rb:24:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/flash.rb:182:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/cookies.rb:302:in `call'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:32:in `call'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:12:in `cache'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:31:in `call'
                     /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:46:in `call'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/sendfile.rb:107:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
                     /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/rack/logger.rb:13:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/runtime.rb:17:in `call'
                     /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `synchronize'
                     /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call'
                     /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/static.rb:30:in `call'
                     /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:168:in `call'
                     fuuu.rb:44
                     fuuu.rb:43:in `times'
                     fuuu.rb:43




Wednesday, May 18, 2011
Embrace
                          Diversity

Wednesday, May 18, 2011
We need a
                           change

Wednesday, May 18, 2011
Generators
          class Application
            def call(request, response)
              response.write(request, "hello", 200, {})

                          10.times do |body|
                            response.write(request, body)
                          end

              response.close
            end
          end
Wednesday, May 18, 2011
Filters
          class Filter
            def initialize(filter)
              @filter = filter
            end

                 def write(request, body, status = nil, headers = nil)
                   @filter.write(request, body, status, headers)
                 end

            def close
              @filter.close
            end
          end
Wednesday, May 18, 2011
Lifecycle Hooks

          class Handler
            def before(request)
              # Connect to database
            end

            def after(request)
              # Disconnect
            end
          end

Wednesday, May 18, 2011
Stack Depth
                                 Rails 2.3   Rails 3.0      Rails 3.1   Rails 3.2?

                           70


                          52.5


                           35


                          17.5


                            0
                                                     Stack Depth



Wednesday, May 18, 2011
Time for N Requests
                                      Rails 2.3         Rails 3.0          Rails 3.2?
                          100

                           10

                            1

                           0.1

                          0.01
                                 10               100               1000                10000
                                                        Requests
Wednesday, May 18, 2011
Avg Requests / time
                                     Rails 2.3         Rails 3.0          Rails 3.2?
                          650

                          500

                          350

                          200

                           50
                                10               100               1000                10000
                                                       Requests
Wednesday, May 18, 2011
git log --until="1 year from now"




Wednesday, May 18, 2011
Important
                                 things to
                                 me




                      We Must Change

Wednesday, May 18, 2011
Speed

Wednesday, May 18, 2011
Memory

Wednesday, May 18, 2011
Stack Depth

Wednesday, May 18, 2011
Backwards
                           Compat

Wednesday, May 18, 2011
Development
                           Pro Tip™

Wednesday, May 18, 2011
Wednesday, May 18, 2011
Final Words

Wednesday, May 18, 2011
We will not   Rails will
                                      be here
                                      forever       outlive us




                              A Message for                      Encourage
                                                                 refactoring

                          Stop "yes


                                Rails-Core
                          men"




Wednesday, May 18, 2011
Not all features
                           are Tangible

Wednesday, May 18, 2011
Good Abstraction
                               yield
                           Reusable Code
Wednesday, May 18, 2011
Reusable Code
                              yield
                          New Features
Wednesday, May 18, 2011
Your Homework:

Wednesday, May 18, 2011
GO GREEN!

Wednesday, May 18, 2011
Refactor Rails!

Wednesday, May 18, 2011
GO FORTH AND
                              CODE!

Wednesday, May 18, 2011
THANKS!

Wednesday, May 18, 2011
QUESTIONS?

Wednesday, May 18, 2011

More Related Content

Similar to RailsConf 2011 Keynote

Machines Talking To Themselves - Internet Of Things 101
Machines Talking To Themselves - Internet Of Things 101Machines Talking To Themselves - Internet Of Things 101
Machines Talking To Themselves - Internet Of Things 101Martin Spindler
 
Migrating To Rails 3, An In-house Developers Perspective
Migrating To Rails 3, An In-house Developers PerspectiveMigrating To Rails 3, An In-house Developers Perspective
Migrating To Rails 3, An In-house Developers PerspectiveMark Johnson
 
10 Web Development Concepts a Designer Should Know
10 Web Development Concepts a Designer Should Know10 Web Development Concepts a Designer Should Know
10 Web Development Concepts a Designer Should KnowRachel Andrew
 
Intridea & open source
Intridea & open sourceIntridea & open source
Intridea & open sourceDaniel Lv
 
RailsConf Keynote - History of Ruby
RailsConf Keynote - History of RubyRailsConf Keynote - History of Ruby
RailsConf Keynote - History of RubyDr Nic Williams
 
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Guillaume Laforge
 
GR8Conf 2011: Groovy 1.8 update
GR8Conf 2011: Groovy 1.8 updateGR8Conf 2011: Groovy 1.8 update
GR8Conf 2011: Groovy 1.8 updateGR8Conf
 

Similar to RailsConf 2011 Keynote (10)

Machines Talking To Themselves - Internet Of Things 101
Machines Talking To Themselves - Internet Of Things 101Machines Talking To Themselves - Internet Of Things 101
Machines Talking To Themselves - Internet Of Things 101
 
Migrating To Rails 3, An In-house Developers Perspective
Migrating To Rails 3, An In-house Developers PerspectiveMigrating To Rails 3, An In-house Developers Perspective
Migrating To Rails 3, An In-house Developers Perspective
 
10 Web Development Concepts a Designer Should Know
10 Web Development Concepts a Designer Should Know10 Web Development Concepts a Designer Should Know
10 Web Development Concepts a Designer Should Know
 
Bitcoin for Noobs
Bitcoin for NoobsBitcoin for Noobs
Bitcoin for Noobs
 
Intridea & open source
Intridea & open sourceIntridea & open source
Intridea & open source
 
HiRoshima.R #1 1-2
HiRoshima.R #1 1-2HiRoshima.R #1 1-2
HiRoshima.R #1 1-2
 
RailsConf Keynote - History of Ruby
RailsConf Keynote - History of RubyRailsConf Keynote - History of Ruby
RailsConf Keynote - History of Ruby
 
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
 
GR8Conf 2011: Groovy 1.8 update
GR8Conf 2011: Groovy 1.8 updateGR8Conf 2011: Groovy 1.8 update
GR8Conf 2011: Groovy 1.8 update
 
Webops dashboards
Webops dashboardsWebops dashboards
Webops dashboards
 

More from Aaron Patterson

More from Aaron Patterson (8)

RubyConf Argentina 2011
RubyConf Argentina 2011RubyConf Argentina 2011
RubyConf Argentina 2011
 
Behind the Curtain
Behind the CurtainBehind the Curtain
Behind the Curtain
 
ZOMG WHY IS THIS CODE SO SLOW
ZOMG WHY IS THIS CODE SO SLOWZOMG WHY IS THIS CODE SO SLOW
ZOMG WHY IS THIS CODE SO SLOW
 
RubyConf Brazil 2010
RubyConf Brazil 2010RubyConf Brazil 2010
RubyConf Brazil 2010
 
Hidden Gems of Ruby 1.9
Hidden Gems of Ruby 1.9Hidden Gems of Ruby 1.9
Hidden Gems of Ruby 1.9
 
Having Fun Programming!
Having Fun Programming!Having Fun Programming!
Having Fun Programming!
 
Ruby on Rails: Tasty Burgers
Ruby on Rails: Tasty BurgersRuby on Rails: Tasty Burgers
Ruby on Rails: Tasty Burgers
 
Worst. Ideas. Ever.
Worst. Ideas. Ever.Worst. Ideas. Ever.
Worst. Ideas. Ever.
 

Recently uploaded

UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 

Recently uploaded (20)

UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 

RailsConf 2011 Keynote

  • 6. I José Wednesday, May 18, 2011
  • 7. Double Dream Hands: SO INTENSE Wednesday, May 18, 2011
  • 15. AT&T, AT&T logo and all AT&T related marks are trademarks of AT&T Intellectual Property and/or AT&T affiliated companies. Wednesday, May 18, 2011
  • 17. Richard Gabriel Guy Steele DHH Researcher Software Architect Partner Wednesday, May 18, 2011
  • 18. Aaron Batalion Chad Dickerson Dan Melton CTO CTO CTO Wednesday, May 18, 2011
  • 19. Aaron Patterson Corey Haines Eric Ries Señor Software Corey Haines Venture Advisor Engineer Wednesday, May 18, 2011
  • 27. Agenda New Features Real Talk! Development Pro Tips™ Wednesday, May 18, 2011
  • 28. Implementation and thoughts on API design I will be very TECHNICAL Wednesday, May 18, 2011
  • 29. Because my audience is smart I will be very CRITICAL Because I care Wednesday, May 18, 2011
  • 31. git log --since="1 year ago" Wednesday, May 18, 2011
  • 35. Prepared Statements Wednesday, May 18, 2011
  • 36. select * from 'users' where id = 10 Wednesday, May 18, 2011
  • 37. select * from 'users' where id = ? Wednesday, May 18, 2011
  • 38. DATABASE RAILS APP Wednesday, May 18, 2011
  • 39. DATABASE Records RAILS APP Wednesday, May 18, 2011
  • 41. DATABASE RAILS APP Wednesday, May 18, 2011
  • 42. DATABASE Token RAILS APP Wednesday, May 18, 2011
  • 43. DATABASE RAILS APP Wednesday, May 18, 2011
  • 44. DATABASE Records RAILS APP Wednesday, May 18, 2011
  • 49. SQLite3 Simple Prepared Statement 100.00 10.00 y = 8.556E-5e2.2868x y = 0.0002e2.187x 1.00 0.10 0.01 0.00 0.00 10 100 1000 10000 100000 Number of Queries Cached Trend 1 Non-Cached Trend 2 Wednesday, May 18, 2011
  • 50. 8665 q/s 12987 q/s Wednesday, May 18, 2011
  • 51. Δ 4322 q/s Wednesday, May 18, 2011
  • 52. SQLite3 Complex SQL Statement 1000 100 y = 0.0003e2.2227x y = 0.0029e2.3111x 10 1 0 0 0 10 100 1000 10000 100000 Cached Trend 1 Number of Queries Non-Cached Trend 2 Wednesday, May 18, 2011
  • 53. 339 q/s 4184 q/s Wednesday, May 18, 2011
  • 54. Δ 3845 q/s Wednesday, May 18, 2011
  • 56. PostgreSQL Simple Query 100.0 y = 0.0002e2.3018x y = 0.0004e2.1424x 10.0 1.0 0.1 0.0 0.0 10 100 1000 10000 100000 Cached Trend 1 Queries No Cache Trend 2 Wednesday, May 18, 2011
  • 57. 4662 q/s 5586 q/s Wednesday, May 18, 2011
  • 58. Δ 924 q/s Wednesday, May 18, 2011
  • 59. PostgreSQL Complex Query 1000 y = 0.0005e2.173x 100 y = 0.0047e2.2153x 10 1 0 0 0 10 100 1000 10000 100000 Queries Cached Trend 1 No Cache Trend 2 Wednesday, May 18, 2011
  • 60. 307 q/s 3322 q/s Wednesday, May 18, 2011
  • 61. Δ 3015 q/s Wednesday, May 18, 2011
  • 63. MySQL Simple Query 100 10 1 0 0 0 10 100 1000 10000 100000 Cache No Cache Queries Wednesday, May 18, 2011
  • 64. 6410 q/s 5154 q/s Wednesday, May 18, 2011
  • 65. Δ -1256 q/s Wednesday, May 18, 2011
  • 66. MySQL Complex SQL Query 1000 100 10 1 0 0 0 10 100 1000 10000 100000 Cached Category Title No Cache Wednesday, May 18, 2011
  • 67. 626 q/s 1198 q/s Wednesday, May 18, 2011
  • 68. Δ 572 q/s Wednesday, May 18, 2011
  • 69. No Query Planning Wednesday, May 18, 2011
  • 70. Two Network Roundtrips Wednesday, May 18, 2011
  • 73. select updated_at from pirates [[#<Mysql::Time:2011-05-13 22:03:55>]] [["2011-05-13 22:03:55"]] Wednesday, May 18, 2011
  • 74. select updated_at from pirates Prepared Statement [[#<Mysql::Time:2011-05-13 22:03:55>]] [["2011-05-13 22:03:55"]] Wednesday, May 18, 2011
  • 75. select updated_at from pirates [[#<Mysql::Time:2011-05-13 22:03:55>]] Regular Statement [["2011-05-13 22:03:55"]] Wednesday, May 18, 2011
  • 79. Serialized Attributes Wednesday, May 18, 2011
  • 80. class User < ActiveRecord::Base serialize :preferences end Wednesday, May 18, 2011
  • 81. Saves as YAML user = User.find 1 user.preferences = { :hello => 'world!' } user.save! Wednesday, May 18, 2011
  • 83. class User < ActiveRecord::Base serialize :preferences, Base64Encoder.new end Wednesday, May 18, 2011
  • 84. Base 64 Storage class Base64Encoder def load(value) return unless value value.unpack('m').last end def dump(text) [text].pack('m') end end Wednesday, May 18, 2011
  • 85. JSON Storage class JSONEncoder def load(value) return unless value JSON.load value end def dump(text) JSON.dump(text) end end Wednesday, May 18, 2011
  • 86. Marshal Storage class MarshalEncoder def load(value) return unless value Marshal.load value end def dump(text) Marshal.dump(text) end end Wednesday, May 18, 2011
  • 87. XML Storage class XMLEncoder def load(value) return unless value Nokogiri.XML value end def dump(doc) doc.to_xml end end Wednesday, May 18, 2011
  • 88. Official NoSQL Support Wednesday, May 18, 2011
  • 89. IT'S OFFI CIAL Official NoSQL ! Support Wednesday, May 18, 2011
  • 93. You might hurt yourself Wednesday, May 18, 2011
  • 95. DO NOT DO THIS class User < ActiveRecord::Base class HStore def load value return unless value eval "{#{value}}" end def dump value return unless value value.map { |xs| xs.join '=>' }.join ', ' end end serialize :preferences, HStore.new end Wednesday, May 18, 2011
  • 96. BCrypt Coder class BCryptCoder def load(value) return unless value BCrypt::Password.new value end def dump(value) BCrypt::Password.create(value).to_s end end Wednesday, May 18, 2011
  • 97. BCrypt Serialization class User < ActiveRecord::Base serialize :crazy_column, BCryptCoder.new end Wednesday, May 18, 2011
  • 98. stdlib serialization API Dumping Loading YAML dump load JSON dump load Marshal dump load Wednesday, May 18, 2011
  • 99. Storage type YOU choose Column name Wednesday, May 18, 2011
  • 100. Good Abstractions yield Good Features Wednesday, May 18, 2011
  • 101. CONSISTENCY is FREEDOM and FLEXIBILITY Wednesday, May 18, 2011
  • 103. SECURITY! class User < ActiveRecord::Base has_secure_password end Wednesday, May 18, 2011
  • 104. SECURITY! user = User.find 1 user.password = 'lolwut' user.save! Wednesday, May 18, 2011
  • 105. Advantages Introduces a new method Saves password in `password_digest` Uses BCrypt Wednesday, May 18, 2011
  • 106. Disadvantages API is not flexible Introduces a new method Saves password in `password_digest` Not Uses BCrypt reusable Wednesday, May 18, 2011
  • 108. Write Something REUSABLE! Wednesday, May 18, 2011
  • 109. response streaming Streaming chunked encoding Responses Wednesday, May 18, 2011
  • 110. Rack API class MyApp def call(env) [200, { 'X-ZOMG' => 'hi' }, ['web page!']] end end Wednesday, May 18, 2011
  • 111. Rails 3.0.x class PoniesController def call(env) body << render(:content) body << render(:layout) [200, {}, body] end end Wednesday, May 18, 2011
  • 112. Delayed Evaluation Wednesday, May 18, 2011
  • 114. Rails 3.1.x class DelayedBody def each yield render(:layout) yield render(:content) end end class PoniesController def call(env) [200, {}, DelayedBody.new] end end Wednesday, May 18, 2011
  • 116. Middleware ☹ Wednesday, May 18, 2011
  • 117. Middleware Chain Just consider connection Request Timer manager and application Connection Manager Application Wednesday, May 18, 2011
  • 118. Middleware Chain Connection Manager Application Wednesday, May 18, 2011
  • 119. Middleware Chain call(env) Connection Manager call(env) Application Wednesday, May 18, 2011
  • 120. Middleware Chain [200, {}, body] Connection Manager [200, {}, body] Application Wednesday, May 18, 2011
  • 121. Connection Manager When ERb is evaluated, db connection does not exist Wednesday, May 18, 2011
  • 122. Connection Manager Open DB Connection When ERb is evaluated, db connection does not exist Wednesday, May 18, 2011
  • 123. Connection Manager Open DB Connection When ERb is evaluated, db connection does not exist Delegate Wednesday, May 18, 2011
  • 124. Connection Manager Open DB Connection When ERb is evaluated, db connection does not exist Delegate Close DB Connection Wednesday, May 18, 2011
  • 125. Connection Manager Open DB Connection When ERb is evaluated, db connection does not exist Delegate Close DB Connection Return Delegate Values Wednesday, May 18, 2011
  • 129. Body Proxy class ConnectionBodyProxy def initialize(delegate) @delegate = delegate end def each(&blk) @delegate.each(&blk) end def close # CLOSE CONNECTION end end Wednesday, May 18, 2011
  • 130. Connection Manager class ConnectionManager def initialize(app); @app = app; end def call(env) # OPEN CONNECTION response = @app.call(env) response[2] = ConnectionBodyProxy.new(response[2]) response end end Wednesday, May 18, 2011
  • 135. Embrace Diversity Wednesday, May 18, 2011
  • 136. Types of Middleware Generators (our application) Filters (gzip, etc) Lifecycle Handlers (connection management) Wednesday, May 18, 2011
  • 138. Rails is getting slower Wednesday, May 18, 2011
  • 139. Time for N Requests Rails 2.3 Rails 3.0 100 10 1 0.1 0.01 10 100 1000 10000 Requests Wednesday, May 18, 2011
  • 140. Avg Requests / time Rails 2.3 Rails 3.0 500 387.5 275 162.5 50 10 100 1000 10000 Requests Wednesday, May 18, 2011
  • 141. Middleware Increased Wednesday, May 18, 2011
  • 142. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby Total samples: 740 Rack garbage_collector Object#require Object#map ActiveRecord ConnectionAdapters Focusing on: 740 Runtime#call 0 (0.0%) 27 (3.6%) 165 0 (0.0%) SQLiteAdapter#execute 146 (19.7%) of 57 (7.7%) 1 (0.1%) of 463 (62.6%) Dropped nodes with <= 3 abs(samples) of 128 (17.3%) of 56 (7.6%) Dropped edges with <= 0 samples 463 118 74 62 Rails Rack Kernel#require Rails30 Application.method_missing Logger#call 0 (0.0%) 28 (3.8%) 60 0 (0.0%) of 62 (8.4%) of 463 (62.6%) of 63 (8.5%) 381 80 62 ActionDispatch Rails ShowExceptions#call Application#initialize! 0 (0.0%) 0 (0.0%) of 381 (51.5%) of 62 (8.4%) Rails Rack 381 Logger#after_dispatch 0 (0.0%) 62 17 of 80 (10.8%) ActionDispatch Object#run_initializers RemoteIp#call 0 (0.0%) 80 0 (0.0%) of 62 (8.4%) 60 of 382 (51.6%) ActiveSupport LogSubscriber.flush_all! 382 0 (0.0%) 60 of 80 (10.8%) Rails Rack Initializable Sendfile#call Initializer#run 0 (0.0%) 0 (0.0%) of 383 (51.8%) of 60 (8.1%) 383 60 ActionDispatch Object#instance_exec Callbacks#call 2 (0.3%) 2 (0.3%) of 60 (8.1%) of 383 (51.8%) 381 381 381 ActiveRecord ActionDispatch ConnectionAdapters Callbacks#_run_call_callbacks ConnectionManagement#call 0 (0.0%) 0 (0.0%) of 381 (51.5%) of 381 (51.5%) 375 ActiveRecord QueryCache#call 2 (0.3%) of 377 (50.9%) 372 375 Wednesday, May 18, 2011 ActionDispatch
  • 143. 230 230 230 219 219 ActionController Benchmark.ms ActionController Metal#cleanup_view_runtime Metal#render_to_string 0 (0.0%) 230 10 (1.4%) 0 (0.0%) of 230 (31.1%) of 230 (31.1%) of 219 (29.6%) 219 220 213 ActionController Benchmark.realtime Metal#render_to_body 0 (0.0%) of 220 (29.7%) 2 (0.3%) 424 of 213 (28.8%) 210 ActionController Metal#_render_template 0 (0.0%) of 210 (28.4%) 190 ActiveSupport Object#render Notifications.instrument 0 (0.0%) 0 (0.0%) of 190 (25.7%) of 322 (43.5%) 487 507 175 185 189 ActiveSupport Notifications Object#_render_template 167 Instrumenter#instrument 0 (0.0%) 2 (0.3%) 167 of 322 (43.5%) of 189 (25.5%) 18 ActionView Template#render 2 (0.3%) of 167 (22.6%) 148 155 Object#_app_views_layouts_application_html_erb___604422253_2164033400_0 0 (0.0%) of 148 (20.0%) 149 85 58 1 Object#stylesheet_link_tag Object#javascript_include_tag Object#_render_layout 0 (0.0%) 3 (0.4%) 6 (0.8%) of 85 (11.5%) of 58 (7.8%) of 155 (20.9%) 83 Object#expand_stylesheet_sources 0 (0.0%) of 83 (11.2%) 81 Object#collect_asset_files 81 (10.9%) Wednesday, May 18, 2011
  • 144. work/Versions/1.8/usr/bin/ruby Rack Runtime#call 0 (0.0%) garbage_collector Object#require 27 (3.6%) 165 Object#map 0 (0.0%) ActiveRecord ConnectionAdapters SQLiteAdapter#execute 146 (19.7%) of 57 (7.7%) 1 (0.1%) of 463 (62.6%) of 128 (17.3%) of 56 (7.6%) 463 118 74 62 Rails Rack Kernel#require Rails30 Application.method_missing Logger#call 0 (0.0%) 28 (3.8%) 60 0 (0.0%) of 62 (8.4%) of 463 (62.6%) of 63 (8.5%) 381 80 62 ActionDispatch Rails ShowExceptions#call Application#initialize! 0 (0.0%) 0 (0.0%) of 381 (51.5%) of 62 (8.4%) Rails Rack 381 Logger#after_dispatch 0 (0.0%) 62 17 of 80 (10.8%) ActionDispatch Object#run_initializers RemoteIp#call Wednesday, May 18, 2011 0 (0.0%) 80 0 (0.0%) 60
  • 146. Stack Depth Rails 2.3 Rails 3.0 Rails 3.1 70 52.5 35 17.5 0 Stack Depth Wednesday, May 18, 2011
  • 147. Rails 2.3 Stack Wednesday, May 18, 2011
  • 149. Rails 3.0 Stack Wednesday, May 18, 2011
  • 151. Rails 3.1 Stack Wednesday, May 18, 2011
  • 153. /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:150:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rendering.rb:11:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:18:in `process_action' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:436:in `_run__84203013__process_action__199225275__callbacks' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410:in `send' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94:in `send' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94:in `run_callbacks' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:17:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:30:in `process_action' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52:in `instrument' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications/instrumenter.rb:21:in `instrument' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52:in `instrument' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:29:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rescue.rb:17:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:119:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:41:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:138:in `dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:178:in `action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62:in `dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:27:in `call' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:148:in `call' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:93:in `recognize' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:68:in `optimized_each' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:92:in `recognize' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:139:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:493:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/head.rb:14:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/methodoverride.rb:24:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/params_parser.rb:21:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/flash.rb:182:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/cookies.rb:302:in `call' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:32:in `call' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:12:in `cache' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:31:in `call' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:46:in `call' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:416:in `_run_call_callbacks' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:44:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/sendfile.rb:107:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/remote_ip.rb:48:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call' /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/rack/logger.rb:13:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/runtime.rb:17:in `call' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/cache/strategy/local_cache.rb:72:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `synchronize' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/static.rb:30:in `call' /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:168:in `call' fuuu.rb:44 fuuu.rb:43:in `times' fuuu.rb:43 Wednesday, May 18, 2011
  • 154. /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/implicit_render.rb:5:in `send_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:150:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rendering.rb:11:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:18:in `process_action' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:436:in `_run__84203013__process_action__199225275__callbacks' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410:in `send' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94:in `send' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:94:in `run_callbacks' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/callbacks.rb:17:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:30:in `process_action' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52:in `instrument' TL;DR /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications/instrumenter.rb:21:in `instrument' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/notifications.rb:52:in `instrument' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/instrumentation.rb:29:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rescue.rb:17:in `process_action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/base.rb:119:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/abstract_controller/rendering.rb:41:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:138:in `dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_controller/metal.rb:178:in `action' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:62:in `dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:27:in `call' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:148:in `call' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:93:in `recognize' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:68:in `optimized_each' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:92:in `recognize' /Library/Ruby/Gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:139:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/route_set.rb:493:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/head.rb:14:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/methodoverride.rb:24:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/params_parser.rb:21:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/flash.rb:182:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/cookies.rb:302:in `call' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:32:in `call' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:12:in `cache' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/query_cache.rb:31:in `call' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:46:in `call' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:416:in `_run_call_callbacks' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/callbacks.rb:44:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/sendfile.rb:107:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/remote_ip.rb:48:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call' /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/rack/logger.rb:13:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/runtime.rb:17:in `call' /Library/Ruby/Gems/1.8/gems/activesupport-3.0.7/lib/active_support/cache/strategy/local_cache.rb:72:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `synchronize' /Library/Ruby/Gems/1.8/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware/static.rb:30:in `call' /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:168:in `call' fuuu.rb:44 fuuu.rb:43:in `times' fuuu.rb:43 Wednesday, May 18, 2011
  • 155. Embrace Diversity Wednesday, May 18, 2011
  • 156. We need a change Wednesday, May 18, 2011
  • 157. Generators class Application def call(request, response) response.write(request, "hello", 200, {}) 10.times do |body| response.write(request, body) end response.close end end Wednesday, May 18, 2011
  • 158. Filters class Filter def initialize(filter) @filter = filter end def write(request, body, status = nil, headers = nil) @filter.write(request, body, status, headers) end def close @filter.close end end Wednesday, May 18, 2011
  • 159. Lifecycle Hooks class Handler def before(request) # Connect to database end def after(request) # Disconnect end end Wednesday, May 18, 2011
  • 160. Stack Depth Rails 2.3 Rails 3.0 Rails 3.1 Rails 3.2? 70 52.5 35 17.5 0 Stack Depth Wednesday, May 18, 2011
  • 161. Time for N Requests Rails 2.3 Rails 3.0 Rails 3.2? 100 10 1 0.1 0.01 10 100 1000 10000 Requests Wednesday, May 18, 2011
  • 162. Avg Requests / time Rails 2.3 Rails 3.0 Rails 3.2? 650 500 350 200 50 10 100 1000 10000 Requests Wednesday, May 18, 2011
  • 163. git log --until="1 year from now" Wednesday, May 18, 2011
  • 164. Important things to me We Must Change Wednesday, May 18, 2011
  • 168. Backwards Compat Wednesday, May 18, 2011
  • 169. Development Pro Tip™ Wednesday, May 18, 2011
  • 172. We will not Rails will be here forever outlive us A Message for Encourage refactoring Stop "yes Rails-Core men" Wednesday, May 18, 2011
  • 173. Not all features are Tangible Wednesday, May 18, 2011
  • 174. Good Abstraction yield Reusable Code Wednesday, May 18, 2011
  • 175. Reusable Code yield New Features Wednesday, May 18, 2011
  • 179. GO FORTH AND CODE! Wednesday, May 18, 2011