181

Phusion (an introduction)

Embed Size (px)

Citation preview

Page 1: Phusion (an introduction)
Page 2: Phusion (an introduction)
Page 3: Phusion (an introduction)

Phusian

Page 4: Phusion (an introduction)

Phusian?!

Page 5: Phusion (an introduction)

Phusian

Page 6: Phusion (an introduction)

Phusian

Page 7: Phusion (an introduction)

Phusiona

Page 8: Phusion (an introduction)

An introduction to painless deployment

Page 9: Phusion (an introduction)

Motivation

Page 10: Phusion (an introduction)

A Rails philosophy:convention over

configuration

Page 11: Phusion (an introduction)

Convention over configuration for

deployment?

Page 12: Phusion (an introduction)

Good opportunity for our first product!

Page 13: Phusion (an introduction)

Our version of“Hello World” as an

IT company.

Page 14: Phusion (an introduction)

Phusion PassengerAct 1

“Short intro”

Page 15: Phusion (an introduction)
Page 16: Phusion (an introduction)

Suitable for exotic setups as well

Page 17: Phusion (an introduction)

Initial responses

Page 18: Phusion (an introduction)

Lots of attention!

Page 19: Phusion (an introduction)

Pleasantly surprised!

Page 20: Phusion (an introduction)

Impressed!

Page 21: Phusion (an introduction)

Ugh, FUD

Page 22: Phusion (an introduction)

Acceptance of Rails

Page 23: Phusion (an introduction)

“Rails is less used than PHP”, how come?

Page 24: Phusion (an introduction)

“PHP gets the job done,so why learn Rails?”

Page 25: Phusion (an introduction)

Cause the right tool for the job you must use!

Page 26: Phusion (an introduction)

“Everybody knows PHP”

Page 27: Phusion (an introduction)

No scarcity of PHP devs

Page 28: Phusion (an introduction)

Rails devs on the other hand?

Page 29: Phusion (an introduction)

Rails marketshare needs devs to grow,

Page 30: Phusion (an introduction)

while other devs reluctant to do Rails

Page 31: Phusion (an introduction)

Economic deadlock!

Page 32: Phusion (an introduction)

Most hosts don’t support Rails

Page 33: Phusion (an introduction)

this could lead to“PHP rocks, Rails

sucks”

Page 34: Phusion (an introduction)

Why should I care?

Page 35: Phusion (an introduction)

You’re part of the market as well!

Page 36: Phusion (an introduction)

Phusion Passenger saves the day?

Page 37: Phusion (an introduction)

Well, let’s see...

Page 38: Phusion (an introduction)

Most hosts use Apache

Page 39: Phusion (an introduction)

Ease of use matters!

Page 40: Phusion (an introduction)

Time == Money

Page 41: Phusion (an introduction)

Robustness matters

Page 42: Phusion (an introduction)

Stability matters

Page 43: Phusion (an introduction)

Should perform well

Page 44: Phusion (an introduction)

Everyone can help!

Page 45: Phusion (an introduction)

Commercial support

Page 46: Phusion (an introduction)

The big guys are excited!

Page 47: Phusion (an introduction)

"Apple is excited about Phusion Passenger as a convenient way to deploy Ruby on Rails

applications, complementary to Mongrel and mod_proxy_balancer.

We look forward to working with Phusion to ensure great Mac OS X support going

forward."

Ernest N. Prabhakar, Ph.D.Open Source Product Manager

Apple, Inc.

Page 48: Phusion (an introduction)

Phusion Passenger saves the day?

Page 49: Phusion (an introduction)

Never gonna give up ;-)

Page 50: Phusion (an introduction)

Phusion PassengerAct 2

“New Developments”

Page 51: Phusion (an introduction)

Premature Optimization

Page 52: Phusion (an introduction)

Premature Optimization

Page 53: Phusion (an introduction)

Load balance improvements

Page 54: Phusion (an introduction)

From Round-Robin to Fair

Page 55: Phusion (an introduction)

Round-whah?

Page 56: Phusion (an introduction)

Round-Robin load balancing

Rails Rails Rails

Web server / load balancer

1 ... N

Page 57: Phusion (an introduction)

