SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler offline
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?

Mais conteúdo relacionado

Mais procurados

Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Serverswebhostingguy
 
Reactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesReactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesStéphane Maldini
 
Scaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWSScaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWSBrett McLain
 
Building a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from YelpBuilding a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from YelpdotCloud
 
High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017Rick Hightower
 
Introduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStackIntroduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStackCraig Sebenik
 
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Erik Onnen
 
Reactive Micro Services with Java seminar
Reactive Micro Services with Java seminarReactive Micro Services with Java seminar
Reactive Micro Services with Java seminarGal Marder
 
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013Christopher Curtin
 
Caching 101: Caching on the JVM (and beyond)
Caching 101: Caching on the JVM (and beyond)Caching 101: Caching on the JVM (and beyond)
Caching 101: Caching on the JVM (and beyond)Louis Jacomet
 
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsJonas Bonér
 
NATS - A new nervous system for distributed cloud platforms
NATS - A new nervous system for distributed cloud platformsNATS - A new nervous system for distributed cloud platforms
NATS - A new nervous system for distributed cloud platformsDerek Collison
 
Developing with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaDeveloping with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaJoe Stein
 
High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014Derek Collison
 
Event Driven Architecture with Apache Camel
Event Driven Architecture with Apache CamelEvent Driven Architecture with Apache Camel
Event Driven Architecture with Apache Camelprajods
 

Mais procurados (15)

Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Servers
 
Reactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesReactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServices
 
Scaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWSScaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWS
 
Building a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from YelpBuilding a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from Yelp
 
High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017High-speed, Reactive Microservices 2017
High-speed, Reactive Microservices 2017
 
Introduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStackIntroduction to Systems Management with SaltStack
Introduction to Systems Management with SaltStack
 
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
 
Reactive Micro Services with Java seminar
Reactive Micro Services with Java seminarReactive Micro Services with Java seminar
Reactive Micro Services with Java seminar
 
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
 
Caching 101: Caching on the JVM (and beyond)
Caching 101: Caching on the JVM (and beyond)Caching 101: Caching on the JVM (and beyond)
Caching 101: Caching on the JVM (and beyond)
 
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
 
NATS - A new nervous system for distributed cloud platforms
NATS - A new nervous system for distributed cloud platformsNATS - A new nervous system for distributed cloud platforms
NATS - A new nervous system for distributed cloud platforms
 
Developing with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaDeveloping with the Go client for Apache Kafka
Developing with the Go client for Apache Kafka
 
High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014
 
Event Driven Architecture with Apache Camel
Event Driven Architecture with Apache CamelEvent Driven Architecture with Apache Camel
Event Driven Architecture with Apache Camel
 

Destaque

Asterisk presence-im-091015103222-phpapp02
Asterisk presence-im-091015103222-phpapp02Asterisk presence-im-091015103222-phpapp02
Asterisk presence-im-091015103222-phpapp02Newlink
 
UX Lessons from the USSR: The Trouble With Manifestos
UX Lessons from the USSR: The Trouble With ManifestosUX Lessons from the USSR: The Trouble With Manifestos
UX Lessons from the USSR: The Trouble With ManifestosMyplanet Digital
 
CH&Cie - Process Optimization - Teaser
CH&Cie - Process Optimization - TeaserCH&Cie - Process Optimization - Teaser
CH&Cie - Process Optimization - TeaserStéphanie Baruk
 
Sin eng-41 - jumble sale
Sin eng-41 - jumble saleSin eng-41 - jumble sale
Sin eng-41 - jumble salesochinaction
 
Sin eng-34 - treasure life eat healthy posters
Sin eng-34 - treasure life eat healthy postersSin eng-34 - treasure life eat healthy posters
Sin eng-34 - treasure life eat healthy posterssochinaction
 
Формула качественного контента: как быть востребованным везде?
Формула качественного контента: как быть востребованным везде?Формула качественного контента: как быть востребованным везде?
Формула качественного контента: как быть востребованным везде?web_kport
 
SharePoint Commerce Services
SharePoint Commerce ServicesSharePoint Commerce Services
SharePoint Commerce ServicesCredera
 
Sin eng-40 - cozy corner
Sin eng-40 - cozy cornerSin eng-40 - cozy corner
Sin eng-40 - cozy cornersochinaction
 
Sin eng-18 - kill of killer litter (annex)
Sin eng-18 - kill of killer litter (annex)Sin eng-18 - kill of killer litter (annex)
Sin eng-18 - kill of killer litter (annex)sochinaction
 
