181
Before I Begin... Wednesday, May 18, 2011

RailsConf 2011 Keynote

Embed Size (px)

DESCRIPTION

this is my keynote for railsconf.

Citation preview

Page 1: RailsConf 2011 Keynote

Before I Begin...

Wednesday, May 18, 2011

Page 2: RailsConf 2011 Keynote

@jonleighton

♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥

♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥Wednesday, May 18, 2011

Page 3: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 4: RailsConf 2011 Keynote

♥Wednesday, May 18, 2011

Page 5: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 6: RailsConf 2011 Keynote

I ♥ José

Wednesday, May 18, 2011

Page 7: RailsConf 2011 Keynote

Double Dream Hands:SO INTENSE

Wednesday, May 18, 2011

Page 8: RailsConf 2011 Keynote

ZOMG!!!Wednesday, May 18, 2011

Page 9: RailsConf 2011 Keynote

HAPPYWednesday, May 18, 2011

Page 10: RailsConf 2011 Keynote

RAILSWednesday, May 18, 2011

Page 11: RailsConf 2011 Keynote

CONFWednesday, May 18, 2011

Page 12: RailsConf 2011 Keynote

♥ ♥ ♥ ♥Wednesday, May 18, 2011

Page 13: RailsConf 2011 Keynote

Aaron Patterson

Wednesday, May 18, 2011

Page 14: RailsConf 2011 Keynote

@tenderlove

Wednesday, May 18, 2011

Page 15: RailsConf 2011 Keynote

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

Page 16: RailsConf 2011 Keynote

WWFMD?Wednesday, May 18, 2011

Page 17: RailsConf 2011 Keynote

Richard GabrielResearcher

Guy SteeleSoftware Architect

DHHPartner

Wednesday, May 18, 2011

Page 18: RailsConf 2011 Keynote

Aaron BatalionCTO

Chad DickersonCTO

Dan MeltonCTO

Wednesday, May 18, 2011

Page 19: RailsConf 2011 Keynote

Corey HainesCorey Haines

Eric RiesVenture Advisor

Aaron PattersonSeñor Software

Engineer

Wednesday, May 18, 2011

Page 20: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 21: RailsConf 2011 Keynote

LOLWUT

Wednesday, May 18, 2011

Page 22: RailsConf 2011 Keynote

Señor Software EngineerWednesday, May 18, 2011

Page 23: RailsConf 2011 Keynote

Señor Software EngineerWednesday, May 18, 2011

Page 24: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 25: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 26: RailsConf 2011 Keynote

Agenda

Wednesday, May 18, 2011

Page 27: RailsConf 2011 Keynote

New Features

Agenda

Development Pro Tips™

Real Talk!

Wednesday, May 18, 2011

Page 28: RailsConf 2011 Keynote

I will be veryTECHNICAL

Implementation and thoughts on API design

Wednesday, May 18, 2011

Page 29: RailsConf 2011 Keynote

I will be veryCRITICAL

Because my audience is smart

Because I care

Wednesday, May 18, 2011

Page 30: RailsConf 2011 Keynote

New Features!

Wednesday, May 18, 2011

Page 31: RailsConf 2011 Keynote

git log --since="1 year ago"

Wednesday, May 18, 2011

Page 32: RailsConf 2011 Keynote

API Strategy

Wednesday, May 18, 2011

Page 33: RailsConf 2011 Keynote

rails generate VC

Wednesday, May 18, 2011

Page 34: RailsConf 2011 Keynote

def halts?(function)

Wednesday, May 18, 2011

Page 35: RailsConf 2011 Keynote

Prepared Statements

Wednesday, May 18, 2011

Page 36: RailsConf 2011 Keynote

select * from 'users' where id = 10

Wednesday, May 18, 2011

Page 37: RailsConf 2011 Keynote

select * from 'users' where id = ?

Wednesday, May 18, 2011

Page 38: RailsConf 2011 Keynote

DATABASE

RAILS APPWednesday, May 18, 2011

Page 39: RailsConf 2011 Keynote

DATABASE

RAILS APP

Records

Wednesday, May 18, 2011

Page 40: RailsConf 2011 Keynote

4 Steps!

Wednesday, May 18, 2011

Page 41: RailsConf 2011 Keynote

DATABASE

RAILS APPWednesday, May 18, 2011

Page 42: RailsConf 2011 Keynote

DATABASE

RAILS APP

Token

Wednesday, May 18, 2011

Page 43: RailsConf 2011 Keynote

DATABASE

RAILS APPWednesday, May 18, 2011

Page 44: RailsConf 2011 Keynote

DATABASE

RAILS APP

Records

Wednesday, May 18, 2011

Page 45: RailsConf 2011 Keynote

4 Steps!

Wednesday, May 18, 2011

Page 46: RailsConf 2011 Keynote

2 Steps!

Wednesday, May 18, 2011

Page 47: RailsConf 2011 Keynote

Impact

Wednesday, May 18, 2011

Page 48: RailsConf 2011 Keynote

SQLite3

Wednesday, May 18, 2011

Page 49: RailsConf 2011 Keynote

0.00

0.00

0.01

0.10

1.00

10.00

100.00

10 100 1000 10000 100000

y = 0.0002e2.187x

y = 8.556E-5e2.2868x

SQLite3 Simple Prepared Statement

Number of QueriesCached Trend 1Non-Cached Trend 2

Wednesday, May 18, 2011

Page 50: RailsConf 2011 Keynote

8665 q/s12987 q/s

Wednesday, May 18, 2011

