More Related Content Similar to RailsConf 2011 Keynote (9) More from Aaron Patterson (9) RailsConf 2011 Keynote6. I José
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
35. Prepared
Statements
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
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
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
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
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
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
69. No Query
Planning
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
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
89. IT'S
OFFI
CIAL
Official NoSQL
!
Support
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
99. Storage type
YOU choose
Column name
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
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
117. Middleware Chain
Just consider
connection
Request Timer manager and
application
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
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
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
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
164. Important
things to
me
We Must Change
Wednesday, May 18, 2011
168. Backwards
Compat
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