Round-Robin load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 58: Phusion (an introduction)

Round-Robin load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 59: Phusion (an introduction)

Round-Robin load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 60: Phusion (an introduction)

Round-Robin load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 61: Phusion (an introduction)

Round-Robin load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 62: Phusion (an introduction)

Round-Robin load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 63: Phusion (an introduction)

Round-Robin load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 64: Phusion (an introduction)

What if one request takes a lot of time?

Page 65: Phusion (an introduction)

Queue could get congested!

Page 66: Phusion (an introduction)

Round-Robin problemHTTP request

Rails Rails Rails

Web server / load balancer

Page 67: Phusion (an introduction)

Round-Robin problemHTTP request

Rails Rails Rails

Web server / load balancer

Shouldn’t have had that

burrito!

Page 68: Phusion (an introduction)

Round-Robin problemHTTP request

Rails Rails Rails

Web server / load balancer

Unfair! Boring!Shouldn’t have had that

burrito!

Page 69: Phusion (an introduction)

In this case, every N request is unresponsive

Page 70: Phusion (an introduction)

Solution?

Page 71: Phusion (an introduction)

Forward request to Rails instance with least

requests in its queue

Page 72: Phusion (an introduction)

Fair load balancing!

Page 73: Phusion (an introduction)

Fair load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 74: Phusion (an introduction)

Fair load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 75: Phusion (an introduction)

Fair load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 76: Phusion (an introduction)

Fair load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 77: Phusion (an introduction)

Fair load balancingHTTP request

Rails Rails Rails

Web server / load balancer

1 ... N

Page 78: Phusion (an introduction)

Upload acceleration

Page 79: Phusion (an introduction)

File uploads in Phusion Passenger 1.0.x

Web server

Rails

Page 80: Phusion (an introduction)

File uploads in Phusion Passenger 1.0.x

Large file upload

Web server

Rails

Large file

Page 81: Phusion (an introduction)

Long file uploads block Rails processes...

Page 82: Phusion (an introduction)

Solution?

Page 83: Phusion (an introduction)

Upload buffering!

Page 84: Phusion (an introduction)

File uploads in Phusion Passenger 2.0.x

Rails

Web server

Page 85: Phusion (an introduction)

File uploads in Phusion Passenger 2.0.x

Large file upload

RailsLarge file

Web server

Concurrent HTTP request

Page 86: Phusion (an introduction)

File uploads in Phusion Passenger 2.0.x

Large file upload

RailsLarge file When done

Web server

Concurrent HTTP request

Page 87: Phusion (an introduction)

What about VM size?

Page 88: Phusion (an introduction)

VM size comparison

0

500

1,000

1,500

2,000

MB (avg)

Phusion Passenger 1.0.5 Phusion Passenger 2.0

Page 89: Phusion (an introduction)

Phusion PassengerAct 3

“Enterpriseyness”

Page 90: Phusion (an introduction)

Get dramatic increase in performance and

efficiency

Page 91: Phusion (an introduction)

Phusion Passenger+

Ruby Enterprise Edition

Page 92: Phusion (an introduction)

Phusion Passenger+

Ruby Enterprise Edition

Page 93: Phusion (an introduction)

Ruby Enterprise Edition

• Copy-on-write optimization to the garbage collector of MRI

• Transparent solution

• Ease of use

• A solution for today’s performance and memory use problems with Ruby

Page 94: Phusion (an introduction)

A copy-on-whah?

Page 95: Phusion (an introduction)

Example

String A = “foo”;String B = A;

Page 96: Phusion (an introduction)

Example

String A = “foo”;String B = A;

A and B refer to the same memory

Page 97: Phusion (an introduction)

Memory Management Heuristic

A

B

“foo”

Only useful if there are no side effects!

Page 98: Phusion (an introduction)

Example

String A = “foo”;String B = A;

Let’s write to ‘A’

Page 99: Phusion (an introduction)

Example

String A = “foo”;String B = A;A.append(“bar”);

Page 100: Phusion (an introduction)

Apply Copy on Write

A

B

“foo”

Page 101: Phusion (an introduction)

Copying on write

A

B

“foo”

“foo”

Page 102: Phusion (an introduction)

Situation after Copy on Write has been applied