Page 51: RailsConf 2011 Keynote

Δ 4322 q/s

Wednesday, May 18, 2011

Page 52: RailsConf 2011 Keynote

0

0

0

1

10

100

1000

10 100 1000 10000 100000

y = 0.0029e2.3111xy = 0.0003e2.2227x

SQLite3 Complex SQL Statement

Number of QueriesCached Trend 1Non-Cached Trend 2

Wednesday, May 18, 2011

Page 53: RailsConf 2011 Keynote

339 q/s4184 q/s

Wednesday, May 18, 2011

Page 54: RailsConf 2011 Keynote

Δ 3845 q/s

Wednesday, May 18, 2011

Page 55: RailsConf 2011 Keynote

PostgreSQL

Wednesday, May 18, 2011

Page 56: RailsConf 2011 Keynote

0.0

0.0

0.1

1.0

10.0

100.0

10 100 1000 10000 100000

y = 0.0004e2.1424xy = 0.0002e2.3018x

PostgreSQL Simple Query

QueriesCached Trend 1No Cache Trend 2

Wednesday, May 18, 2011

Page 57: RailsConf 2011 Keynote

4662 q/s5586 q/s

Wednesday, May 18, 2011

Page 58: RailsConf 2011 Keynote

Δ 924 q/s

Wednesday, May 18, 2011

Page 59: RailsConf 2011 Keynote

0

0

0

1

10

100

1000

10 100 1000 10000 100000

y = 0.0047e2.2153x

y = 0.0005e2.173x

PostgreSQL Complex Query

QueriesCached Trend 1No Cache Trend 2

Wednesday, May 18, 2011

Page 60: RailsConf 2011 Keynote

307 q/s3322 q/s

Wednesday, May 18, 2011

Page 61: RailsConf 2011 Keynote

Δ 3015 q/s

Wednesday, May 18, 2011

Page 62: RailsConf 2011 Keynote

MySQL

Wednesday, May 18, 2011

Page 63: RailsConf 2011 Keynote

0

0

0

1

10

100

10 100 1000 10000 100000

MySQL Simple Query

QueriesCache No Cache

Wednesday, May 18, 2011

Page 64: RailsConf 2011 Keynote

6410 q/s5154 q/s

Wednesday, May 18, 2011

Page 65: RailsConf 2011 Keynote

Δ -1256 q/s

Wednesday, May 18, 2011

Page 66: RailsConf 2011 Keynote

0

0

0

1

10

100

1000

10 100 1000 10000 100000

MySQL Complex SQL Query

Category TitleCachedNo Cache

Wednesday, May 18, 2011

Page 67: RailsConf 2011 Keynote

626 q/s1198 q/s

Wednesday, May 18, 2011

Page 68: RailsConf 2011 Keynote

Δ 572 q/s

Wednesday, May 18, 2011

Page 69: RailsConf 2011 Keynote

No Query Planning

Wednesday, May 18, 2011

Page 70: RailsConf 2011 Keynote

Two Network Roundtrips

Wednesday, May 18, 2011

Page 71: RailsConf 2011 Keynote

Problem?Wednesday, May 18, 2011

Page 72: RailsConf 2011 Keynote

Problem?Wednesday, May 18, 2011

Page 73: RailsConf 2011 Keynote

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

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

select updated_at from pirates

Wednesday, May 18, 2011

Page 74: RailsConf 2011 Keynote

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

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

select updated_at from pirates

Prepared Statement

Wednesday, May 18, 2011

Page 75: RailsConf 2011 Keynote

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

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

select updated_at from pirates

Regular Statement

Wednesday, May 18, 2011

Page 76: RailsConf 2011 Keynote

API Changes

Wednesday, May 18, 2011

Page 77: RailsConf 2011 Keynote

User.find 1

Wednesday, May 18, 2011

Page 78: RailsConf 2011 Keynote

User.find 1

Wednesday, May 18, 2011

Page 79: RailsConf 2011 Keynote

SerializedAttributes

Wednesday, May 18, 2011

Page 80: RailsConf 2011 Keynote

class User < ActiveRecord::Base serialize :preferencesend

Wednesday, May 18, 2011

Page 81: RailsConf 2011 Keynote

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

Saves as YAML

Wednesday, May 18, 2011

Page 82: RailsConf 2011 Keynote

Why YAML?

Wednesday, May 18, 2011

Page 83: RailsConf 2011 Keynote

class User < ActiveRecord::Base serialize :preferences, Base64Encoder.newend

Wednesday, May 18, 2011

Page 84: RailsConf 2011 Keynote

class Base64Encoder def load(value) return unless value value.unpack('m').last end

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

Base 64 Storage

Wednesday, May 18, 2011

Page 85: RailsConf 2011 Keynote

class JSONEncoder def load(value) return unless value JSON.load value end

def dump(text) JSON.dump(text) endend

JSON Storage

Wednesday, May 18, 2011

Page 86: RailsConf 2011 Keynote

class MarshalEncoder def load(value) return unless value Marshal.load value end

def dump(text) Marshal.dump(text) endend

Marshal Storage

Wednesday, May 18, 2011

Page 87: RailsConf 2011 Keynote

class XMLEncoder def load(value) return unless value Nokogiri.XML value end

def dump(doc) doc.to_xml endend

XML Storage

Wednesday, May 18, 2011

Page 88: RailsConf 2011 Keynote

Official NoSQL Support

Wednesday, May 18, 2011

Page 89: RailsConf 2011 Keynote

Official NoSQL Support

IT'SOFFICIAL!

Wednesday, May 18, 2011

