SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
Xen and the Art of
Rails Deployment
Who am I?

• Ezra Zygmuntowicz
• Rubyist for 4 years
• Engine Yard Founder and Architect
• Blog: http://brainspl.at
Deploying Rails

• Details have changed rapidly over the years
• Many different webservers have come and
  gone
• Basics remain the same
Full Stack Request/Response Life-Cycle


•   Request comes into gateway
    server


•   Rewrite rules are evaluated and
    request gets served directly if it’s
    a static asset


•   Dynamic requests are proxied to
    one Mongrel in the Mongrel
    Cluster


•   Mongrel dispatches request
    through Rails and returns
    response to client
History Lesson
 •   CGI

 •   Apache1.3.x/mod_fastcgi

 •   Lighttpd/fcgi

 •   Apache2.x/mod_fcgid

 •   Lighttpd/SCGI

 •   Lightspeed
Enough Already




X
  •   CGI

  •   Apache1.3.x/mod_fastcgi

  •   Lighttpd/fcgi

  •   Apache2.x/mod_fcgid

  •   Lighttpd/SCGI

  •   Lightspeed
Enter Mongrel

The year of the Dog
What is Mongrel?
Mongrel is an HTTP Server
 Library written by Zed Shaw

• Fast HTTP Parser written in Ragel + C
• Fast URI Classifier written in C
• Stackable Request Handlers
• Flexible Configuration
• Secure and RFC Compliant HTTP Parser
Ragel State Machine
Defined HTTP Parser
Why is Mongrel better?

• HTTP is a well known and well tooled
  protocol
• Mongrel is way easier to setup and use
• Transparent wire protocol
But Rails isn’t Thread Safe!

• Giant Mutex Lock around Rails Dispatch
• Only one request served at a time by one
  mongrel
• Use mongrel_cluster to scale with multiple
  processes
Rails Internal Request/Response Life-Cycle
•   Mongrel Locks Mutex

•   Rails Dispatcher is invoked with
    request/response objects

•   Routing is invoked and returns
    the proper Controller object or
    404 if no route found

•   Filter chain is invoked

•   Controller’s Action is called,
    manipulates Models

•   View is rendered and any after
    filters are called

•   Mongrel Unlocks Mutex

•   Final response or error page
    returned to client
New dog seeking old
          tricks
•   Wide array of options for HTTP tools to front mongrel
    clusters

•   Pen, Pound, Balance, Haproxy ( No static file serving, just
    proxies)

•   Lightspeed can serve static files and proxy to mongrel

•   Apache2.2.x/mod_proxy_balancer can do the same
On the prowl for the
       perfect stack
•   Pen(no ssl support, no connection rate limiting)

•   Pound(Falls down under high load, no connection rate limiting)

•   Haproxy(supports conn rate limits, very high perf, no static files
    so more moving parts in a full stack)

•   Lightspeed(free version is crippled)

•   Apache2.2.x(Does work but.. bloat, bloat, bloat...)
Nginx:
From Russia, with Love
•   Seriously bent on performance

•   Super small resource footprint

•   Stands up under the heaviest loads without leaking memory

•   Killer rewrite and proxy modules

•   Approachable author and growing community
Nginx + Mongrel
•   This is *the* stack to be on

•   Only keep apache around for mod_dav_svn

•   Flexible nginx.conf syntax allows for serving static files and
    rails caches and proxying dynamic requests to mongrel

•   Fast, fast, fast

•   Did I say it’s fast yet?
A few gotchas


•   Nginx buffers file uploads, so no mongrel_upload_progress. This
    will be addressed soon

•   No connection rate limiting for proxy module yet, this too shall
    pass
A bright future for nginx

•   mod_rewrite is going away

•   To be replaced with http_script_module