A

B

“foobar”

“foo”

Page 103: Phusion (an introduction)

No redundancy in memory use!

Page 104: Phusion (an introduction)

Copy on Write in practice

A

B

Framework

Framework

Private memory

Private memory

Page 105: Phusion (an introduction)

Copy on Write in practice

A

B

Framework

Framework

Private memory

Private memory

These two are the same

Page 106: Phusion (an introduction)

Copy on Write in practice

A

B

Framework

Framework

Private memory

Private memory

These two could be the same

Page 107: Phusion (an introduction)

Copy on Write in practice

A

B

Framework Private memory

Page 108: Phusion (an introduction)

Copy on Write in practice

A

B

Framework

Private memory

Private memory

Page 109: Phusion (an introduction)

Alternative for threads!

Page 110: Phusion (an introduction)

Great theory, got numbers?

Page 111: Phusion (an introduction)

Benchmark equip.

Processor C2D 1.72GHz

RAM 2GB

OS Ubuntu 7.10 32 bit

Page 112: Phusion (an introduction)

Benchmark env.

Rails version 2.0.2

Ruby version 1.8.6(Ubuntu default)

Page 113: Phusion (an introduction)

Benchmark case

Subject Typo 5.0.3

Concurrent users 12

Requests 20,000

Page 114: Phusion (an introduction)

Memory comparison

0

60

120

180

240

MB (avg)

Apache Worker + Phusion Passenger + Ruby Enterprise EditionApache Prefork + Phusion Passenger

Page 115: Phusion (an introduction)

Memory comparison

0

60

120

180

240

MB (avg)

Apache Worker + Phusion Passenger + Ruby Enterprise EditionApache Worker + Phusion Passenger

Page 116: Phusion (an introduction)

Memory comparison

0

57.5

115.0

172.5

230.0

MB (avg)

Apache Worker + Phusion Passenger + Ruby Enterprise EditionNginx + Mongrel cluster

Page 117: Phusion (an introduction)

Memory comparison

0

57.5

115.0

172.5

230.0

MB (avg)

Apache Worker + Phusion Passenger + Ruby Enterprise EditionNginx + Thin (with Unix sockets)

Page 118: Phusion (an introduction)

Memory comparison

0

100

200

300

400

MB (avg)

Apache Worker + Phusion Passenger + Ruby Enterprise EditionLitespeed

Page 119: Phusion (an introduction)

0

100

200

300

400

MB (avg)

Memory comparison overview

Apache Prefork + PassengerApache Worker + PassengerNginx + MongrelNginx + ThinLitespeedApache Worker + Ruby Enterprise Edition + Passenger

Page 120: Phusion (an introduction)

Efficient, even with Apache!

Page 121: Phusion (an introduction)

What about speed?

Page 122: Phusion (an introduction)

Speed comparison

Page 123: Phusion (an introduction)

Speed comparison

0

150

300

450

600

Req / Sec

Apache Worker + Phusion Passenger + Ruby Enterprise EditionApache Prefork + Phusion Passenger

Page 124: Phusion (an introduction)

Speed comparison

0

150

300

450

600

Req / Sec

Apache Worker + Phusion Passenger + Ruby Enterprise EditionApache Worker + Phusion Passenger

Page 125: Phusion (an introduction)

Speed comparison

0

150

300

450

600

Req / Sec

Apache Worker + Phusion Passenger + Ruby Enterprise EditionNginx + Mongrel cluster

Page 126: Phusion (an introduction)

Speed comparison

0

150

300

450

600

Req / Sec

Apache Worker + Phusion Passenger + Ruby Enterprise EditionNginx + Thin (with Unix sockets)

Page 127: Phusion (an introduction)

Speed comparison

0

142.5

285.0

427.5

570.0

Req / Sec

Apache Worker + Phusion Passenger + Ruby Enterprise EditionLitespeed

Page 128: Phusion (an introduction)

0

150

300

450

600

Req/sec

Speed comparison overview

Apache Prefork + PassengerApache Worker + PassengerNginx + MongrelNginx + ThinLitespeedApache Worker + Ruby Enterprise Edition + Passenger

Page 129: Phusion (an introduction)

Fast, even with Apache!