Page 90: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 91: RailsConf 2011 Keynote

2 Caveats

Wednesday, May 18, 2011

Page 92: RailsConf 2011 Keynote

PostgreSQL Only

Wednesday, May 18, 2011

Page 93: RailsConf 2011 Keynote

You might hurt yourself

Wednesday, May 18, 2011

Page 94: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 95: RailsConf 2011 Keynote

DO NOT DO THISclass 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.newend

Wednesday, May 18, 2011

Page 96: RailsConf 2011 Keynote

class BCryptCoder def load(value) return unless value BCrypt::Password.new value end

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

BCrypt Coder

Wednesday, May 18, 2011

Page 97: RailsConf 2011 Keynote

BCrypt Serialization

class User < ActiveRecord::Base serialize :crazy_column, BCryptCoder.newend

Wednesday, May 18, 2011

Page 98: RailsConf 2011 Keynote

Dumping Loading

YAML dump load

JSON dump load

Marshal dump load

stdlib serialization API

Wednesday, May 18, 2011

Page 99: RailsConf 2011 Keynote

YOU choose

Storage type

Column name

Wednesday, May 18, 2011

Page 100: RailsConf 2011 Keynote

Good Abstractionsyield

Good Features

Wednesday, May 18, 2011

Page 101: RailsConf 2011 Keynote

CONSISTENCYis FREEDOM

and FLEXIBILITY

Wednesday, May 18, 2011

Page 102: RailsConf 2011 Keynote

has_secure_password

Wednesday, May 18, 2011

Page 103: RailsConf 2011 Keynote

class User < ActiveRecord::Base has_secure_passwordend

SECURITY!

Wednesday, May 18, 2011

Page 104: RailsConf 2011 Keynote

SECURITY!

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

Wednesday, May 18, 2011

Page 105: RailsConf 2011 Keynote

♥ Introduces a new method

♥ Saves password in `password_digest`

♥ Uses BCrypt

Advantages

Wednesday, May 18, 2011

Page 106: RailsConf 2011 Keynote

♥ Introduces a new method

♥ Saves password in `password_digest`

♥ Uses BCrypt

DisadvantagesAPI is not flexible

Not reusable

Wednesday, May 18, 2011

Page 107: RailsConf 2011 Keynote

GO GREEN!

Wednesday, May 18, 2011

Page 108: RailsConf 2011 Keynote

Write SomethingREUSABLE!

Wednesday, May 18, 2011

Page 109: RailsConf 2011 Keynote

StreamingResponses

response streaming

chunked encoding

Wednesday, May 18, 2011

Page 110: RailsConf 2011 Keynote

Rack API

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

Wednesday, May 18, 2011

Page 111: RailsConf 2011 Keynote

Rails 3.0.x

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

[200, {}, body] endend

Wednesday, May 18, 2011

Page 112: RailsConf 2011 Keynote

DelayedEvaluation

Wednesday, May 18, 2011

Page 113: RailsConf 2011 Keynote

Body#each

Wednesday, May 18, 2011

Page 114: RailsConf 2011 Keynote

Rails 3.1.xclass DelayedBody def each yield render(:layout) yield render(:content) endend

class PoniesController def call(env) [200, {}, DelayedBody.new] endend

Wednesday, May 18, 2011

Page 115: RailsConf 2011 Keynote

Middleware

Wednesday, May 18, 2011

Page 116: RailsConf 2011 Keynote

Middleware☹Wednesday, May 18, 2011

Page 117: RailsConf 2011 Keynote

Request Timer

Middleware Chain

Connection Manager

Application

Just consider connection manager and application

Wednesday, May 18, 2011

Page 118: RailsConf 2011 Keynote

Middleware Chain

Connection Manager

Application

Wednesday, May 18, 2011

Page 119: RailsConf 2011 Keynote

Middleware Chain

Connection Manager

Application

call(env)

call(env)

Wednesday, May 18, 2011

Page 120: RailsConf 2011 Keynote

Middleware Chain

Connection Manager

Application

[200, {}, body]

[200, {}, body]

Wednesday, May 18, 2011

Page 121: RailsConf 2011 Keynote

Connection Manager

When ERb is evaluated,db connection does notexist

Wednesday, May 18, 2011

Page 122: RailsConf 2011 Keynote

Connection Manager

Open DB Connection When ERb is evaluated,db connection does notexist

Wednesday, May 18, 2011

Page 123: RailsConf 2011 Keynote

Connection Manager

Open DB Connection

Delegate

When ERb is evaluated,db connection does notexist

Wednesday, May 18, 2011

Page 124: RailsConf 2011 Keynote

Connection Manager

Open DB Connection

Delegate

Close DB Connection

When ERb is evaluated,db connection does notexist

Wednesday, May 18, 2011

Page 125: RailsConf 2011 Keynote

Connection Manager

Open DB Connection

Delegate

Close DB Connection

Return Delegate Values

When ERb is evaluated,db connection does notexist

Wednesday, May 18, 2011

Page 126: RailsConf 2011 Keynote

Problem?Wednesday, May 18, 2011

Page 127: RailsConf 2011 Keynote

Problem?Wednesday, May 18, 2011

Page 128: RailsConf 2011 Keynote

Body#close

Wednesday, May 18, 2011

Page 129: RailsConf 2011 Keynote

Body Proxy

class ConnectionBodyProxy def initialize(delegate) @delegate = delegate end def each(&blk) @delegate.each(&blk) end def close # CLOSE CONNECTION endend

Wednesday, May 18, 2011