•   This will embed the NekoVM(http://nekovm.org/) directly in
    nginx so customizing behavior for rewriting and proxying will
    become infinitley flexible
Perfect Simple Stack

    •   Linux

    •   Nginx

    •   Mongrel(mongrel_cluster)

    •   Monit
Swiftiply:
Teaching the Dog new tricks
      http://swiftiply.swiftcore.org
Swiftiply: Evented Mongrel
 •   Hot patch to Mongrel

 •   Removes Ruby’s Thread’s and Socket handling from Mongrel
     Core

 •   Replace with EventMachine event loop

 •   Mongrel becomes Single threaded, event driven

 •   Noticable Speed and IO throughtput increase

 •   Stands up much better under higher concurrent load without
     starting to slow down or leak memory
But how does a single threaded
event driven mongrel outperform
    a multithreaded mongrel?
•   Ruby’s green threads have a lot of overhead in context switching
    and have to copy a lot of state context for each thread

•   Mutual exclusion locks are expensive

•   One process can only do so much IO

•   Event driven means running in a tight loop and firing callbacks in
    response to network ‘events’

•   Since there is no context switching between threads, a single
    process has less overhead to deal with which allows for higher
    throughput and faster networking IO
Mongrel VS Evented Mongrel
       in a Hello World dogfight
  Mongrel:
1 concurrent
    user


   Evented
  Mongrel:
1 concurrent
     user
Mongrel:
100 concurrent
     users




Evented Mongrel:
 100 concurrent
      users
Swiftiply Proxy

•   Event driven proxy, small memory footprint(7-10Mb)

•   Faster then Haproxy

•   Did I mention Fast?
How it differs from a
               normal proxy
Standard proxy must know about the        With swiftiply, the backends connect to the proxy. So
ports of all backends. Usually requires   all mongrels get started on the same port and then
    restart to add more backends            they open a persistent connection to the proxy
This means you can start and stop as many
        mongrels as you want and they get auto
               configured in the proxy!




This opens the door for scaling the number of mongrels
 automatically in response to increased load on the fly!
The Zen of Xen
Monolithic Linux VS
      Modularized Linux
•   Old way of thinking is dedicated boxes running all services in
    one big hodgepodge on one kernel

•   New school is sharply targeted virtualized linux with each VM
    running a single tier or service
We all strive for code
    modularization right?
•   Why not do the same thing with our servers?

•   Each VM runs one or two related services

•   Simplifies deployment and scaling

•   Even if you only have one box you absolutely should run
    Xen on it from the start
Old VS New
What happens when you need to
 scale to more then one box?
Old School
•   Get another box and move mysql on there

•   Get another box to run some of the other services

•   Lots of setup required, downtime to migrate

•   Complex Linux installs with many services running are harder
    to debug when performance problems happen

•   This *can* scale but is way less flexible
New School
•   Add another box with Xen installed

•   Pick a few services that need more resources and migrate
    them *live* to the other machine

•   Each VM runs one thing and runs it well

•   Easy to target performance problems

•   Scales much better
Advanced Clustering
•   Virtualized compute nodes that boot Xen dom0 off of USB
    thumb drives

•   SAN storage for all Xen domU(VPS’s)

•   Red Hat Clustering Suite for fencing and cluster quorems

•   GFS for 100% posix compliant clustered filesystem(no shitty
    NFS)

•   Hardware load balancers or dedicated boxes running Ultra
    Monkey or just straight LVS
Fabric of Compute and
        Storage
•   When a compute node fails just swap it out for a new one and
    plug in the thumbdrive and you’re back in business

•   Move hot VM’s to less loaded nodes easily as they are not tied
    to a single machine

•   Deploy your app code to one node and then bounce the
    mongrels on all nodes with a clustered filesystem like GFS

•   Fragment and page caching consistency across all nodes
    instantly

•   Scale from one or 2 VM’s to as many as traffic requires *and*
    back down again once traffic subsides.
RAM RAM RAM

•   Most Rails apps are RAM bound way before they are CPU
    bound

•   Average mongrel size on 64bit EngineYard is 70-120Mb *per*
    mongrel. Slightly less on 32 bit systems

•   Rmagick and :include the worst culprits

•   95% of Rails apps will leak memory at one point or another
Rails eats Database
resources for breakfast
•   Majority of app in the wild have *no* indexes in their
    databases

•   Learn when and where to apply indexes, it will save your
    ass

•   ActiveRecord insulates developers from SQL to the point
    of massive ineficiencies. Look at your logs and see what
    SQL is being generated. Do not fear the SQL and don’t
    think you can get away without some denormalization and
    custom SQL if you plan on your app having a chance of
    scaling
Other tips & tricks
•   *Don’t* use filesystem sessions, AR or SQLSession or
    memcached if you don’t need persistance

•   script/runner is massively ineficient. Try as hard as possible
    to not load all of rails in your background processes. Use
    the raw Mysql library and plain ruby if you can and your
    servers will thank you for it

•   *Do not* use script runner to process incoming email.
    Run a daemon in a loop and poll a mail server with net/
    pop2 or net/imap. Forking a whole rails process for each
    incoming email will never work in a production
    environment period
Rails is great for the
           80/20 rule
•   But you are on your own when you need the last 20%

•   Learn how to write custom mongrel handlers for perf critical
    sections of your app

•   When is optimization not premature?

•   Ruby is plenty fast, it’s rails that tends to be on the slow side

•   Cache, cache, cache. It doesnt get much faster then service
    cached static html files
Parting Thought

•   Don’t take what I or anyone else says about this stuff as
    gospel

•   Test it and benchmark it for yourself to be sure

•   Trust but verify and you will stay in good shape
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionJoel Koshy
 
Let the alpakka pull your stream
Let the alpakka pull your streamLet the alpakka pull your stream
Let the alpakka pull your streamEnno Runne
 
Distributed automation selcamp2016
Distributed automation selcamp2016Distributed automation selcamp2016
Distributed automation selcamp2016aragavan
 
HDFS Scalability and Security, Daryn Sharp, Senior Engineer, Oath
HDFS Scalability and Security, Daryn Sharp, Senior Engineer, OathHDFS Scalability and Security, Daryn Sharp, Senior Engineer, Oath
HDFS Scalability and Security, Daryn Sharp, Senior Engineer, OathYahoo Developer Network
 
Autoscaled Distributed Automation using AWS at Selenium London MeetUp
Autoscaled Distributed Automation using AWS at Selenium London MeetUpAutoscaled Distributed Automation using AWS at Selenium London MeetUp
Autoscaled Distributed Automation using AWS at Selenium London MeetUparagavan
 
Load-balancing high-available web-app with Docker Swarm cluster. - Simone Sol...
Load-balancing high-available web-app with Docker Swarm cluster. - Simone Sol...Load-balancing high-available web-app with Docker Swarm cluster. - Simone Sol...
Load-balancing high-available web-app with Docker Swarm cluster. - Simone Sol...Codemotion
 
Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesSeveralnines
 
The Java Microservice Library
The Java Microservice LibraryThe Java Microservice Library
The Java Microservice LibraryRick Hightower
 
Scaling with sync_replication using Galera and EC2
Scaling with sync_replication using Galera and EC2Scaling with sync_replication using Galera and EC2
Scaling with sync_replication using Galera and EC2Marco Tusa
 
"High-load is at the intersection of DevOps and PHP development",
"High-load is at the intersection of DevOps and PHP development", "High-load is at the intersection of DevOps and PHP development",
"High-load is at the intersection of DevOps and PHP development", Fwdays
 
Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013MariaDB Corporation
 
Akka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaAkka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaJerry Kuru
 
Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder MeetupSimple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder MeetupApcera
 
... No it's Apache Kafka!
... No it's Apache Kafka!... No it's Apache Kafka!
... No it's Apache Kafka!makker_nl
 
Using and Benchmarking Galera in different architectures (PLUK 2012)
Using and Benchmarking Galera in different architectures (PLUK 2012)Using and Benchmarking Galera in different architectures (PLUK 2012)
Using and Benchmarking Galera in different architectures (PLUK 2012)Henrik Ingo
 

Was ist angesagt? (15)

Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolution
 
Let the alpakka pull your stream
Let the alpakka pull your streamLet the alpakka pull your stream
Let the alpakka pull your stream
 
Distributed automation selcamp2016
Distributed automation selcamp2016Distributed automation selcamp2016
Distributed automation selcamp2016
 
HDFS Scalability and Security, Daryn Sharp, Senior Engineer, Oath
HDFS Scalability and Security, Daryn Sharp, Senior Engineer, OathHDFS Scalability and Security, Daryn Sharp, Senior Engineer, Oath
HDFS Scalability and Security, Daryn Sharp, Senior Engineer, Oath
 
Autoscaled Distributed Automation using AWS at Selenium London MeetUp
Autoscaled Distributed Automation using AWS at Selenium London MeetUpAutoscaled Distributed Automation using AWS at Selenium London MeetUp
Autoscaled Distributed Automation using AWS at Selenium London MeetUp
 
Load-balancing high-available web-app with Docker Swarm cluster. - Simone Sol...
Load-balancing high-available web-app with Docker Swarm cluster. - Simone Sol...Load-balancing high-available web-app with Docker Swarm cluster. - Simone Sol...
Load-balancing high-available web-app with Docker Swarm cluster. - Simone Sol...
 
Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction Slides
 
The Java Microservice Library
The Java Microservice LibraryThe Java Microservice Library
The Java Microservice Library
 
Scaling with sync_replication using Galera and EC2
Scaling with sync_replication using Galera and EC2Scaling with sync_replication using Galera and EC2
Scaling with sync_replication using Galera and EC2
 
"High-load is at the intersection of DevOps and PHP development",
"High-load is at the intersection of DevOps and PHP development", "High-load is at the intersection of DevOps and PHP development",
"High-load is at the intersection of DevOps and PHP development",
 
Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013
 
Akka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaAkka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with Scala
 
Simple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder MeetupSimple Solutions for Complex Problems - Boulder Meetup
Simple Solutions for Complex Problems - Boulder Meetup
 
... No it's Apache Kafka!
... No it's Apache Kafka!... No it's Apache Kafka!
... No it's Apache Kafka!
 
Using and Benchmarking Galera in different architectures (PLUK 2012)
Using and Benchmarking Galera in different architectures (PLUK 2012)Using and Benchmarking Galera in different architectures (PLUK 2012)
Using and Benchmarking Galera in different architectures (PLUK 2012)
 

Andere mochten auch

Wisebo - TechAviv Prez
Wisebo - TechAviv PrezWisebo - TechAviv Prez
Wisebo - TechAviv PrezYaron Samid
 
Web 2.0 - Assolint la maduresa de l'empresa
Web 2.0 - Assolint la maduresa de l'empresaWeb 2.0 - Assolint la maduresa de l'empresa
Web 2.0 - Assolint la maduresa de l'empresaTICAnoia
 
XCPU3: Workload Distribution and Aggregation
XCPU3: Workload Distribution and AggregationXCPU3: Workload Distribution and Aggregation
XCPU3: Workload Distribution and AggregationEric Van Hensbergen
 
X2 T03 05 rectangular hyperbola (2010)
X2 T03 05 rectangular hyperbola (2010)X2 T03 05 rectangular hyperbola (2010)
X2 T03 05 rectangular hyperbola (2010)Nigel Simmons
 
X2 t02 03 roots & coefficients (2012)
X2 t02 03 roots & coefficients (2012)X2 t02 03 roots & coefficients (2012)
X2 t02 03 roots & coefficients (2012)Nigel Simmons
 
XC_Training_Certificate[1]
XC_Training_Certificate[1]XC_Training_Certificate[1]
XC_Training_Certificate[1]Ben Wilde
 
项目汇报 第二组X
项目汇报 第二组X项目汇报 第二组X
项目汇报 第二组XBen Liu
 
X2 T07 04 uniform circular motion (2010)
X2 T07 04 uniform circular motion (2010)X2 T07 04 uniform circular motion (2010)
X2 T07 04 uniform circular motion (2010)Nigel Simmons
 
인터넷경마"race77‘com"라이브바카라x6v
인터넷경마"race77‘com"라이브바카라x6v 인터넷경마"race77‘com"라이브바카라x6v
인터넷경마"race77‘com"라이브바카라x6v 박 양도
 
Xcsutthngkbngexcel 131003142548-phpapp02
Xcsutthngkbngexcel 131003142548-phpapp02Xcsutthngkbngexcel 131003142548-phpapp02
Xcsutthngkbngexcel 131003142548-phpapp02Minh Vu
 

Andere mochten auch (20)

xAutobiography...
xAutobiography...xAutobiography...
xAutobiography...
 
X12 Overview
X12 OverviewX12 Overview
X12 Overview
 
Wisebo - TechAviv Prez
Wisebo - TechAviv PrezWisebo - TechAviv Prez
Wisebo - TechAviv Prez
 
Web 2.0 - Assolint la maduresa de l'empresa
Web 2.0 - Assolint la maduresa de l'empresaWeb 2.0 - Assolint la maduresa de l'empresa
Web 2.0 - Assolint la maduresa de l'empresa
 
XBRL en el sector público
XBRL en el sector públicoXBRL en el sector público
XBRL en el sector público
 
XCPU3: Workload Distribution and Aggregation
XCPU3: Workload Distribution and AggregationXCPU3: Workload Distribution and Aggregation
XCPU3: Workload Distribution and Aggregation
 
X brilhante
X brilhanteX brilhante
X brilhante
 
X2 T03 05 rectangular hyperbola (2010)
X2 T03 05 rectangular hyperbola (2010)X2 T03 05 rectangular hyperbola (2010)
X2 T03 05 rectangular hyperbola (2010)
 
Xamarin insights
Xamarin insightsXamarin insights
Xamarin insights
 
X2 t02 03 roots & coefficients (2012)
X2 t02 03 roots & coefficients (2012)X2 t02 03 roots & coefficients (2012)
X2 t02 03 roots & coefficients (2012)
 
XC_Training_Certificate[1]
XC_Training_Certificate[1]XC_Training_Certificate[1]
XC_Training_Certificate[1]
 
项目汇报 第二组X
项目汇报 第二组X项目汇报 第二组X
项目汇报 第二组X
 
Xclusivepitch
XclusivepitchXclusivepitch
Xclusivepitch
 
Xanat
XanatXanat
Xanat
 
X2 T07 04 uniform circular motion (2010)
X2 T07 04 uniform circular motion (2010)X2 T07 04 uniform circular motion (2010)
X2 T07 04 uniform circular motion (2010)
 
인터넷경마"race77‘com"라이브바카라x6v
인터넷경마"race77‘com"라이브바카라x6v 인터넷경마"race77‘com"라이브바카라x6v
인터넷경마"race77‘com"라이브바카라x6v
 
Xcsutthngkbngexcel 131003142548-phpapp02
Xcsutthngkbngexcel 131003142548-phpapp02Xcsutthngkbngexcel 131003142548-phpapp02
Xcsutthngkbngexcel 131003142548-phpapp02
 
X 8 13_clara artha
X 8 13_clara arthaX 8 13_clara artha
X 8 13_clara artha
 
Xcellent choice comp plan short
Xcellent choice comp plan shortXcellent choice comp plan short
Xcellent choice comp plan short
 
NEC X554 un 2
NEC X554 un 2NEC X554 un 2
NEC X554 un 2
 

Ähnlich wie Xen_and_Rails_deployment

Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640LLC NewLink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 NotesRoss Lawley
 
Mongrel Handlers
Mongrel HandlersMongrel Handlers
Mongrel Handlersnextlib
 
Deployment with Ruby on Rails
Deployment with Ruby on RailsDeployment with Ruby on Rails
Deployment with Ruby on RailsJonathan Weiss
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring RailsJonathan Weiss
 
Rails hosting
Rails hostingRails hosting
Rails hostingwonko
 
From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Clusterguestd34230
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro MerbPaul Pajo
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro MerbPaul Pajo
 
My S Q L Replication Getting The Most From Slaves
My S Q L  Replication  Getting  The  Most  From  SlavesMy S Q L  Replication  Getting  The  Most  From  Slaves
My S Q L Replication Getting The Most From SlavesPerconaPerformance
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & ScalabilityJoseph Scott
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceEvan McGee
 
Planning to Fail #phpuk13
Planning to Fail #phpuk13Planning to Fail #phpuk13
Planning to Fail #phpuk13Dave Gardner
 
Architecture of web servers
Architecture of web serversArchitecture of web servers
Architecture of web serversNicolas Vanhoren
 
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE
 

Ähnlich wie Xen_and_Rails_deployment (20)

Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 Notes
 
Mongrel Handlers
Mongrel HandlersMongrel Handlers
Mongrel Handlers
 
Deployment with Ruby on Rails
Deployment with Ruby on RailsDeployment with Ruby on Rails
Deployment with Ruby on Rails
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring Rails
 
Rails hosting
Rails hostingRails hosting
Rails hosting
 
From One to a Cluster
From One to a ClusterFrom One to a Cluster
From One to a Cluster
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro Merb
 
Practical Intro Merb
Practical Intro MerbPractical Intro Merb
Practical Intro Merb
 
My S Q L Replication Getting The Most From Slaves
My S Q L  Replication  Getting  The  Most  From  SlavesMy S Q L  Replication  Getting  The  Most  From  Slaves
My S Q L Replication Getting The Most From Slaves
 
Capistrano
CapistranoCapistrano
Capistrano
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a Microservice
 
Planning to Fail #phpuk13
Planning to Fail #phpuk13Planning to Fail #phpuk13
Planning to Fail #phpuk13
 
Architecture of web servers
Architecture of web serversArchitecture of web servers
Architecture of web servers
 
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
 

Mehr von Abhishek Singh

Cobbler Summit - Automated Xen VM Deployment
Cobbler Summit - Automated Xen VM DeploymentCobbler Summit - Automated Xen VM Deployment
Cobbler Summit - Automated Xen VM DeploymentAbhishek Singh
 
Mapreduce - Simplified Data Processing on Large Clusters
Mapreduce - Simplified Data Processing on Large ClustersMapreduce - Simplified Data Processing on Large Clusters
Mapreduce - Simplified Data Processing on Large ClustersAbhishek Singh
 
Web Server Clustering - OSSCAMP
Web Server Clustering - OSSCAMPWeb Server Clustering - OSSCAMP
Web Server Clustering - OSSCAMPAbhishek Singh
 
Happy Independence Day To All Indians
Happy Independence Day To All IndiansHappy Independence Day To All Indians
Happy Independence Day To All IndiansAbhishek Singh
 
Scaling a Rails Application from the Bottom Up
Scaling a Rails Application from the Bottom Up Scaling a Rails Application from the Bottom Up
Scaling a Rails Application from the Bottom Up Abhishek Singh
 
India's Smallest Car Ever
India's Smallest Car EverIndia's Smallest Car Ever
India's Smallest Car EverAbhishek Singh
 
Make Over Of An Orange
Make Over Of An OrangeMake Over Of An Orange
Make Over Of An OrangeAbhishek Singh
 
Cute Friendship Quotes
Cute Friendship QuotesCute Friendship Quotes
Cute Friendship QuotesAbhishek Singh
 
Series of Cool Pics Part 3
Series of Cool Pics Part 3Series of Cool Pics Part 3
Series of Cool Pics Part 3Abhishek Singh
 
Series of Cool Pictures Part 2
Series of Cool Pictures Part 2Series of Cool Pictures Part 2
Series of Cool Pictures Part 2Abhishek Singh
 
Series Of Cool Picutres Part 1
Series Of Cool Picutres Part 1Series Of Cool Picutres Part 1
Series Of Cool Picutres Part 1Abhishek Singh
 
Web Intrusion Detection
Web Intrusion Detection Web Intrusion Detection
Web Intrusion Detection Abhishek Singh
 

Mehr von Abhishek Singh (20)

Cobbler Summit - Automated Xen VM Deployment
Cobbler Summit - Automated Xen VM DeploymentCobbler Summit - Automated Xen VM Deployment
Cobbler Summit - Automated Xen VM Deployment
 
Mapreduce - Simplified Data Processing on Large Clusters
Mapreduce - Simplified Data Processing on Large ClustersMapreduce - Simplified Data Processing on Large Clusters
Mapreduce - Simplified Data Processing on Large Clusters
 
Web Server Clustering - OSSCAMP
Web Server Clustering - OSSCAMPWeb Server Clustering - OSSCAMP
Web Server Clustering - OSSCAMP
 
Happy Independence Day To All Indians
Happy Independence Day To All IndiansHappy Independence Day To All Indians
Happy Independence Day To All Indians
 
Scaling a Rails Application from the Bottom Up
Scaling a Rails Application from the Bottom Up Scaling a Rails Application from the Bottom Up
Scaling a Rails Application from the Bottom Up
 
test
testtest
test
 
How to Charm a Woman
How to Charm a WomanHow to Charm a Woman
How to Charm a Woman
 
India's Smallest Car Ever
India's Smallest Car EverIndia's Smallest Car Ever
India's Smallest Car Ever
 
Software BABA
Software BABASoftware BABA
Software BABA
 
Make Over Of An Orange
Make Over Of An OrangeMake Over Of An Orange
Make Over Of An Orange
 
Cute Friendship Quotes
Cute Friendship QuotesCute Friendship Quotes
Cute Friendship Quotes
 
Series of Cool Pics Part 3
Series of Cool Pics Part 3Series of Cool Pics Part 3
Series of Cool Pics Part 3
 
Series of Cool Pictures Part 2
Series of Cool Pictures Part 2Series of Cool Pictures Part 2
Series of Cool Pictures Part 2
 
Name Confusion
Name ConfusionName Confusion
Name Confusion
 
Series Of Cool Picutres Part 1
Series Of Cool Picutres Part 1Series Of Cool Picutres Part 1
Series Of Cool Picutres Part 1
 
KUbuntu
KUbuntuKUbuntu
KUbuntu
 
Monit
MonitMonit
Monit
 
Fun
Fun Fun
Fun
 
Mod Security
Mod SecurityMod Security
Mod Security
 
Web Intrusion Detection
Web Intrusion Detection Web Intrusion Detection
Web Intrusion Detection
 

Kürzlich hochgeladen

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Kürzlich hochgeladen (20)

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

Xen_and_Rails_deployment

  • 1. Xen and the Art of Rails Deployment
  • 2. Who am I? • Ezra Zygmuntowicz • Rubyist for 4 years • Engine Yard Founder and Architect • Blog: http://brainspl.at
  • 3. Deploying Rails • Details have changed rapidly over the years • Many different webservers have come and gone • Basics remain the same
  • 4. Full Stack Request/Response Life-Cycle • Request comes into gateway server • Rewrite rules are evaluated and request gets served directly if it’s a static asset • Dynamic requests are proxied to one Mongrel in the Mongrel Cluster • Mongrel dispatches request through Rails and returns response to client
  • 5. History Lesson • CGI • Apache1.3.x/mod_fastcgi • Lighttpd/fcgi • Apache2.x/mod_fcgid • Lighttpd/SCGI • Lightspeed
  • 6. Enough Already X • CGI • Apache1.3.x/mod_fastcgi • Lighttpd/fcgi • Apache2.x/mod_fcgid • Lighttpd/SCGI • Lightspeed
  • 9. Mongrel is an HTTP Server Library written by Zed Shaw • Fast HTTP Parser written in Ragel + C • Fast URI Classifier written in C • Stackable Request Handlers • Flexible Configuration • Secure and RFC Compliant HTTP Parser
  • 11. Why is Mongrel better? • HTTP is a well known and well tooled protocol • Mongrel is way easier to setup and use • Transparent wire protocol
  • 12. But Rails isn’t Thread Safe! • Giant Mutex Lock around Rails Dispatch • Only one request served at a time by one mongrel • Use mongrel_cluster to scale with multiple processes
  • 13. Rails Internal Request/Response Life-Cycle • Mongrel Locks Mutex • Rails Dispatcher is invoked with request/response objects • Routing is invoked and returns the proper Controller object or 404 if no route found • Filter chain is invoked • Controller’s Action is called, manipulates Models • View is rendered and any after filters are called • Mongrel Unlocks Mutex • Final response or error page returned to client
  • 14. New dog seeking old tricks • Wide array of options for HTTP tools to front mongrel clusters • Pen, Pound, Balance, Haproxy ( No static file serving, just proxies) • Lightspeed can serve static files and proxy to mongrel • Apache2.2.x/mod_proxy_balancer can do the same
  • 15. On the prowl for the perfect stack • Pen(no ssl support, no connection rate limiting) • Pound(Falls down under high load, no connection rate limiting) • Haproxy(supports conn rate limits, very high perf, no static files so more moving parts in a full stack) • Lightspeed(free version is crippled) • Apache2.2.x(Does work but.. bloat, bloat, bloat...)
  • 16. Nginx: From Russia, with Love • Seriously bent on performance • Super small resource footprint • Stands up under the heaviest loads without leaking memory • Killer rewrite and proxy modules • Approachable author and growing community
  • 17. Nginx + Mongrel • This is *the* stack to be on • Only keep apache around for mod_dav_svn • Flexible nginx.conf syntax allows for serving static files and rails caches and proxying dynamic requests to mongrel • Fast, fast, fast • Did I say it’s fast yet?
  • 18. A few gotchas • Nginx buffers file uploads, so no mongrel_upload_progress. This will be addressed soon • No connection rate limiting for proxy module yet, this too shall pass
  • 19. A bright future for nginx • mod_rewrite is going away • To be replaced with http_script_module • This will embed the NekoVM(http://nekovm.org/) directly in nginx so customizing behavior for rewriting and proxying will become infinitley flexible
  • 20. Perfect Simple Stack • Linux • Nginx • Mongrel(mongrel_cluster) • Monit
  • 21. Swiftiply: Teaching the Dog new tricks http://swiftiply.swiftcore.org
  • 22. Swiftiply: Evented Mongrel • Hot patch to Mongrel • Removes Ruby’s Thread’s and Socket handling from Mongrel Core • Replace with EventMachine event loop • Mongrel becomes Single threaded, event driven • Noticable Speed and IO throughtput increase • Stands up much better under higher concurrent load without starting to slow down or leak memory
  • 23. But how does a single threaded event driven mongrel outperform a multithreaded mongrel? • Ruby’s green threads have a lot of overhead in context switching and have to copy a lot of state context for each thread • Mutual exclusion locks are expensive • One process can only do so much IO • Event driven means running in a tight loop and firing callbacks in response to network ‘events’ • Since there is no context switching between threads, a single process has less overhead to deal with which allows for higher throughput and faster networking IO
  • 24. Mongrel VS Evented Mongrel in a Hello World dogfight Mongrel: 1 concurrent user Evented Mongrel: 1 concurrent user
  • 25. Mongrel: 100 concurrent users Evented Mongrel: 100 concurrent users
  • 26. Swiftiply Proxy • Event driven proxy, small memory footprint(7-10Mb) • Faster then Haproxy • Did I mention Fast?
  • 27. How it differs from a normal proxy Standard proxy must know about the With swiftiply, the backends connect to the proxy. So ports of all backends. Usually requires all mongrels get started on the same port and then restart to add more backends they open a persistent connection to the proxy
  • 28. This means you can start and stop as many mongrels as you want and they get auto configured in the proxy! This opens the door for scaling the number of mongrels automatically in response to increased load on the fly!
  • 30. Monolithic Linux VS Modularized Linux • Old way of thinking is dedicated boxes running all services in one big hodgepodge on one kernel • New school is sharply targeted virtualized linux with each VM running a single tier or service
  • 31. We all strive for code modularization right? • Why not do the same thing with our servers? • Each VM runs one or two related services • Simplifies deployment and scaling • Even if you only have one box you absolutely should run Xen on it from the start
  • 33. What happens when you need to scale to more then one box?
  • 34. Old School • Get another box and move mysql on there • Get another box to run some of the other services • Lots of setup required, downtime to migrate • Complex Linux installs with many services running are harder to debug when performance problems happen • This *can* scale but is way less flexible
  • 35. New School • Add another box with Xen installed • Pick a few services that need more resources and migrate them *live* to the other machine • Each VM runs one thing and runs it well • Easy to target performance problems • Scales much better
  • 36. Advanced Clustering • Virtualized compute nodes that boot Xen dom0 off of USB thumb drives • SAN storage for all Xen domU(VPS’s) • Red Hat Clustering Suite for fencing and cluster quorems • GFS for 100% posix compliant clustered filesystem(no shitty NFS) • Hardware load balancers or dedicated boxes running Ultra Monkey or just straight LVS
  • 37. Fabric of Compute and Storage • When a compute node fails just swap it out for a new one and plug in the thumbdrive and you’re back in business • Move hot VM’s to less loaded nodes easily as they are not tied to a single machine • Deploy your app code to one node and then bounce the mongrels on all nodes with a clustered filesystem like GFS • Fragment and page caching consistency across all nodes instantly • Scale from one or 2 VM’s to as many as traffic requires *and* back down again once traffic subsides.
  • 38. RAM RAM RAM • Most Rails apps are RAM bound way before they are CPU bound • Average mongrel size on 64bit EngineYard is 70-120Mb *per* mongrel. Slightly less on 32 bit systems • Rmagick and :include the worst culprits • 95% of Rails apps will leak memory at one point or another
  • 39. Rails eats Database resources for breakfast • Majority of app in the wild have *no* indexes in their databases • Learn when and where to apply indexes, it will save your ass • ActiveRecord insulates developers from SQL to the point of massive ineficiencies. Look at your logs and see what SQL is being generated. Do not fear the SQL and don’t think you can get away without some denormalization and custom SQL if you plan on your app having a chance of scaling
  • 40. Other tips & tricks • *Don’t* use filesystem sessions, AR or SQLSession or memcached if you don’t need persistance • script/runner is massively ineficient. Try as hard as possible to not load all of rails in your background processes. Use the raw Mysql library and plain ruby if you can and your servers will thank you for it • *Do not* use script runner to process incoming email. Run a daemon in a loop and poll a mail server with net/ pop2 or net/imap. Forking a whole rails process for each incoming email will never work in a production environment period
  • 41. Rails is great for the 80/20 rule • But you are on your own when you need the last 20% • Learn how to write custom mongrel handlers for perf critical sections of your app • When is optimization not premature? • Ruby is plenty fast, it’s rails that tends to be on the slow side • Cache, cache, cache. It doesnt get much faster then service cached static html files
  • 42. Parting Thought • Don’t take what I or anyone else says about this stuff as gospel • Test it and benchmark it for yourself to be sure • Trust but verify and you will stay in good shape