Catalysts for change: How philanthropists are forging new paths to long-lasti...
Catalysts for change: How philanthropists are forging new paths to long-lasti...Catalysts for change: How philanthropists are forging new paths to long-lasti...
Catalysts for change: How philanthropists are forging new paths to long-lasti...Scorpio Partnership
 
15 March Daily market report
15 March Daily market report 15 March Daily market report
15 March Daily market report QNB Group
 

Destaque (15)

Asterisk presence-im-091015103222-phpapp02
Asterisk presence-im-091015103222-phpapp02Asterisk presence-im-091015103222-phpapp02
Asterisk presence-im-091015103222-phpapp02
 
Nov 2
Nov 2Nov 2
Nov 2
 
UX Lessons from the USSR: The Trouble With Manifestos
UX Lessons from the USSR: The Trouble With ManifestosUX Lessons from the USSR: The Trouble With Manifestos
UX Lessons from the USSR: The Trouble With Manifestos
 
CH&Cie - Process Optimization - Teaser
CH&Cie - Process Optimization - TeaserCH&Cie - Process Optimization - Teaser
CH&Cie - Process Optimization - Teaser
 
Sin eng-41 - jumble sale
Sin eng-41 - jumble saleSin eng-41 - jumble sale
Sin eng-41 - jumble sale
 
Cassazione mastella
Cassazione mastellaCassazione mastella
Cassazione mastella
 
2011 EcoSmart Brochure
2011 EcoSmart Brochure2011 EcoSmart Brochure
2011 EcoSmart Brochure
 
Sin eng-34 - treasure life eat healthy posters
Sin eng-34 - treasure life eat healthy postersSin eng-34 - treasure life eat healthy posters
Sin eng-34 - treasure life eat healthy posters
 
Формула качественного контента: как быть востребованным везде?
Формула качественного контента: как быть востребованным везде?Формула качественного контента: как быть востребованным везде?
Формула качественного контента: как быть востребованным везде?
 
SharePoint Commerce Services
SharePoint Commerce ServicesSharePoint Commerce Services
SharePoint Commerce Services
 
Lamf brochure low_res-4
Lamf brochure low_res-4Lamf brochure low_res-4
Lamf brochure low_res-4
 
Sin eng-40 - cozy corner
Sin eng-40 - cozy cornerSin eng-40 - cozy corner
Sin eng-40 - cozy corner
 
Sin eng-18 - kill of killer litter (annex)
Sin eng-18 - kill of killer litter (annex)Sin eng-18 - kill of killer litter (annex)
Sin eng-18 - kill of killer litter (annex)
 
Catalysts for change: How philanthropists are forging new paths to long-lasti...
Catalysts for change: How philanthropists are forging new paths to long-lasti...Catalysts for change: How philanthropists are forging new paths to long-lasti...
Catalysts for change: How philanthropists are forging new paths to long-lasti...
 
15 March Daily market report
15 March Daily market report 15 March Daily market report
15 March Daily market report
 

Semelhante a Xen and-the-art-of-rails-deployment2640

Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_monTomas Doran
 
Midwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMidwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMathew Beane
 
Full stack development using javascript what and why - ajay chandravadiya
Full stack development using javascript   what and why - ajay chandravadiyaFull stack development using javascript   what and why - ajay chandravadiya
Full stack development using javascript what and why - ajay chandravadiyaajayrcgmail
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkTomas Doran
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceEvan McGee
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudyJohn Adams
 
Micro Services Architecture
Micro Services ArchitectureMicro Services Architecture
Micro Services ArchitectureRanjan Baisak
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance DrupalChapter Three
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pieTomas Doran
 
Realtime traffic analyser
Realtime traffic analyserRealtime traffic analyser
Realtime traffic analyserAlex Moskvin
 
MySQL Options in OpenStack
MySQL Options in OpenStackMySQL Options in OpenStack
MySQL Options in OpenStackTesora
 
Machine Learning With H2O vs SparkML
Machine Learning With H2O vs SparkMLMachine Learning With H2O vs SparkML
Machine Learning With H2O vs SparkMLArnab Biswas
 
OpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackOpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackMatt Lord
 
Sanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansSanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansPeter Clapham
 
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Bob Pusateri
 
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and HadoopEventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and HadoopAyon Sinha
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilitycherryhillco
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQLKonstantin Gredeskoul
 

Semelhante a Xen and-the-art-of-rails-deployment2640 (20)

webservers
webserverswebservers
webservers
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
 
Midwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMidwest PHP - Scaling Magento
Midwest PHP - Scaling Magento
 
Full stack development using javascript what and why - ajay chandravadiya
Full stack development using javascript   what and why - ajay chandravadiyaFull stack development using javascript   what and why - ajay chandravadiya
Full stack development using javascript what and why - ajay chandravadiya
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a Microservice
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Micro Services Architecture
Micro Services ArchitectureMicro Services Architecture
Micro Services Architecture
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance Drupal
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
 