Page 130: RailsConf 2011 Keynote

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 endend

Wednesday, May 18, 2011

Page 131: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 132: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 133: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 134: RailsConf 2011 Keynote

~25 middleware

Wednesday, May 18, 2011

Page 135: RailsConf 2011 Keynote

Embrace Diversity

Wednesday, May 18, 2011

Page 136: RailsConf 2011 Keynote

Types of Middleware

♥ Generators (our application)

♥ Filters (gzip, etc)

♥ Lifecycle Handlers (connection management)

Wednesday, May 18, 2011

Page 137: RailsConf 2011 Keynote

Real Talk!

Wednesday, May 18, 2011

Page 138: RailsConf 2011 Keynote

Rails is getting slower

Wednesday, May 18, 2011

Page 139: RailsConf 2011 Keynote

Time for N Requests

0.01

0.1

1

10

100

10 100 1000 10000

Requests

Rails 2.3 Rails 3.0

Wednesday, May 18, 2011

Page 140: RailsConf 2011 Keynote

Avg Requests / time

50

162.5

275

387.5

500

10 100 1000 10000

Requests

Rails 2.3 Rails 3.0

Wednesday, May 18, 2011

Page 141: RailsConf 2011 Keynote

MiddlewareIncreased

Wednesday, May 18, 2011

Page 142: RailsConf 2011 Keynote

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/rubyTotal samples: 740Focusing on: 740Dropped nodes with <= 3 abs(samples)Dropped edges with <= 0 samples

RackRuntime#call

0 (0.0%)of 463 (62.6%)

RailsRack

Logger#call0 (0.0%)

of 463 (62.6%)

463

ActionDispatchShowExceptions#call

0 (0.0%)of 381 (51.5%)

381

RailsRack

Logger#after_dispatch0 (0.0%)

of 80 (10.8%)

80

#<Class:0x102625d88>#call0 (0.0%)

of 462 (62.4%)

462

Mutex#synchronize1 (0.1%)

of 462 (62.4%)

RackLock#call

0 (0.0%)of 462 (62.4%)

462

ActiveSupportBufferedLogger#flush

77 (10.4%)of 78 (10.5%)

77

462

462

RailsApplication#call

0 (0.0%)of 462 (62.4%)

462

Integer#times0 (0.0%)

of 461 (62.3%)

461

ActionDispatchCallbacks#call

2 (0.3%)of 383 (51.8%)

ActionDispatchCallbacks#_run_call_callbacks

0 (0.0%)of 381 (51.5%)

381

ActiveRecordConnectionAdapters

ConnectionManagement#call0 (0.0%)

of 381 (51.5%)

381

RackSendfile#call

0 (0.0%)of 383 (51.8%)

383

ActionDispatchRemoteIp#call

0 (0.0%)of 382 (51.6%)

382

381

381

ActiveRecordQueryCache#call

2 (0.3%)of 377 (50.9%)

375

Class#cache0 (0.0%)

of 376 (50.8%)

375

ActionDispatchCookies#call

4 (0.5%)of 372 (50.3%)

372

Object#cache0 (0.0%)

of 373 (50.4%)

373

373

ActionDispatchSession

AbstractStore#call1 (0.1%)

of 367 (49.6%)

367

ActionDispatchFlash#call

0 (0.0%)of 365 (49.3%)

365

ActionDispatchParamsParser#call

0 (0.0%)of 360 (48.6%)

360

ActionDispatchHead#call

1 (0.1%)of 360 (48.6%)

ActionDispatchBestStandardsSupport#call

2 (0.3%)of 359 (48.5%)

359

RackMethodOverride#call

0 (0.0%)of 360 (48.6%)

360

360

ActionDispatchRouting

RouteSet#call0 (0.0%)

of 357 (48.2%)

357

RackMount

RouteSet#call0 (0.0%)

of 357 (48.2%)

357

RackMount

RouteSet#recognize1 (0.1%)

of 357 (48.2%)

357

ActionDispatchRoutingRouteSet

Dispatcher#call0 (0.0%)

of 355 (48.0%)

355 355

Array#optimized_each1 (0.1%)

of 356 (48.1%)

356 355

ActionDispatchRoutingRouteSet

Dispatcher#dispatch1 (0.1%)

of 355 (48.0%)

355

PostsController.action3 (0.4%)

of 354 (47.8%)

354

ActionControllerMetal#dispatch

0 (0.0%)of 350 (47.3%)

350

346

ActionControllerMetal#process

0 (0.0%)of 339 (45.8%)

339

AbstractControllerBase#process

0 (0.0%)of 338 (45.7%)

338

ActionControllerMetal#process_action

3 (0.4%)of 337 (45.5%)

337

956

ActiveSupportNotifications.instrument

0 (0.0%)of 322 (43.5%)

322

ActionControllerMetal#run_callbacks

1 (0.1%)of 311 (42.0%)

311

AbstractControllerBase#process_action

0 (0.0%)of 305 (41.2%)

305

Symbol#to_proc4 (0.5%)

of 82 (11.1%)

2

312

ActiveSupportNotifications

Instrumenter#instrument0 (0.0%)

of 322 (43.5%)

507

Object#_render_template2 (0.3%)

of 189 (25.5%)

175

ActionViewTemplate#render

2 (0.3%)of 167 (22.6%)

167

487

ApplicationController#_run_process_action_callbacks0 (0.0%)

of 310 (41.9%)

310

PostsController#_run__84203013__process_action__199225275__callbacks0 (0.0%)

of 310 (41.9%)

310

307

