0
Before I Begin...Wednesday, May 18, 2011
@jonleightonWednesday, 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 INTENSEWednesday, May 18, 2011
ZOMG!!!Wednesday, May 18, 2011
HAPPYWednesday, May 18, 2011
RAILSWednesday, May 18, 2011
CONFWednesday, May 18, 2011
Wednesday, May 18, 2011
Aaron PattersonWednesday, May 18, 2011
@tenderloveWednesday, 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.W...
WWFMD?Wednesday, May 18, 2011
Richard Gabriel      Guy Steele         DHH                   Researcher      Software Architect   PartnerWednesday, May 1...
Aaron Batalion   Chad Dickerson   Dan Melton                      CTO               CTO            CTOWednesday, May 18, 2...
Aaron Patterson                    Corey Haines      Eric Ries                                                     Señor S...
Wednesday, May 18, 2011
LOLWUTWednesday, May 18, 2011
Señor Software EngineerWednesday, May 18, 2011
Señor Software EngineerWednesday, May 18, 2011
Wednesday, May 18, 2011
Wednesday, May 18, 2011
AgendaWednesday, May 18, 2011
Agenda                              New Features                                Real Talk!                          Develo...
Implementation                                    and thoughts on                                    API design           ...
Because my                                      audience is                                      smart                    ...
New Features!Wednesday, May 18, 2011
git log --since="1 year ago"Wednesday, May 18, 2011
API StrategyWednesday, May 18, 2011
rails generate VCWednesday, May 18, 2011
def halts?(function)Wednesday, May 18, 2011
Prepared                          StatementsWednesday, May 18, 2011
select * from users                              where id = 10Wednesday, May 18, 2011
select * from users                               where id = ?Wednesday, May 18, 2011
DATABASE                          RAILS APPWednesday, May 18, 2011
DATABASE                           Records                          RAILS APPWednesday, May 18, 2011
4 Steps!Wednesday, May 18, 2011
DATABASE                          RAILS APPWednesday, May 18, 2011
DATABASE                            Token                          RAILS APPWednesday, May 18, 2011
DATABASE                          RAILS APPWednesday, May 18, 2011
DATABASE                           Records                          RAILS APPWednesday, May 18, 2011
4 Steps!Wednesday, May 18, 2011
2 Steps!Wednesday, May 18, 2011
ImpactWednesday, May 18, 2011
SQLite3Wednesday, May 18, 2011
SQLite3 Simple Prepared Statement              100.00                  10.00                                 y = 8.556E-5e...
8665 q/s                          12987 q/sWednesday, May 18, 2011
Δ 4322 q/sWednesday, May 18, 2011
SQLite3 Complex SQL Statement                    1000                          100                                     y =...
339 q/s                          4184 q/sWednesday, May 18, 2011
Δ 3845 q/sWednesday, May 18, 2011
PostgreSQLWednesday, May 18, 2011
PostgreSQL Simple Query             100.0                           y = 0.0002e2.3018x                           y = 0.000...
4662 q/s                          5586 q/sWednesday, May 18, 2011
Δ 924 q/sWednesday, May 18, 2011
PostgreSQL Complex Query       1000                          y = 0.0005e2.173x          100                          y = 0...
307 q/s                          3322 q/sWednesday, May 18, 2011
Δ 3015 q/sWednesday, May 18, 2011
MySQLWednesday, May 18, 2011
MySQL Simple Query           100              10                1                0                0                0      ...
6410 q/s                          5154 q/sWednesday, May 18, 2011
Δ -1256 q/sWednesday, May 18, 2011
MySQL Complex SQL Query           1000              100                 10                   1                   0        ...
626 q/s                          1198 q/sWednesday, May 18, 2011
Δ 572 q/sWednesday, May 18, 2011
No Query                          PlanningWednesday, May 18, 2011
Two Network                           RoundtripsWednesday, 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>]]          [...
select updated_at from                                  pirates                               Prepared Statement          ...
select updated_at from                                    pirates          [[#<Mysql::Time:2011-05-13 22:03:55>]]         ...
API ChangesWednesday, May 18, 2011
User.find 1Wednesday, May 18, 2011
User.find 1Wednesday, May 18, 2011
Serialized                          AttributesWednesday, May 18, 2011
class User < ActiveRecord::Base                       serialize :preferences                     endWednesday, May 18, 2011
Saves as YAML          user = User.find 1          user.preferences = { :hello => world! }          user.save!Wednesday, M...
Why YAML?Wednesday, May 18, 2011
class User < ActiveRecord::Base                       serialize :preferences, Base64Encoder.new                     endWed...
Base 64 Storage          class Base64Encoder            def load(value)              return unless value              valu...
JSON Storage          class JSONEncoder            def load(value)              return unless value              JSON.load...
Marshal Storage          class MarshalEncoder            def load(value)              return unless value              Mar...
XML Storage          class XMLEncoder            def load(value)              return unless value              Nokogiri.XM...
Official NoSQL                             SupportWednesday, May 18, 2011
ITS                                    OFFI                                         CIAL                          Official ...
Wednesday, May 18, 2011
2 CaveatsWednesday, May 18, 2011
PostgreSQL OnlyWednesday, May 18, 2011
You might hurt                             yourselfWednesday, May 18, 2011
Wednesday, May 18, 2011
DO NOT DO THIS          class User < ActiveRecord::Base            class HStore              def load value               ...
BCrypt Coder          class BCryptCoder            def load(value)              return unless value              BCrypt::P...
BCrypt Serialization          class User < ActiveRecord::Base            serialize :crazy_column, BCryptCoder.new         ...
stdlib serialization API                                    Dumping   Loading                           YAML      dump    ...
Storage type                          YOU choose                                 Column nameWednesday, May 18, 2011
Good Abstractions                            yield                       Good FeaturesWednesday, May 18, 2011
CONSISTENCY                            is FREEDOM                          and FLEXIBILITYWednesday, May 18, 2011
has_secure_passwordWednesday, May 18, 2011
SECURITY!          class User < ActiveRecord::Base            has_secure_password          endWednesday, 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`  ...
Disadvantages                                                      API is not flexible                          Introduces...
GO GREEN!Wednesday, May 18, 2011
Write Something                           REUSABLE!Wednesday, May 18, 2011
response                                      streaming                          Streaming    chunked                     ...
Rack API          class MyApp            def call(env)              [200, { X-ZOMG => hi }, [web page!]]            end   ...
Rails 3.0.x          class PoniesController            def call(env)              body << render(:content)              bo...
Delayed                          EvaluationWednesday, May 18, 2011
Body#eachWednesday, May 18, 2011
Rails 3.1.x          class DelayedBody            def each              yield render(:layout)              yield render(:c...
MiddlewareWednesday, May 18, 2011
Middleware   ☹Wednesday, May 18, 2011
Middleware Chain                                                  Just consider                                           ...
Middleware Chain                            Connection Manager                                ApplicationWednesday, May 18...
Middleware Chain                                 call(env)                            Connection Manager                  ...
Middleware Chain                               [200, {}, body]                            Connection Manager              ...
Connection Manager                                         When ERb is evaluated,                                         ...
Connection Manager                             Open DB Connection   When ERb is evaluated,                                ...
Connection Manager                             Open DB Connection   When ERb is evaluated,                                ...
Connection Manager                             Open DB Connection    When ERb is evaluated,                               ...
Connection Manager                              Open DB Connection      When ERb is evaluated,                            ...
Problem?Wednesday, May 18, 2011
Problem?Wednesday, May 18, 2011
Body#closeWednesday, May 18, 2011
Body Proxy          class ConnectionBodyProxy            def initialize(delegate)              @delegate = delegate       ...
Connection Manager          class ConnectionManager            def initialize(app); @app = app; end            def call(en...
Wednesday, May 18, 2011
Wednesday, May 18, 2011
Wednesday, May 18, 2011
~25 middlewareWednesday, May 18, 2011
Embrace                          DiversityWednesday, May 18, 2011
Types of Middleware                          Generators (our application)                          Filters (gzip, etc)    ...
Real Talk!Wednesday, May 18, 2011
Rails is getting                              slowerWednesday, May 18, 2011
Time for N Requests                                      Rails 2.3               Rails 3.0                          100   ...
Avg Requests / time                                       Rails 2.3               Rails 3.0                           500 ...
Middleware                          IncreasedWednesday, May 18, 2011
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby        Total samples: 740                             ...
230             230             230 219          219                                                                      ...
work/Versions/1.8/usr/bin/ruby                                                                                       Rack ...
GC PressureWednesday, May 18, 2011
Stack Depth                                 Rails 2.3    Rails 3.0    Rails 3.1                           70              ...
Rails 2.3 StackWednesday, May 18, 2011
51 deepWednesday, May 18, 2011
Rails 3.0 StackWednesday, May 18, 2011
60 deepWednesday, May 18, 2011
Rails 3.1 StackWednesday, May 18, 2011
67 deepWednesday, 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             ...
Embrace                          DiversityWednesday, May 18, 2011
We need a                           changeWednesday, May 18, 2011
Generators          class Application            def call(request, response)              response.write(request, "hello",...
Filters          class Filter            def initialize(filter)              @filter = filter            end              ...
Lifecycle Hooks          class Handler            def before(request)              # Connect to database            end   ...
Stack Depth                                 Rails 2.3   Rails 3.0      Rails 3.1   Rails 3.2?                           70...
Time for N Requests                                      Rails 2.3         Rails 3.0          Rails 3.2?                  ...
Avg Requests / time                                     Rails 2.3         Rails 3.0          Rails 3.2?                   ...
git log --until="1 year from now"Wednesday, May 18, 2011
Important                                 things to                                 me                      We Must Change...
SpeedWednesday, May 18, 2011
MemoryWednesday, May 18, 2011
Stack DepthWednesday, May 18, 2011
Backwards                           CompatWednesday, May 18, 2011
Development                           Pro Tip™Wednesday, May 18, 2011
Wednesday, May 18, 2011
Final WordsWednesday, May 18, 2011
We will not   Rails will                                      be here                                      forever       o...
Not all features                           are TangibleWednesday, May 18, 2011
Good Abstraction                               yield                           Reusable CodeWednesday, May 18, 2011
Reusable Code                              yield                          New FeaturesWednesday, 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
Upcoming SlideShare
Loading in...5
×

RailsConf 2011 Keynote

3,761

Published on

this is my keynote for railsconf.

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

No Downloads
Views
Total Views
3,761
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
63
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "RailsConf 2011 Keynote"

  1. 1. Before I Begin...Wednesday, May 18, 2011
  2. 2. @jonleightonWednesday, May 18, 2011
  3. 3. Wednesday, May 18, 2011
  4. 4. Wednesday, May 18, 2011
  5. 5. Wednesday, May 18, 2011
  6. 6. I JoséWednesday, May 18, 2011
  7. 7. Double Dream Hands: SO INTENSEWednesday, May 18, 2011
  8. 8. ZOMG!!!Wednesday, May 18, 2011
  9. 9. HAPPYWednesday, May 18, 2011
  10. 10. RAILSWednesday, May 18, 2011
  11. 11. CONFWednesday, May 18, 2011
  12. 12. Wednesday, May 18, 2011
  13. 13. Aaron PattersonWednesday, May 18, 2011
  14. 14. @tenderloveWednesday, May 18, 2011
  15. 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
  16. 16. WWFMD?Wednesday, May 18, 2011
  17. 17. Richard Gabriel Guy Steele DHH Researcher Software Architect PartnerWednesday, May 18, 2011
  18. 18. Aaron Batalion Chad Dickerson Dan Melton CTO CTO CTOWednesday, May 18, 2011
  19. 19. Aaron Patterson Corey Haines Eric Ries Señor Software Corey Haines Venture Advisor EngineerWednesday, May 18, 2011
  20. 20. Wednesday, May 18, 2011
  21. 21. LOLWUTWednesday, May 18, 2011
  22. 22. Señor Software EngineerWednesday, May 18, 2011
  23. 23. Señor Software EngineerWednesday, May 18, 2011
  24. 24. Wednesday, May 18, 2011
  25. 25. Wednesday, May 18, 2011
  26. 26. AgendaWednesday, May 18, 2011
  27. 27. Agenda New Features Real Talk! Development Pro Tips™Wednesday, May 18, 2011
  28. 28. Implementation and thoughts on API design I will be very TECHNICALWednesday, May 18, 2011
  29. 29. Because my audience is smart I will be very CRITICAL Because I careWednesday, May 18, 2011
  30. 30. New Features!Wednesday, May 18, 2011
  31. 31. git log --since="1 year ago"Wednesday, May 18, 2011
  32. 32. API StrategyWednesday, May 18, 2011
  33. 33. rails generate VCWednesday, May 18, 2011
  34. 34. def halts?(function)Wednesday, May 18, 2011
  35. 35. Prepared StatementsWednesday, May 18, 2011
  36. 36. select * from users where id = 10Wednesday, May 18, 2011
  37. 37. select * from users where id = ?Wednesday, May 18, 2011
  38. 38. DATABASE RAILS APPWednesday, May 18, 2011
  39. 39. DATABASE Records RAILS APPWednesday, May 18, 2011
  40. 40. 4 Steps!Wednesday, May 18, 2011
  41. 41. DATABASE RAILS APPWednesday, May 18, 2011
  42. 42. DATABASE Token RAILS APPWednesday, May 18, 2011
  43. 43. DATABASE RAILS APPWednesday, May 18, 2011
  44. 44. DATABASE Records RAILS APPWednesday, May 18, 2011
  45. 45. 4 Steps!Wednesday, May 18, 2011
  46. 46. 2 Steps!Wednesday, May 18, 2011
  47. 47. ImpactWednesday, May 18, 2011
  48. 48. SQLite3Wednesday, May 18, 2011
  49. 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 2Wednesday, May 18, 2011
  50. 50. 8665 q/s 12987 q/sWednesday, May 18, 2011
  51. 51. Δ 4322 q/sWednesday, May 18, 2011
  52. 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 2Wednesday, May 18, 2011
  53. 53. 339 q/s 4184 q/sWednesday, May 18, 2011
  54. 54. Δ 3845 q/sWednesday, May 18, 2011
  55. 55. PostgreSQLWednesday, May 18, 2011
  56. 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 2Wednesday, May 18, 2011
  57. 57. 4662 q/s 5586 q/sWednesday, May 18, 2011
  58. 58. Δ 924 q/sWednesday, May 18, 2011
  59. 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 2Wednesday, May 18, 2011
  60. 60. 307 q/s 3322 q/sWednesday, May 18, 2011
  61. 61. Δ 3015 q/sWednesday, May 18, 2011
  62. 62. MySQLWednesday, May 18, 2011
  63. 63. MySQL Simple Query 100 10 1 0 0 0 10 100 1000 10000 100000 Cache No Cache QueriesWednesday, May 18, 2011
  64. 64. 6410 q/s 5154 q/sWednesday, May 18, 2011
  65. 65. Δ -1256 q/sWednesday, May 18, 2011
  66. 66. MySQL Complex SQL Query 1000 100 10 1 0 0 0 10 100 1000 10000 100000 Cached Category Title No CacheWednesday, May 18, 2011
  67. 67. 626 q/s 1198 q/sWednesday, May 18, 2011
  68. 68. Δ 572 q/sWednesday, May 18, 2011
  69. 69. No Query PlanningWednesday, May 18, 2011
  70. 70. Two Network RoundtripsWednesday, May 18, 2011
  71. 71. Problem?Wednesday, May 18, 2011
  72. 72. Problem?Wednesday, May 18, 2011
  73. 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. 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. 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
  76. 76. API ChangesWednesday, May 18, 2011
  77. 77. User.find 1Wednesday, May 18, 2011
  78. 78. User.find 1Wednesday, May 18, 2011
  79. 79. Serialized AttributesWednesday, May 18, 2011
  80. 80. class User < ActiveRecord::Base serialize :preferences endWednesday, May 18, 2011
  81. 81. Saves as YAML user = User.find 1 user.preferences = { :hello => world! } user.save!Wednesday, May 18, 2011
  82. 82. Why YAML?Wednesday, May 18, 2011
  83. 83. class User < ActiveRecord::Base serialize :preferences, Base64Encoder.new endWednesday, May 18, 2011
  84. 84. Base 64 Storage class Base64Encoder def load(value) return unless value value.unpack(m).last end def dump(text) [text].pack(m) end endWednesday, May 18, 2011
  85. 85. JSON Storage class JSONEncoder def load(value) return unless value JSON.load value end def dump(text) JSON.dump(text) end endWednesday, May 18, 2011
  86. 86. Marshal Storage class MarshalEncoder def load(value) return unless value Marshal.load value end def dump(text) Marshal.dump(text) end endWednesday, May 18, 2011
  87. 87. XML Storage class XMLEncoder def load(value) return unless value Nokogiri.XML value end def dump(doc) doc.to_xml end endWednesday, May 18, 2011
  88. 88. Official NoSQL SupportWednesday, May 18, 2011
  89. 89. ITS OFFI CIAL Official NoSQL ! SupportWednesday, May 18, 2011
  90. 90. Wednesday, May 18, 2011
  91. 91. 2 CaveatsWednesday, May 18, 2011
  92. 92. PostgreSQL OnlyWednesday, May 18, 2011
  93. 93. You might hurt yourselfWednesday, May 18, 2011
  94. 94. Wednesday, May 18, 2011
  95. 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 endWednesday, May 18, 2011
  96. 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 endWednesday, May 18, 2011
  97. 97. BCrypt Serialization class User < ActiveRecord::Base serialize :crazy_column, BCryptCoder.new endWednesday, May 18, 2011
  98. 98. stdlib serialization API Dumping Loading YAML dump load JSON dump load Marshal dump loadWednesday, May 18, 2011
  99. 99. Storage type YOU choose Column nameWednesday, May 18, 2011
  100. 100. Good Abstractions yield Good FeaturesWednesday, May 18, 2011
  101. 101. CONSISTENCY is FREEDOM and FLEXIBILITYWednesday, May 18, 2011
  102. 102. has_secure_passwordWednesday, May 18, 2011
  103. 103. SECURITY! class User < ActiveRecord::Base has_secure_password endWednesday, May 18, 2011
  104. 104. SECURITY! user = User.find 1 user.password = lolwut user.save!Wednesday, May 18, 2011
  105. 105. Advantages Introduces a new method Saves password in `password_digest` Uses BCryptWednesday, May 18, 2011
  106. 106. Disadvantages API is not flexible Introduces a new method Saves password in `password_digest` Not Uses BCrypt reusableWednesday, May 18, 2011
  107. 107. GO GREEN!Wednesday, May 18, 2011
  108. 108. Write Something REUSABLE!Wednesday, May 18, 2011
  109. 109. response streaming Streaming chunked encoding ResponsesWednesday, May 18, 2011
  110. 110. Rack API class MyApp def call(env) [200, { X-ZOMG => hi }, [web page!]] end endWednesday, May 18, 2011
  111. 111. Rails 3.0.x class PoniesController def call(env) body << render(:content) body << render(:layout) [200, {}, body] end endWednesday, May 18, 2011
  112. 112. Delayed EvaluationWednesday, May 18, 2011
  113. 113. Body#eachWednesday, May 18, 2011
  114. 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 endWednesday, May 18, 2011
  115. 115. MiddlewareWednesday, May 18, 2011
  116. 116. Middleware ☹Wednesday, May 18, 2011
  117. 117. Middleware Chain Just consider connection Request Timer manager and application Connection Manager ApplicationWednesday, May 18, 2011
  118. 118. Middleware Chain Connection Manager ApplicationWednesday, May 18, 2011
  119. 119. Middleware Chain call(env) Connection Manager call(env) ApplicationWednesday, May 18, 2011
  120. 120. Middleware Chain [200, {}, body] Connection Manager [200, {}, body] ApplicationWednesday, May 18, 2011
  121. 121. Connection Manager When ERb is evaluated, db connection does not existWednesday, May 18, 2011
  122. 122. Connection Manager Open DB Connection When ERb is evaluated, db connection does not existWednesday, May 18, 2011
  123. 123. Connection Manager Open DB Connection When ERb is evaluated, db connection does not exist DelegateWednesday, May 18, 2011
  124. 124. Connection Manager Open DB Connection When ERb is evaluated, db connection does not exist Delegate Close DB ConnectionWednesday, May 18, 2011
  125. 125. Connection Manager Open DB Connection When ERb is evaluated, db connection does not exist Delegate Close DB Connection Return Delegate ValuesWednesday, May 18, 2011
  126. 126. Problem?Wednesday, May 18, 2011
  127. 127. Problem?Wednesday, May 18, 2011
  128. 128. Body#closeWednesday, May 18, 2011
  129. 129. Body Proxy class ConnectionBodyProxy def initialize(delegate) @delegate = delegate end def each(&blk) @delegate.each(&blk) end def close # CLOSE CONNECTION end endWednesday, May 18, 2011
  130. 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 endWednesday, May 18, 2011
  131. 131. Wednesday, May 18, 2011
  132. 132. Wednesday, May 18, 2011
  133. 133. Wednesday, May 18, 2011
  134. 134. ~25 middlewareWednesday, May 18, 2011
  135. 135. Embrace DiversityWednesday, May 18, 2011
  136. 136. Types of Middleware Generators (our application) Filters (gzip, etc) Lifecycle Handlers (connection management)Wednesday, May 18, 2011
  137. 137. Real Talk!Wednesday, May 18, 2011
  138. 138. Rails is getting slowerWednesday, May 18, 2011
  139. 139. Time for N Requests Rails 2.3 Rails 3.0 100 10 1 0.1 0.01 10 100 1000 10000 RequestsWednesday, May 18, 2011
  140. 140. Avg Requests / time Rails 2.3 Rails 3.0 500 387.5 275 162.5 50 10 100 1000 10000 RequestsWednesday, May 18, 2011
  141. 141. Middleware IncreasedWednesday, May 18, 2011
  142. 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 375Wednesday, May 18, 2011 ActionDispatch
  143. 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. 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#callWednesday, May 18, 2011 0 (0.0%) 80 0 (0.0%) 60
  145. 145. GC PressureWednesday, May 18, 2011
  146. 146. Stack Depth Rails 2.3 Rails 3.0 Rails 3.1 70 52.5 35 17.5 0 Stack DepthWednesday, May 18, 2011
  147. 147. Rails 2.3 StackWednesday, May 18, 2011
  148. 148. 51 deepWednesday, May 18, 2011
  149. 149. Rails 3.0 StackWednesday, May 18, 2011
  150. 150. 60 deepWednesday, May 18, 2011
  151. 151. Rails 3.1 StackWednesday, May 18, 2011
  152. 152. 67 deepWednesday, May 18, 2011
  153. 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:43Wednesday, May 18, 2011
  154. 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:43Wednesday, May 18, 2011
  155. 155. Embrace DiversityWednesday, May 18, 2011
  156. 156. We need a changeWednesday, May 18, 2011
  157. 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 endWednesday, May 18, 2011
  158. 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 endWednesday, May 18, 2011
  159. 159. Lifecycle Hooks class Handler def before(request) # Connect to database end def after(request) # Disconnect end endWednesday, May 18, 2011
  160. 160. Stack Depth Rails 2.3 Rails 3.0 Rails 3.1 Rails 3.2? 70 52.5 35 17.5 0 Stack DepthWednesday, May 18, 2011
  161. 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 RequestsWednesday, May 18, 2011
  162. 162. Avg Requests / time Rails 2.3 Rails 3.0 Rails 3.2? 650 500 350 200 50 10 100 1000 10000 RequestsWednesday, May 18, 2011
  163. 163. git log --until="1 year from now"Wednesday, May 18, 2011
  164. 164. Important things to me We Must ChangeWednesday, May 18, 2011
  165. 165. SpeedWednesday, May 18, 2011
  166. 166. MemoryWednesday, May 18, 2011
  167. 167. Stack DepthWednesday, May 18, 2011
  168. 168. Backwards CompatWednesday, May 18, 2011
  169. 169. Development Pro Tip™Wednesday, May 18, 2011
  170. 170. Wednesday, May 18, 2011
  171. 171. Final WordsWednesday, May 18, 2011
  172. 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. 173. Not all features are TangibleWednesday, May 18, 2011
  174. 174. Good Abstraction yield Reusable CodeWednesday, May 18, 2011
  175. 175. Reusable Code yield New FeaturesWednesday, May 18, 2011
  176. 176. Your Homework:Wednesday, May 18, 2011
  177. 177. GO GREEN!Wednesday, May 18, 2011
  178. 178. Refactor Rails!Wednesday, May 18, 2011
  179. 179. GO FORTH AND CODE!Wednesday, May 18, 2011
  180. 180. THANKS!Wednesday, May 18, 2011
  181. 181. QUESTIONS?Wednesday, May 18, 2011
  1. A particular slide catching your eye?

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

×