Page 130: Phusion (an introduction)

Great numbers, got case studies?

Page 131: Phusion (an introduction)
Page 132: Phusion (an introduction)
Page 133: Phusion (an introduction)

At iLike we've been testing Passenger in production, and we're

very impressed. This has the potential to reduce our memory

requirements by 25 - 50%

Travis ColeiLike

Page 134: Phusion (an introduction)

Try it out for yourselves!

Page 135: Phusion (an introduction)

Quick recap

Page 136: Phusion (an introduction)

Quick recap

• Phusion Passenger allows easy deployment

Page 137: Phusion (an introduction)

Quick recap

• Phusion Passenger allows easy deployment

• Ruby Enterprise Edition allows for dramatic increase in performance and efficiency

Page 138: Phusion (an introduction)

Quick recap

• Phusion Passenger allows easy deployment

• Ruby Enterprise Edition allows for dramatic increase in performance and efficiency

• Phusion Passenger + Ruby Enterprise Edition = FTW

Page 139: Phusion (an introduction)

Questions & Answers

Page 140: Phusion (an introduction)

Will Phusion Passenger support Rack?

Fabio Akita

Page 141: Phusion (an introduction)

No, it WILL not...

Page 142: Phusion (an introduction)

Because it ALREADY supports Rack!

Page 143: Phusion (an introduction)

Screencast 2.0Return of the Ryan

Page 144: Phusion (an introduction)
Page 145: Phusion (an introduction)

mod_rails is dead

Page 146: Phusion (an introduction)

So, mod_rack is it?

Page 147: Phusion (an introduction)

NO!

Page 148: Phusion (an introduction)

We want Leah Culver!

Page 149: Phusion (an introduction)

She does Python...

Page 150: Phusion (an introduction)

So Phusion Passenger also supports WSGI!

Page 151: Phusion (an introduction)

What does this imply?

Page 152: Phusion (an introduction)

It starts with a ‘d’ and ends with ‘ango’.

Page 153: Phusion (an introduction)

No, not Dyango ;-)

Page 154: Phusion (an introduction)

Say hello to my little friend!

Page 155: Phusion (an introduction)

Why?!

Page 156: Phusion (an introduction)

Because we can!

Page 157: Phusion (an introduction)

Feel free to tinker with the code yourself! :-)

Page 158: Phusion (an introduction)

Rest in peace mod_rails4/11/2008 - 6/1/2008

Page 159: Phusion (an introduction)

Can I help?

Page 160: Phusion (an introduction)

YES!

Page 161: Phusion (an introduction)

Provide community support

Page 162: Phusion (an introduction)

Contribute code

Page 163: Phusion (an introduction)

Donate money?

Page 164: Phusion (an introduction)

Nah!

Page 165: Phusion (an introduction)

‘Purchase’ an enterprise license instead!

Page 166: Phusion (an introduction)

Join ‘Hall of Fame’

Page 167: Phusion (an introduction)

Eligable for t-shirt!

Page 168: Phusion (an introduction)

Or, contract us!

Page 169: Phusion (an introduction)

“When can I haz it?”

Page 170: Phusion (an introduction)

Well...

Page 171: Phusion (an introduction)

Are there any Enterprise Licensees

out here?

Page 172: Phusion (an introduction)

13 hardcopies for you guys!

Page 173: Phusion (an introduction)

Includes personal crash course after this talk!

Page 174: Phusion (an introduction)

After crash course,

Page 175: Phusion (an introduction)

public release!

Page 176: Phusion (an introduction)

Odds & ends

Page 177: Phusion (an introduction)

Thanks Ryan!

Page 178: Phusion (an introduction)

Thanks Jim!

Page 179: Phusion (an introduction)

Thanks Fabio!

Page 180: Phusion (an introduction)

Thank you for your time!

(Sorry for the Rickroll)

Page 181: Phusion (an introduction)

Disclaimer

• Photo’s, logo’s and trademarks found in these slides are property of their respective owners

• Phusion is a trademark of Phusion v.o.f.(i.e. Hongli Lai and Ninh Bui)

• Phusion Passenger is a trademark of Phusion v.o.f.(i.e. Hongli Lai and Ninh Bui)