ActionControllerMetal#send_action

0 (0.0%)of 305 (41.2%)

305

Object#send_action0 (0.0%)

of 305 (41.2%)

305

PostsController#index2 (0.3%)

of 305 (41.2%)

305

ActionControllerMetal#respond_to

0 (0.0%)of 239 (32.3%)

239

Post.all0 (0.0%)

of 66 (8.9%)

66

ActionControllerMetal#retrieve_response_from_mimes

5 (0.7%)of 239 (32.3%)

239

2

ActionControllerMetal#default_render

0 (0.0%)of 231 (31.2%)

231

ActionControllerMetal#render

1 (0.1%)of 231 (31.2%)

231

438

ActionControllerMetal#cleanup_view_runtime

0 (0.0%)of 230 (31.1%)

230

Benchmark.ms10 (1.4%)

of 230 (31.1%)

230

ActionControllerMetal#render_to_string

0 (0.0%)of 219 (29.6%)

219230

230

219

Benchmark.realtime0 (0.0%)

of 220 (29.7%)

220219

ActionControllerMetal#render_to_body

2 (0.3%)of 213 (28.8%)

213

424

ActionControllerMetal#_render_template

0 (0.0%)of 210 (28.4%)

210

Object#render0 (0.0%)

of 190 (25.7%)

190

189185

18

Object#_render_layout6 (0.8%)

of 155 (20.9%)

155

167

Object#_app_views_layouts_application_html_erb___604422253_2164033400_00 (0.0%)

of 148 (20.0%)

148

149

1

Object#stylesheet_link_tag0 (0.0%)

of 85 (11.5%)

85

Object#javascript_include_tag3 (0.4%)

of 58 (7.8%)

58

garbage_collector146 (19.7%)

Object#require27 (3.6%)

of 128 (17.3%)165

Kernel#require28 (3.8%)

of 63 (8.5%)

118

Rails30Application.method_missing

0 (0.0%)of 62 (8.4%)

62

Object#expand_stylesheet_sources0 (0.0%)

of 83 (11.2%)

83

Object#collect_asset_files81 (10.9%)

81

78

ActiveSupportLogSubscriber.flush_all!

0 (0.0%)of 80 (10.8%)

80

80

78

Object#all0 (0.0%)

of 62 (8.4%)

62

74

60

ActiveRecordRelation#to_a

1 (0.1%)of 62 (8.4%)

Post.find_by_sql0 (0.0%)

of 57 (7.7%)

57

62

Object#run_initializers0 (0.0%)

of 62 (8.4%)60

RailsInitializable

Initializer#run0 (0.0%)

of 60 (8.1%)

60

RailsApplication#initialize!

0 (0.0%)of 62 (8.4%)

62

62

Object#instance_exec2 (0.3%)

of 60 (8.1%)

17

60

Object#map0 (0.0%)

of 57 (7.7%)

ActiveRecordConnectionAdapters

SQLiteAdapter#execute1 (0.1%)

of 56 (7.6%)

Wednesday, May 18, 2011

Page 143: RailsConf 2011 Keynote

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/rubyTotal samples: 740Focusing on: 740Dropped nodes with <= 3 abs(samples)Dropped edges with <= 0 samples

RackRuntime#call

0 (0.0%)of 463 (62.6%)

RailsRack

Logger#call0 (0.0%)

of 463 (62.6%)

463

ActionDispatchShowExceptions#call

0 (0.0%)of 381 (51.5%)

381

RailsRack

Logger#after_dispatch0 (0.0%)

of 80 (10.8%)

80

#<Class:0x102625d88>#call0 (0.0%)

of 462 (62.4%)

462

Mutex#synchronize1 (0.1%)

of 462 (62.4%)

RackLock#call

0 (0.0%)of 462 (62.4%)

462

ActiveSupportBufferedLogger#flush

77 (10.4%)of 78 (10.5%)

77

462

462

RailsApplication#call

0 (0.0%)of 462 (62.4%)

462

Integer#times0 (0.0%)

of 461 (62.3%)

461

ActionDispatchCallbacks#call

2 (0.3%)of 383 (51.8%)

ActionDispatchCallbacks#_run_call_callbacks

0 (0.0%)of 381 (51.5%)

381

ActiveRecordConnectionAdapters

ConnectionManagement#call0 (0.0%)

of 381 (51.5%)

381

RackSendfile#call

0 (0.0%)of 383 (51.8%)

383

ActionDispatchRemoteIp#call

0 (0.0%)of 382 (51.6%)

382

381

381

ActiveRecordQueryCache#call

2 (0.3%)of 377 (50.9%)

375

Class#cache0 (0.0%)

of 376 (50.8%)

375

ActionDispatchCookies#call

4 (0.5%)of 372 (50.3%)

372

Object#cache0 (0.0%)

of 373 (50.4%)

373

373

ActionDispatchSession

AbstractStore#call1 (0.1%)

of 367 (49.6%)

367

ActionDispatchFlash#call

0 (0.0%)of 365 (49.3%)

365

ActionDispatchParamsParser#call

0 (0.0%)of 360 (48.6%)

360

ActionDispatchHead#call

1 (0.1%)of 360 (48.6%)

ActionDispatchBestStandardsSupport#call

2 (0.3%)of 359 (48.5%)

359

RackMethodOverride#call

0 (0.0%)of 360 (48.6%)

360

360

ActionDispatchRouting

RouteSet#call0 (0.0%)

of 357 (48.2%)

357

RackMount

RouteSet#call0 (0.0%)

of 357 (48.2%)

357

RackMount