Realtime traffic analyser
Realtime traffic analyserRealtime traffic analyser
Realtime traffic analyser
 
MySQL Options in OpenStack
MySQL Options in OpenStackMySQL Options in OpenStack
MySQL Options in OpenStack
 
Machine Learning With H2O vs SparkML
Machine Learning With H2O vs SparkMLMachine Learning With H2O vs SparkML
Machine Learning With H2O vs SparkML
 
OpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackOpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStack
 
Flexible compute
Flexible computeFlexible compute
Flexible compute
 
Sanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansSanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticians
 
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
 
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and HadoopEventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
Eventual Consistency @WalmartLabs with Kafka, Avro, SolrCloud and Hadoop
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalability
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 

Mais de Newlink

Businessmodelgenerationpreview 100125081253-phpapp01
Businessmodelgenerationpreview 100125081253-phpapp01Businessmodelgenerationpreview 100125081253-phpapp01
Businessmodelgenerationpreview 100125081253-phpapp01Newlink
 
Business model-design-and-innovation-for-competitive-advantage-19352
Business model-design-and-innovation-for-competitive-advantage-19352Business model-design-and-innovation-for-competitive-advantage-19352
Business model-design-and-innovation-for-competitive-advantage-19352Newlink
 
Thefutureofwork 091027180703-phpapp01
Thefutureofwork 091027180703-phpapp01Thefutureofwork 091027180703-phpapp01
Thefutureofwork 091027180703-phpapp01Newlink
 
2011 06-29- sp-seminar- cisco cdn solution-1
2011 06-29- sp-seminar- cisco cdn solution-12011 06-29- sp-seminar- cisco cdn solution-1
2011 06-29- sp-seminar- cisco cdn solution-1Newlink
 
Ciscounifiedservicedeliverylaunchmay2009final 090512004229-phpapp01
Ciscounifiedservicedeliverylaunchmay2009final 090512004229-phpapp01Ciscounifiedservicedeliverylaunchmay2009final 090512004229-phpapp01
Ciscounifiedservicedeliverylaunchmay2009final 090512004229-phpapp01Newlink
 
Virtualizationonibmbladecenter 1225792256455769-8
Virtualizationonibmbladecenter 1225792256455769-8Virtualizationonibmbladecenter 1225792256455769-8
Virtualizationonibmbladecenter 1225792256455769-8Newlink
 
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
 
Voicecon094distrfinal 090427125221-phpapp01
Voicecon094distrfinal 090427125221-phpapp01Voicecon094distrfinal 090427125221-phpapp01
Voicecon094distrfinal 090427125221-phpapp01Newlink
 
Thenewnetworkforthedatacenter 100519185534-phpapp02
Thenewnetworkforthedatacenter 100519185534-phpapp02Thenewnetworkforthedatacenter 100519185534-phpapp02
Thenewnetworkforthedatacenter 100519185534-phpapp02Newlink
 
Avaya sipwithinyourenterprise-090629022848-phpapp02
Avaya sipwithinyourenterprise-090629022848-phpapp02Avaya sipwithinyourenterprise-090629022848-phpapp02
Avaya sipwithinyourenterprise-090629022848-phpapp02Newlink
 
Curso de-asterisk-everano-2007-1204975330483842-4
Curso de-asterisk-everano-2007-1204975330483842-4Curso de-asterisk-everano-2007-1204975330483842-4
Curso de-asterisk-everano-2007-1204975330483842-4Newlink
 
Vnx series-technical-review-110616214632-phpapp02
Vnx series-technical-review-110616214632-phpapp02Vnx series-technical-review-110616214632-phpapp02
Vnx series-technical-review-110616214632-phpapp02Newlink
 
Imentorstevejobspdf 110826082634-phpapp02
Imentorstevejobspdf 110826082634-phpapp02Imentorstevejobspdf 110826082634-phpapp02
Imentorstevejobspdf 110826082634-phpapp02Newlink
 
Qcon 111122082620-phpapp02
Qcon 111122082620-phpapp02Qcon 111122082620-phpapp02
Qcon 111122082620-phpapp02Newlink
 
Awssummit2011nytimesfinal com-110610112751-phpapp01
Awssummit2011nytimesfinal com-110610112751-phpapp01Awssummit2011nytimesfinal com-110610112751-phpapp01
Awssummit2011nytimesfinal com-110610112751-phpapp01Newlink
 
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)Newlink
 
