phusion (an introduction)
TRANSCRIPT
Phusian
Phusian?!
Phusian
Phusian
Phusiona
An introduction to painless deployment
Motivation
A Rails philosophy:convention over
configuration
Convention over configuration for
deployment?
Good opportunity for our first product!
Our version of“Hello World” as an
IT company.
Phusion PassengerAct 1
“Short intro”
Suitable for exotic setups as well
Initial responses
Lots of attention!
Pleasantly surprised!
Impressed!
Ugh, FUD
Acceptance of Rails
“Rails is less used than PHP”, how come?
“PHP gets the job done,so why learn Rails?”
Cause the right tool for the job you must use!
“Everybody knows PHP”
No scarcity of PHP devs
Rails devs on the other hand?
Rails marketshare needs devs to grow,
while other devs reluctant to do Rails
Economic deadlock!
Most hosts don’t support Rails
this could lead to“PHP rocks, Rails
sucks”
Why should I care?
You’re part of the market as well!
Phusion Passenger saves the day?
Well, let’s see...
Most hosts use Apache
Ease of use matters!
Time == Money
Robustness matters
Stability matters
Should perform well
Everyone can help!
Commercial support
The big guys are excited!
"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.
Phusion Passenger saves the day?
Never gonna give up ;-)
Phusion PassengerAct 2
“New Developments”
Premature Optimization
Premature Optimization
Load balance improvements
From Round-Robin to Fair
Round-whah?
Round-Robin load balancing
Rails Rails Rails
Web server / load balancer
1 ... N
Round-Robin load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Round-Robin load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Round-Robin load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Round-Robin load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Round-Robin load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Round-Robin load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Round-Robin load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
What if one request takes a lot of time?
Queue could get congested!
Round-Robin problemHTTP request
Rails Rails Rails
Web server / load balancer
Round-Robin problemHTTP request
Rails Rails Rails
Web server / load balancer
Shouldn’t have had that
burrito!
Round-Robin problemHTTP request
Rails Rails Rails
Web server / load balancer
Unfair! Boring!Shouldn’t have had that
burrito!
In this case, every N request is unresponsive
Solution?
Forward request to Rails instance with least
requests in its queue
Fair load balancing!
Fair load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Fair load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Fair load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Fair load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Fair load balancingHTTP request
Rails Rails Rails
Web server / load balancer
1 ... N
Upload acceleration
File uploads in Phusion Passenger 1.0.x
Web server
Rails
File uploads in Phusion Passenger 1.0.x
Large file upload
Web server
Rails
Large file
Long file uploads block Rails processes...
Solution?
Upload buffering!
File uploads in Phusion Passenger 2.0.x
Rails
Web server
File uploads in Phusion Passenger 2.0.x
Large file upload
RailsLarge file
Web server
Concurrent HTTP request
File uploads in Phusion Passenger 2.0.x
Large file upload
RailsLarge file When done
Web server
Concurrent HTTP request
What about VM size?
VM size comparison
0
500
1,000
1,500
2,000
MB (avg)
Phusion Passenger 1.0.5 Phusion Passenger 2.0
Phusion PassengerAct 3
“Enterpriseyness”
Get dramatic increase in performance and
efficiency
Phusion Passenger+
Ruby Enterprise Edition
Phusion Passenger+
Ruby Enterprise Edition
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
A copy-on-whah?
Example
String A = “foo”;String B = A;
Example
String A = “foo”;String B = A;
A and B refer to the same memory
Memory Management Heuristic
A
B
“foo”
Only useful if there are no side effects!
Example
String A = “foo”;String B = A;
Let’s write to ‘A’
Example
String A = “foo”;String B = A;A.append(“bar”);
Apply Copy on Write
A
B
“foo”
Copying on write
A
B
“foo”
“foo”
Situation after Copy on Write has been applied
A
B
“foobar”
“foo”
No redundancy in memory use!
Copy on Write in practice
A
B
Framework
Framework
Private memory
Private memory
Copy on Write in practice
A
B
Framework
Framework
Private memory
Private memory
These two are the same
Copy on Write in practice
A
B
Framework
Framework
Private memory
Private memory
These two could be the same
Copy on Write in practice
A
B
Framework Private memory
Copy on Write in practice
A
B
Framework
Private memory
Private memory
Alternative for threads!
Great theory, got numbers?
Benchmark equip.
Processor C2D 1.72GHz
RAM 2GB
OS Ubuntu 7.10 32 bit
Benchmark env.
Rails version 2.0.2
Ruby version 1.8.6(Ubuntu default)
Benchmark case
Subject Typo 5.0.3
Concurrent users 12
Requests 20,000
Memory comparison
0
60
120
180
240
MB (avg)
Apache Worker + Phusion Passenger + Ruby Enterprise EditionApache Prefork + Phusion Passenger
Memory comparison
0
60
120
180
240
MB (avg)
Apache Worker + Phusion Passenger + Ruby Enterprise EditionApache Worker + Phusion Passenger
Memory comparison
0
57.5
115.0
172.5
230.0
MB (avg)
Apache Worker + Phusion Passenger + Ruby Enterprise EditionNginx + Mongrel cluster
Memory comparison
0
57.5
115.0
172.5
230.0
MB (avg)
Apache Worker + Phusion Passenger + Ruby Enterprise EditionNginx + Thin (with Unix sockets)
Memory comparison
0
100
200
300
400
MB (avg)
Apache Worker + Phusion Passenger + Ruby Enterprise EditionLitespeed
0
100
200
300
400
MB (avg)
Memory comparison overview
Apache Prefork + PassengerApache Worker + PassengerNginx + MongrelNginx + ThinLitespeedApache Worker + Ruby Enterprise Edition + Passenger
Efficient, even with Apache!
What about speed?
Speed comparison
Speed comparison
0
150
300
450
600
Req / Sec
Apache Worker + Phusion Passenger + Ruby Enterprise EditionApache Prefork + Phusion Passenger
Speed comparison
0
150
300
450
600
Req / Sec
Apache Worker + Phusion Passenger + Ruby Enterprise EditionApache Worker + Phusion Passenger
Speed comparison
0
150
300
450
600
Req / Sec
Apache Worker + Phusion Passenger + Ruby Enterprise EditionNginx + Mongrel cluster
Speed comparison
0
150
300
450
600
Req / Sec
Apache Worker + Phusion Passenger + Ruby Enterprise EditionNginx + Thin (with Unix sockets)
Speed comparison
0
142.5
285.0
427.5
570.0
Req / Sec
Apache Worker + Phusion Passenger + Ruby Enterprise EditionLitespeed
0
150
300
450
600
Req/sec
Speed comparison overview
Apache Prefork + PassengerApache Worker + PassengerNginx + MongrelNginx + ThinLitespeedApache Worker + Ruby Enterprise Edition + Passenger
Fast, even with Apache!
Great numbers, got case studies?
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
Try it out for yourselves!
Quick recap
Quick recap
• Phusion Passenger allows easy deployment
Quick recap
• Phusion Passenger allows easy deployment
• Ruby Enterprise Edition allows for dramatic increase in performance and efficiency
Quick recap
• Phusion Passenger allows easy deployment
• Ruby Enterprise Edition allows for dramatic increase in performance and efficiency
• Phusion Passenger + Ruby Enterprise Edition = FTW
Questions & Answers
Will Phusion Passenger support Rack?
Fabio Akita
No, it WILL not...
Because it ALREADY supports Rack!
Screencast 2.0Return of the Ryan
mod_rails is dead
So, mod_rack is it?
NO!
We want Leah Culver!
She does Python...
So Phusion Passenger also supports WSGI!
What does this imply?
It starts with a ‘d’ and ends with ‘ango’.
No, not Dyango ;-)
Say hello to my little friend!
Why?!
Because we can!
Feel free to tinker with the code yourself! :-)
Rest in peace mod_rails4/11/2008 - 6/1/2008
Can I help?
YES!
Provide community support
Contribute code
Donate money?
Nah!
‘Purchase’ an enterprise license instead!
Join ‘Hall of Fame’
Eligable for t-shirt!
Or, contract us!
“When can I haz it?”
Well...
Are there any Enterprise Licensees
out here?
13 hardcopies for you guys!
Includes personal crash course after this talk!
After crash course,
public release!
Odds & ends
Thanks Ryan!
Thanks Jim!
Thanks Fabio!
Thank you for your time!
(Sorry for the Rickroll)
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)