RouteSet#recognize1 (0.1%)

of 357 (48.2%)

357

ActionDispatchRoutingRouteSet

Dispatcher#call0 (0.0%)

of 355 (48.0%)

355 355

Array#optimized_each1 (0.1%)

of 356 (48.1%)

356 355

ActionDispatchRoutingRouteSet

Dispatcher#dispatch1 (0.1%)

of 355 (48.0%)

355

PostsController.action3 (0.4%)

of 354 (47.8%)

354

ActionControllerMetal#dispatch

0 (0.0%)of 350 (47.3%)

350

346

ActionControllerMetal#process

0 (0.0%)of 339 (45.8%)

339

AbstractControllerBase#process

0 (0.0%)of 338 (45.7%)

338

ActionControllerMetal#process_action

3 (0.4%)of 337 (45.5%)

337

956

ActiveSupportNotifications.instrument

0 (0.0%)of 322 (43.5%)

322

ActionControllerMetal#run_callbacks

1 (0.1%)of 311 (42.0%)

311

AbstractControllerBase#process_action

0 (0.0%)of 305 (41.2%)

305

Symbol#to_proc4 (0.5%)

of 82 (11.1%)

2

312

ActiveSupportNotifications

Instrumenter#instrument0 (0.0%)

of 322 (43.5%)

507

Object#_render_template2 (0.3%)

of 189 (25.5%)

175

ActionViewTemplate#render

2 (0.3%)of 167 (22.6%)

167

487

ApplicationController#_run_process_action_callbacks0 (0.0%)

of 310 (41.9%)

310

PostsController#_run__84203013__process_action__199225275__callbacks0 (0.0%)

of 310 (41.9%)

310

307

ActionControllerMetal#send_action

0 (0.0%)of 305 (41.2%)

305

Object#send_action0 (0.0%)

of 305 (41.2%)

305

PostsController#index2 (0.3%)

of 305 (41.2%)

305

ActionControllerMetal#respond_to

0 (0.0%)of 239 (32.3%)

239

Post.all0 (0.0%)

of 66 (8.9%)

66

ActionControllerMetal#retrieve_response_from_mimes

5 (0.7%)of 239 (32.3%)

239

2

ActionControllerMetal#default_render

0 (0.0%)of 231 (31.2%)

231

ActionControllerMetal#render

1 (0.1%)of 231 (31.2%)

231

438

ActionControllerMetal#cleanup_view_runtime

0 (0.0%)of 230 (31.1%)

230

Benchmark.ms10 (1.4%)

of 230 (31.1%)

230

ActionControllerMetal#render_to_string

0 (0.0%)of 219 (29.6%)

219230

230

219

Benchmark.realtime0 (0.0%)

of 220 (29.7%)

220219

ActionControllerMetal#render_to_body

2 (0.3%)of 213 (28.8%)

213

424

ActionControllerMetal#_render_template

0 (0.0%)of 210 (28.4%)

210

Object#render0 (0.0%)

of 190 (25.7%)

190

189185

18

Object#_render_layout6 (0.8%)

of 155 (20.9%)

155

167

Object#_app_views_layouts_application_html_erb___604422253_2164033400_00 (0.0%)

of 148 (20.0%)

148

149

1

Object#stylesheet_link_tag0 (0.0%)

of 85 (11.5%)

85

Object#javascript_include_tag3 (0.4%)

of 58 (7.8%)

58

garbage_collector146 (19.7%)

Object#require27 (3.6%)

of 128 (17.3%)165

Kernel#require28 (3.8%)

of 63 (8.5%)

118

Rails30Application.method_missing

0 (0.0%)of 62 (8.4%)

62

Object#expand_stylesheet_sources0 (0.0%)

of 83 (11.2%)

83

Object#collect_asset_files81 (10.9%)

81

78

ActiveSupportLogSubscriber.flush_all!

0 (0.0%)of 80 (10.8%)

80

80

78

Object#all0 (0.0%)

of 62 (8.4%)

62

74

60

ActiveRecordRelation#to_a

1 (0.1%)of 62 (8.4%)

Post.find_by_sql0 (0.0%)

of 57 (7.7%)

57

62

Object#run_initializers0 (0.0%)

of 62 (8.4%)60

RailsInitializable

Initializer#run0 (0.0%)

of 60 (8.1%)

60

RailsApplication#initialize!

0 (0.0%)of 62 (8.4%)

62

62

Object#instance_exec2 (0.3%)

of 60 (8.1%)

17

60

Object#map0 (0.0%)

of 57 (7.7%)

ActiveRecordConnectionAdapters

SQLiteAdapter#execute1 (0.1%)

of 56 (7.6%)

Wednesday, May 18, 2011

Page 144: RailsConf 2011 Keynote

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/rubyTotal samples: 740Focusing on: 740Dropped nodes with <= 3 abs(samples)Dropped edges with <= 0 samples

RackRuntime#call

0 (0.0%)of 463 (62.6%)

RailsRack

Logger#call0 (0.0%)

of 463 (62.6%)

463

ActionDispatchShowExceptions#call

0 (0.0%)of 381 (51.5%)

381

RailsRack

Logger#after_dispatch0 (0.0%)

of 80 (10.8%)

80

#<Class:0x102625d88>#call0 (0.0%)

of 462 (62.4%)

462

Mutex#synchronize1 (0.1%)

of 462 (62.4%)

RackLock#call

0 (0.0%)of 462 (62.4%)

462

ActiveSupportBufferedLogger#flush

77 (10.4%)of 78 (10.5%)