Apc 091016024613-phpapp01
Apc 091016024613-phpapp01Apc 091016024613-phpapp01
Apc 091016024613-phpapp01Newlink
 
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)Newlink
 
Video 111127013709-phpapp02
Video 111127013709-phpapp02Video 111127013709-phpapp02
Video 111127013709-phpapp02Newlink
 
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
 

Mais de Newlink (20)

Businessmodelgenerationpreview 100125081253-phpapp01
Businessmodelgenerationpreview 100125081253-phpapp01Businessmodelgenerationpreview 100125081253-phpapp01
Businessmodelgenerationpreview 100125081253-phpapp01
 
Business model-design-and-innovation-for-competitive-advantage-19352
Business model-design-and-innovation-for-competitive-advantage-19352Business model-design-and-innovation-for-competitive-advantage-19352
Business model-design-and-innovation-for-competitive-advantage-19352
 
Thefutureofwork 091027180703-phpapp01
Thefutureofwork 091027180703-phpapp01Thefutureofwork 091027180703-phpapp01
Thefutureofwork 091027180703-phpapp01
 
2011 06-29- sp-seminar- cisco cdn solution-1
2011 06-29- sp-seminar- cisco cdn solution-12011 06-29- sp-seminar- cisco cdn solution-1
2011 06-29- sp-seminar- cisco cdn solution-1
 
Ciscounifiedservicedeliverylaunchmay2009final 090512004229-phpapp01
Ciscounifiedservicedeliverylaunchmay2009final 090512004229-phpapp01Ciscounifiedservicedeliverylaunchmay2009final 090512004229-phpapp01
Ciscounifiedservicedeliverylaunchmay2009final 090512004229-phpapp01
 
Virtualizationonibmbladecenter 1225792256455769-8
Virtualizationonibmbladecenter 1225792256455769-8Virtualizationonibmbladecenter 1225792256455769-8
Virtualizationonibmbladecenter 1225792256455769-8
 
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
 
Voicecon094distrfinal 090427125221-phpapp01
Voicecon094distrfinal 090427125221-phpapp01Voicecon094distrfinal 090427125221-phpapp01
Voicecon094distrfinal 090427125221-phpapp01
 
Thenewnetworkforthedatacenter 100519185534-phpapp02
Thenewnetworkforthedatacenter 100519185534-phpapp02Thenewnetworkforthedatacenter 100519185534-phpapp02
Thenewnetworkforthedatacenter 100519185534-phpapp02
 
Avaya sipwithinyourenterprise-090629022848-phpapp02
Avaya sipwithinyourenterprise-090629022848-phpapp02Avaya sipwithinyourenterprise-090629022848-phpapp02
Avaya sipwithinyourenterprise-090629022848-phpapp02
 
Curso de-asterisk-everano-2007-1204975330483842-4
Curso de-asterisk-everano-2007-1204975330483842-4Curso de-asterisk-everano-2007-1204975330483842-4
Curso de-asterisk-everano-2007-1204975330483842-4
 
Vnx series-technical-review-110616214632-phpapp02
Vnx series-technical-review-110616214632-phpapp02Vnx series-technical-review-110616214632-phpapp02
Vnx series-technical-review-110616214632-phpapp02
 
Imentorstevejobspdf 110826082634-phpapp02
Imentorstevejobspdf 110826082634-phpapp02Imentorstevejobspdf 110826082634-phpapp02
Imentorstevejobspdf 110826082634-phpapp02
 
Qcon 111122082620-phpapp02
Qcon 111122082620-phpapp02Qcon 111122082620-phpapp02
Qcon 111122082620-phpapp02
 
Awssummit2011nytimesfinal com-110610112751-phpapp01
Awssummit2011nytimesfinal com-110610112751-phpapp01Awssummit2011nytimesfinal com-110610112751-phpapp01
Awssummit2011nytimesfinal com-110610112751-phpapp01
 
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
 
Apc 091016024613-phpapp01
Apc 091016024613-phpapp01Apc 091016024613-phpapp01
Apc 091016024613-phpapp01
 
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
Thenewnetworkforthedatacenter 100519185534-phpapp02 (1)
 
Video 111127013709-phpapp02
Video 111127013709-phpapp02Video 111127013709-phpapp02
Video 111127013709-phpapp02
 
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
 

Último

Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Último (20)

Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
How Tech Giants Cut Corners to Harvest Data for A.I.
How Tech Giants Cut Corners to Harvest Data for A.I.How Tech Giants Cut Corners to Harvest Data for A.I.
How Tech Giants Cut Corners to Harvest Data for A.I.
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

Xen and-the-art-of-rails-deployment2640

  • 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!
  • 29. The Zen of Xen
  • 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