77

462

462

RailsApplication#call

0 (0.0%)of 462 (62.4%)

462

Integer#times0 (0.0%)

of 461 (62.3%)

461

ActionDispatchCallbacks#call

2 (0.3%)of 383 (51.8%)

ActionDispatchCallbacks#_run_call_callbacks

0 (0.0%)of 381 (51.5%)

381

ActiveRecordConnectionAdapters

ConnectionManagement#call0 (0.0%)

of 381 (51.5%)

381

RackSendfile#call

0 (0.0%)of 383 (51.8%)

383

ActionDispatchRemoteIp#call

0 (0.0%)of 382 (51.6%)

382

381

381

ActiveRecordQueryCache#call

2 (0.3%)of 377 (50.9%)

375

Class#cache0 (0.0%)

of 376 (50.8%)

375

ActionDispatchCookies#call

4 (0.5%)of 372 (50.3%)

372

Object#cache0 (0.0%)

of 373 (50.4%)

373

373

ActionDispatchSession

AbstractStore#call1 (0.1%)

of 367 (49.6%)

367

ActionDispatchFlash#call

0 (0.0%)of 365 (49.3%)

365

ActionDispatchParamsParser#call

0 (0.0%)of 360 (48.6%)

360

ActionDispatchHead#call

1 (0.1%)of 360 (48.6%)

ActionDispatchBestStandardsSupport#call

2 (0.3%)of 359 (48.5%)

359

RackMethodOverride#call

0 (0.0%)of 360 (48.6%)

360

360

ActionDispatchRouting

RouteSet#call0 (0.0%)

of 357 (48.2%)

357

RackMount

RouteSet#call0 (0.0%)

of 357 (48.2%)

357

RackMount

RouteSet#recognize1 (0.1%)

of 357 (48.2%)

357

ActionDispatchRouting

RouteSetDispatcher#call

0 (0.0%)of 355 (48.0%)

355 355

Array#optimized_each1 (0.1%)

of 356 (48.1%)

356 355

ActionDispatchRoutingRouteSet

Dispatcher#dispatch1 (0.1%)

of 355 (48.0%)

355

PostsController.action3 (0.4%)

of 354 (47.8%)

354

ActionControllerMetal#dispatch

0 (0.0%)of 350 (47.3%)

350

346

ActionControllerMetal#process

0 (0.0%)of 339 (45.8%)

339

AbstractControllerBase#process

0 (0.0%)of 338 (45.7%)

338

ActionControllerMetal#process_action

3 (0.4%)of 337 (45.5%)

337

956

ActiveSupportNotifications.instrument

0 (0.0%)of 322 (43.5%)

322

ActionControllerMetal#run_callbacks

1 (0.1%)of 311 (42.0%)

311

AbstractControllerBase#process_action

0 (0.0%)of 305 (41.2%)

305

Symbol#to_proc4 (0.5%)

of 82 (11.1%)

2

312

ActiveSupportNotifications

Instrumenter#instrument0 (0.0%)

of 322 (43.5%)

507

Object#_render_template2 (0.3%)

of 189 (25.5%)

175

ActionViewTemplate#render

2 (0.3%)of 167 (22.6%)

167

487

ApplicationController#_run_process_action_callbacks0 (0.0%)

of 310 (41.9%)

310

PostsController#_run__84203013__process_action__199225275__callbacks0 (0.0%)

of 310 (41.9%)

310

307

ActionControllerMetal#send_action

0 (0.0%)of 305 (41.2%)

305

Object#send_action0 (0.0%)

of 305 (41.2%)

305

PostsController#index2 (0.3%)

of 305 (41.2%)

305

ActionControllerMetal#respond_to

0 (0.0%)of 239 (32.3%)

239

Post.all0 (0.0%)

of 66 (8.9%)

66

ActionControllerMetal#retrieve_response_from_mimes

5 (0.7%)of 239 (32.3%)

239

2

ActionControllerMetal#default_render

0 (0.0%)of 231 (31.2%)

231

ActionControllerMetal#render

1 (0.1%)of 231 (31.2%)

231

438

ActionControllerMetal#cleanup_view_runtime

0 (0.0%)of 230 (31.1%)

230

Benchmark.ms10 (1.4%)

of 230 (31.1%)

230

ActionControllerMetal#render_to_string

0 (0.0%)of 219 (29.6%)

219230

230

219

Benchmark.realtime0 (0.0%)

of 220 (29.7%)

220219

ActionControllerMetal#render_to_body

2 (0.3%)of 213 (28.8%)

213

424

ActionControllerMetal#_render_template

0 (0.0%)of 210 (28.4%)

210

Object#render0 (0.0%)

of 190 (25.7%)

190

189185

18

Object#_render_layout6 (0.8%)

of 155 (20.9%)

155

167

Object#_app_views_layouts_application_html_erb___604422253_2164033400_00 (0.0%)

of 148 (20.0%)

148

149

1

Object#stylesheet_link_tag0 (0.0%)

of 85 (11.5%)

85

Object#javascript_include_tag3 (0.4%)

of 58 (7.8%)

58

garbage_collector146 (19.7%)

Object#require27 (3.6%)

of 128 (17.3%)165

Kernel#require28 (3.8%)

of 63 (8.5%)

118

Rails30Application.method_missing

0 (0.0%)of 62 (8.4%)

62

Object#expand_stylesheet_sources0 (0.0%)

of 83 (11.2%)

83

Object#collect_asset_files81 (10.9%)

81

78

ActiveSupportLogSubscriber.flush_all!

0 (0.0%)of 80 (10.8%)

80

80

78

Object#all0 (0.0%)

of 62 (8.4%)

62

74

60

ActiveRecordRelation#to_a

1 (0.1%)of 62 (8.4%)

Post.find_by_sql0 (0.0%)

of 57 (7.7%)

57

62

Object#run_initializers0 (0.0%)

of 62 (8.4%)60

RailsInitializable

Initializer#run0 (0.0%)

of 60 (8.1%)

60

RailsApplication#initialize!

0 (0.0%)of 62 (8.4%)

62

62

Object#instance_exec2 (0.3%)

of 60 (8.1%)

17

60

Object#map0 (0.0%)

of 57 (7.7%)

ActiveRecordConnectionAdapters

SQLiteAdapter#execute1 (0.1%)

of 56 (7.6%)

Wednesday, May 18, 2011

Page 145: RailsConf 2011 Keynote

GC Pressure

Wednesday, May 18, 2011

Page 146: RailsConf 2011 Keynote

0

17.5

35

52.5

70

Stack Depth

Rails 2.3 Rails 3.0 Rails 3.1

Stack Depth

Wednesday, May 18, 2011

Page 147: RailsConf 2011 Keynote

Rails 2.3 Stack

Wednesday, May 18, 2011

Page 148: RailsConf 2011 Keynote

51 deep

Wednesday, May 18, 2011

Page 149: RailsConf 2011 Keynote

Rails 3.0 Stack

Wednesday, May 18, 2011

Page 150: RailsConf 2011 Keynote

60 deep

Wednesday, May 18, 2011

Page 151: RailsConf 2011 Keynote

Rails 3.1 Stack

Wednesday, May 18, 2011

Page 152: RailsConf 2011 Keynote

67 deep

Wednesday, May 18, 2011

Page 153: RailsConf 2011 Keynote

/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:44fuuu.rb:43:in `times'fuuu.rb:43

Wednesday, May 18, 2011

Page 154: RailsConf 2011 Keynote

/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:44fuuu.rb:43:in `times'fuuu.rb:43

TL;DRWednesday, May 18, 2011

Page 155: RailsConf 2011 Keynote

Embrace Diversity

Wednesday, May 18, 2011

Page 156: RailsConf 2011 Keynote

We need a change

Wednesday, May 18, 2011

Page 157: RailsConf 2011 Keynote

Generators

class Application def call(request, response) response.write(request, "hello", 200, {})

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

response.close endend

Wednesday, May 18, 2011

Page 158: RailsConf 2011 Keynote

Filtersclass 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 endend

Wednesday, May 18, 2011

Page 159: RailsConf 2011 Keynote

Lifecycle Hooks

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

def after(request) # Disconnect endend

Wednesday, May 18, 2011

Page 160: RailsConf 2011 Keynote

0

17.5

35

52.5

70

Stack Depth

Rails 2.3 Rails 3.0 Rails 3.1 Rails 3.2?

Stack Depth

Wednesday, May 18, 2011

Page 161: RailsConf 2011 Keynote

Time for N Requests

0.01

0.1

1

10

100

10 100 1000 10000

Requests

Rails 2.3 Rails 3.0 Rails 3.2?

Wednesday, May 18, 2011

Page 162: RailsConf 2011 Keynote

Avg Requests / time

50

200

350

500

650

10 100 1000 10000

Requests

Rails 2.3 Rails 3.0 Rails 3.2?

Wednesday, May 18, 2011

Page 163: RailsConf 2011 Keynote

git log --until="1 year from now"

Wednesday, May 18, 2011

Page 164: RailsConf 2011 Keynote

We Must Change

Important things to me

Wednesday, May 18, 2011

Page 165: RailsConf 2011 Keynote

Speed

Wednesday, May 18, 2011

Page 166: RailsConf 2011 Keynote

Memory

Wednesday, May 18, 2011

Page 167: RailsConf 2011 Keynote

Stack Depth

Wednesday, May 18, 2011

Page 168: RailsConf 2011 Keynote

Backwards Compat

Wednesday, May 18, 2011

Page 169: RailsConf 2011 Keynote

DevelopmentPro Tip™

Wednesday, May 18, 2011

Page 170: RailsConf 2011 Keynote

Wednesday, May 18, 2011

Page 171: RailsConf 2011 Keynote

Final Words

Wednesday, May 18, 2011

Page 172: RailsConf 2011 Keynote

A Message forRails-Core

We will not be here forever

Rails will outlive us

Encourage refactoring

Stop "yes men"

Wednesday, May 18, 2011

Page 173: RailsConf 2011 Keynote

Not all features are Tangible

Wednesday, May 18, 2011

Page 174: RailsConf 2011 Keynote

Good Abstraction yield

Reusable Code

Wednesday, May 18, 2011

Page 175: RailsConf 2011 Keynote

Reusable Codeyield

New Features

Wednesday, May 18, 2011

Page 176: RailsConf 2011 Keynote

Your Homework:

Wednesday, May 18, 2011

Page 177: RailsConf 2011 Keynote

GO GREEN!

Wednesday, May 18, 2011

Page 178: RailsConf 2011 Keynote

Refactor Rails!

Wednesday, May 18, 2011

Page 179: RailsConf 2011 Keynote

GO FORTH ANDCODE!

Wednesday, May 18, 2011

Page 180: RailsConf 2011 Keynote

♥ THANKS! ♥

Wednesday, May 18, 2011

Page 181: RailsConf 2011 Keynote

QUESTIONS?

Wednesday, May 18, 2011