SlideShare a Scribd company logo
Large platform
architecture in (mostly)
  perl - an illustrated
          tour
         Tomas (t0m) Doran
         SĆ£o Paulo.pm perl workshop 2010
         YAPC::EU Pisa 2010
This talk

ā€¢ Is mostly a ramble
ā€¢ About what I do for a living
ā€¢ Good bits
ā€¢ and bad bits (probably mostly bad bits)
ā€¢ And when I say ā€˜illustratedā€™, Iā€™m not very
  good at diagrams, sorry...
Making money from
  independent music

ā€¢ IMPOSSIBLE
ā€¢ No, no it isnā€™t. But weā€™re very lucky to have
  people who know the music industry
ā€¢ A startup would tank
ā€¢ Last.fm guys ā€œkeep losing less moneyā€
The state51 conspiracy
Consolidated Independent
 Media Service Provider
 ā€¢ Several (largely proļ¬table) businesses based
   on the same technology platform
 ā€¢ East London (Brick Lane), a warehouse.
 ā€¢ > 60% of UK independent content goes
   through us somewhere
Being S3 on the cheap
ā€¢ WAV ļ¬les are big.Videos are bigger.
ā€¢ Transcodes arenā€™t small, especially when
  you have 15 of them.
ā€¢ My music collection is several   hundred
  terrabytes
ā€¢ Need to be able to serve this stuff fast and
  concurrently.
MogileFS

ā€¢ Is free.
ā€¢ Runs on cheap hardware
ā€¢ Cheaper then S3.
ā€¢ Not so awesome if you arenā€™t Livejournal
Data center design
ā€¢ 8 amp racks. Seriously, WTF!?!?!
ā€¢ Electricity is more expensive than servers,
  ergo rolling hardware upgrades trivially pay
  for themselves.
ā€¢ Transit is really, really expensive.
ā€¢ Worth buying ļ¬ber to other locations to
  peer if you need lots of bandwidth.
Platform overview
           <VIP>                                  <VIP>                             <VIP>

           Varnish                                Varnish                           Varnish


ESI:                                 ESI:                              ESI:

                       nginx                                  nginx                             nginx
       Apache        + mogile               Apache          + mogile          Apache          + mogile
                     + custom                               + custom                          + custom



       FCGI          FCGI ļƒžle                  FCGI         FCGI ļƒžle          FCGI            FCGI ļƒžle
       apps            auth                    apps           auth            apps              auth




                                                      Also: Encoding (bare metal)
                                                          Encoding (VMWare)
                                                        Encoding SOAP service
                                                              Memcached
                                                             Mogile Tracker

                                                      Storage
                Replication                            StorageStorage
                                                         StorageStorageStorage
  MySQL                          MySQL                     StorageStorageStorage
                                                            StorageStorageStorage
 Object store                   Object store                  StorageStorageStorage
   Master                         Slave                         StorageStorageStorage
                                                                 StorageStorageStorage
                                                                   StorageStorageStorage
                                                                     StorageStorageStorage
                                                                      StorageStorageStorage
                                                                        StorageStorageStorage
                                                                                 StorageStorage
                                                                                         Storage
Web architecture
ā€¢ App servers apache, apps FastCGI, port 81
ā€¢ Varnish + ESI, caching, port 80
ā€¢ 1 varnish per host, talks to all the apaches
ā€¢ 1 VIP per host
ā€¢ Host fail:VIP transfer
ā€¢ Apache/app fail (or overload), varnish
  rebalances/retries.
Web architecture (cont)

ā€¢ Varnish doesnā€™t cache media, just provides
  failover.
ā€¢ nginx sends the hit to FastCGI app.
ā€¢ Returns X-Accel-Redirect.
ā€¢ nginx talks to MogileFS, handles delivery.
<VIP>                                  <VIP>                             <VIP>

           Varnish                                Varnish                           Varnish


ESI:                                 ESI:                              ESI:

                       nginx                                  nginx                             nginx
       Apache        + mogile               Apache          + mogile          Apache          + mogile
                     + custom                               + custom                          + custom



       FCGI          FCGI ļƒžle                  FCGI         FCGI ļƒžle          FCGI            FCGI ļƒžle
       apps            auth                    apps           auth            apps              auth




                                                      Also: Encoding (bare metal)
                                                          Encoding (VMWare)
                                                        Encoding SOAP service
                                                              Memcached
                                                             Mogile Tracker

                                                      Storage
                Replication                            StorageStorage
                                                         StorageStorageStorage
  MySQL                          MySQL                     StorageStorageStorage
                                                            StorageStorageStorage
 Object store                   Object store                  StorageStorageStorage
   Master                         Slave                         StorageStorageStorage
                                                                 StorageStorageStorage
                                                                   StorageStorageStorage
                                                                     StorageStorageStorage
                                                                      StorageStorageStorage
                                                                        StorageStorageStorage
                                                                                 StorageStorage
                                                                                         Storage
Storage architecture
ā€¢ Lots of boxes with lots of disk.
ā€¢ Many additional roles to storage. (Mogile
  tracker, memcache node, metal encoding,
  VMWare, SOAP Service)
ā€¢ Not all the boxes do all the roles.
ā€¢ All the roles can safely fall over and die.
ā€¢ Which is good, as they do. Or the box falls
  over. Or a, then b.
<VIP>                                  <VIP>                             <VIP>

           Varnish                                Varnish                           Varnish


ESI:                                 ESI:                              ESI:

                       nginx                                  nginx                             nginx
       Apache        + mogile               Apache          + mogile          Apache          + mogile
                     + custom                               + custom                          + custom



       FCGI          FCGI ļƒžle                  FCGI         FCGI ļƒžle          FCGI            FCGI ļƒžle
       apps            auth                    apps           auth            apps              auth




                                                      Also: Encoding (bare metal)
                                                          Encoding (VMWare)
                                                        Encoding SOAP service
                                                              Memcached
                                                             Mogile Tracker

                                                      Storage
                Replication                            StorageStorage
                                                         StorageStorageStorage
  MySQL                          MySQL                     StorageStorageStorage
                                                            StorageStorageStorage
 Object store                   Object store                  StorageStorageStorage
   Master                         Slave                         StorageStorageStorage
                                                                 StorageStorageStorage
                                                                   StorageStorageStorage
                                                                     StorageStorageStorage
                                                                      StorageStorageStorage
                                                                        StorageStorageStorage
                                                                                 StorageStorage
                                                                                         Storage
WAV ļ¬les

ā€¢ WAV is a container format.
ā€¢ Loosely deļ¬ned.
ā€¢ You can stuff XML documents in WAV ļ¬les
ā€¢ Some encoders (oh hai ļ¬‚ac) very picky.
ā€¢ ā€˜dirtyā€™ and ā€˜cleanā€™ WAV ļ¬les.
Transcoding everything


ā€¢ Lots of different formats
ā€¢ WMA - GNARGGH%$@*&!!
Win32

ā€¢ Weā€™re running ActiveState for hysterical
  raisins.
ā€¢ No XS modules
ā€¢ Thin as possible
Encoding
HTTP Nodes
 HTTP Nodes
  HTTP Nodes           Encoding Service        Uploading Service




    GET
     &
    PUT
                                       SOAP
                                                                    media
                   Encoder



     Downloader                  Uploader

                                                                   Win32 &
      Local Disk             Encoder
                              (mp3)
                                          Encoder
                                           (wma)                    Unix
Snakes On A Plane

ā€¢ SOAP actually works ok here, as we
  control both ends.
ā€¢ Old version of SOAP::Lite
ā€¢ Wouldnā€™t recommend interoperating
Logging
ā€¢ Used to be terribly hard to debug
ā€¢ Push logs into syslog
ā€¢ Aggregate in splunk - time correlated from
  encoding machines, web service machines,
  etc.
ā€¢ Much easier to work out what happened.
Hardware is shit

ā€¢ When you have several 100 Tb, undetected
  bit error rate of magnetic media is actually
  signiļ¬cant.
ā€¢ See also networks, memory, etc.
Things will always fail

ā€¢ If you need reliability, you have to design it
  in from the start.
ā€¢ Not only will you have (a lot of) hardware
  failures, all the software will break in
  unexpected ways. Lets not talk about
  netotworks..
ā€¢ Maybe you donā€™t need this..
Queueing

ā€¢ We have work queues of different types of
  media (e.g. mp3/wma/aac etc)
ā€¢ In the database.
ā€¢ Donā€™t do this.
MySQL sucks

ā€¢ 1 type of JOIN
ā€¢ No query rewriting
ā€¢ Not enough stats for the planner to be
  sane
This can hurt
ā€¢ File Transform table:
 ā€¢ Master (File)
 ā€¢ Result (File)
 ā€¢ Status (pending/complete/failed/running)
 ā€¢ TransformStep (from/to)
ā€¢ Leads to bad join order, massive fail
MySQL sucks

       FAIL
How to fail
ā€¢ SELECT all ļ¬le transforms that lead to wma
  (millions).
ā€¢ JOIN all ļ¬les, ever (millions). Filter to ļ¬nd
  those in state ā€˜pendingā€™
ā€¢ All pending looks like a bad bet - cardinality
  of ā€˜all wmasā€™ looks better than cardinality of
  ā€˜all pendingā€™.
ā€¢ JOIN in the wrong order, nested loop,
  screwed..
Queueing
ā€¢ Did I mention queues in the DB suck?
ā€¢ Even if youā€™re not screwing it up.
ā€¢ Get a Message Queue (or at least an async
  job server)
ā€¢ If your problem is simple - Gearman.
  Harder or you need interop - RabbitMQ.
Mutable state

ā€¢ Mutable state is the enemy
ā€¢ Too many things rw.
ā€¢ No idea how an object got to this state
Anemic domain model
  Object-oriented programming (OOP) is a
 programming paradigm that uses "objects" ā€“
 data structures consisting of data ļ¬elds and
      methods together with their
 interactions ā€“ to design applications and
computer programs. Programming techniques
     may include features such as data
abstraction, encapsulation, modularity,
       polymorphism, and inheritance.
Anemic domain model
ā€¢ Superset of too much mutable state
ā€¢ Able to create invalid objects
ā€¢ Able to make previously valid objects
  invalid
ā€¢ Violation of the encapsulation and
  information hiding principles.
scripts

ā€¢ Lots of our business logic was in scripts
  that manipulated objects
ā€¢ You need people to run scripts (in screen
  sessions)
ā€¢ Ewwww, ewwwww.
Jobs
ā€¢ Moved to a job based approach
ā€¢ Jobs started by ļ¬le creation, or changing
  state of something in a web app
ā€¢ Jobs sent via message queuing.
ā€¢ Results go via message queueing
ā€¢ Jobs trigger other jobs
Jobs Example
ā€¢ Validate XLS ļ¬le supplied with order.
ā€¢ Valid ļ¬les trigger another job to create
  objects for each thing in the XLS
ā€¢ This then triggers another job to create
  transforms, which are then done...
ā€¢ ... etc ...
ā€¢ Canā€™t do this workļ¬‚ow in a web request.
Jobs Future

ā€¢ More automation of things people run
  scripts for.
ā€¢ Automatic job regeneration (you will lose
  messages).
Lava ļ¬‚ow

ā€¢ Old (possibly unclean/invalid) data
ā€¢ Old (unused/unmaintained) code
ā€¢ ā€œWhat harm does it doā€
Relational integrity

ā€¢ Seems to be a pipe dream more often then
  not in the real world.
ā€¢ Why?
ā€¢ Itā€™s not hard
Data consistency


ā€¢ This should theoretically be the same thing
  as relational integrity.
ā€¢ In practice...
Mumble View Crap

ā€¢ Too much logic in templates
ā€¢ Copy & paste
ā€¢ Business objects viewed as unchangeable
ā€¢ Deleted 3000 lines from 2 simple
  workļ¬‚ows. This ļ¬xed a dozen bugs.
Tangram
ā€¢ No LEFT JOIN
ā€¢ Displaying a product list becomes an x n
  problem.
ā€¢ OUCH
ā€¢ Keep stupid - put the entire DB hot in
  memcache!
Donā€™t do web design

ā€¢ You are a programmer
ā€¢ Make people pay for a design/CSS/HTML
  person
ā€¢ Work with them
ā€¢ Be happy
Love your sysadmins
ā€¢ Help them out.
ā€¢ Build packages, or local::libs or something
ā€¢ Keep everything in revision control
ā€¢ Allow things to be sensibly conļ¬gured.
ā€¢ DOCUMENT THE POSSIBLE SETTINGS
ā€¢ Use systems management - Puppet?
Love your logs

ā€¢ Active feedback
ā€¢ Aggregate in splunk
ā€¢ Actively prune useless stuff
ā€¢ Actively add useful stuff after a production
  incident
ESI

ā€¢ Is really awesome
ā€¢ Make the pain go away
ā€¢ PURGE requests
ā€¢ Keep everything hot all the time
memcache everything

ā€¢ Keep the entire database hot in memcache
ā€¢ We mostly ask trivial questions, so just
  cache those paths.
ā€¢ 30 Gb of RAM isnā€™t actually much (3
  boxes..)
memcache
ā€¢ IS A CACHE
ā€¢ Use sequential port numbers and CNAMES
ā€¢ E.g. cache0:11210, cache1:11211,
  cache2:11212 etc..
ā€¢ Run several per machine
ā€¢ Allows you to scale capacity and rebalance
  without entire cache ļ¬‚ush.
Donā€™t push bytes

ā€¢ X-Sendļ¬le and X-Accel-Redirect
ā€¢ I already talked about ļ¬le delivery like this
ā€¢ Using 100Mb of RAM to proxy web
  requests does not scale.
Test everything

ā€¢ Redundant systems need testing
ā€¢ Youā€™ll still die unexpectedly in production
ā€¢ If you can manage it, make responsibility for
  deployment SEP.
ā€¢ Thanks for listening
ā€¢ Questions?

More Related Content

Similar to Large platform architecture in (mostly) perl

The Hitchhikers Guide to client Side Persistent Storage
The Hitchhikers Guide to client Side Persistent StorageThe Hitchhikers Guide to client Side Persistent Storage
The Hitchhikers Guide to client Side Persistent Storage
Jens Arps
Ā 
Networking Israeli Day 2013 - Hecatonchire: Transparent Memory Aggregation
Networking Israeli Day 2013 - Hecatonchire: Transparent Memory AggregationNetworking Israeli Day 2013 - Hecatonchire: Transparent Memory Aggregation
Networking Israeli Day 2013 - Hecatonchire: Transparent Memory Aggregationaidanshribman
Ā 
EC2ćØVarnish恧ē”»åƒé…äæ”
EC2ćØVarnish恧ē”»åƒé…äæ”EC2ćØVarnish恧ē”»åƒé…äæ”
EC2ćØVarnish恧ē”»åƒé…äæ”
Issei Naruta
Ā 
PHP in the Cloud
PHP in the CloudPHP in the Cloud
PHP in the Cloud
Acquia
Ā 
Polyglot OSGi
Polyglot OSGiPolyglot OSGi
Polyglot OSGiMatt Stine
Ā 
Oracle+golden+gate+introduction
Oracle+golden+gate+introductionOracle+golden+gate+introduction
Oracle+golden+gate+introduction
xiakaicd
Ā 
Magento Imagine 2013: Fabrizio Branca - Learning To Fly: How Angry Birds Reac...
Magento Imagine 2013: Fabrizio Branca - Learning To Fly: How Angry Birds Reac...Magento Imagine 2013: Fabrizio Branca - Learning To Fly: How Angry Birds Reac...
Magento Imagine 2013: Fabrizio Branca - Learning To Fly: How Angry Birds Reac...AOE
Ā 
Meandre 2.0 Alpha Preview
Meandre 2.0 Alpha PreviewMeandre 2.0 Alpha Preview
Meandre 2.0 Alpha Preview
Xavier LlorĆ 
Ā 
Asyncifying WebAssembly for the modern Web
Asyncifying WebAssembly for the modern WebAsyncifying WebAssembly for the modern Web
Asyncifying WebAssembly for the modern Web
Ingvar Stepanyan
Ā 
Offline first, the painless way
Offline first, the painless wayOffline first, the painless way
Offline first, the painless way
Marcel Kalveram
Ā 
Bangalore cloudstack user group
Bangalore cloudstack user groupBangalore cloudstack user group
Bangalore cloudstack user group
ShapeBlue
Ā 
On Failure and Resilience
On Failure and ResilienceOn Failure and Resilience
On Failure and ResilienceMike Brittain
Ā 
Building Content Applications with JCR and OSGi
Building Content Applications with JCR and OSGiBuilding Content Applications with JCR and OSGi
Building Content Applications with JCR and OSGi
CĆ©dric HĆ¼sler
Ā 
Managing large and distributed Eclipse server applications.
Managing large and distributed Eclipse server applications.Managing large and distributed Eclipse server applications.
Managing large and distributed Eclipse server applications.
Gunnar Wagenknecht
Ā 
Tales from the OSGi trenches
Tales from the OSGi trenchesTales from the OSGi trenches
Tales from the OSGi trenches
Bertrand Delacretaz
Ā 
OSGi for mere mortals
OSGi for mere mortalsOSGi for mere mortals
OSGi for mere mortals
Bertrand Delacretaz
Ā 
Sharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Sharded By Business Line: Migrating to a Core Database using MongoDB and SolrSharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Sharded By Business Line: Migrating to a Core Database using MongoDB and SolrMongoDB
Ā 
Mongo la search platform - january 2013
Mongo la   search platform - january 2013Mongo la   search platform - january 2013
Mongo la search platform - january 2013MongoDB
Ā 
tofu - COOKPAD's image system
tofu - COOKPAD's image systemtofu - COOKPAD's image system
tofu - COOKPAD's image system
Issei Naruta
Ā 
ꖙē†ć‚’ę„½ć—ćć™ć‚‹ē”»åƒé…äæ”ć‚·ć‚¹ćƒ†ćƒ 
ꖙē†ć‚’ę„½ć—ćć™ć‚‹ē”»åƒé…äæ”ć‚·ć‚¹ćƒ†ćƒ ę–™ē†ć‚’ę„½ć—ćć™ć‚‹ē”»åƒé…äæ”ć‚·ć‚¹ćƒ†ćƒ 
ꖙē†ć‚’ę„½ć—ćć™ć‚‹ē”»åƒé…äæ”ć‚·ć‚¹ćƒ†ćƒ 
Issei Naruta
Ā 

Similar to Large platform architecture in (mostly) perl (20)

The Hitchhikers Guide to client Side Persistent Storage
The Hitchhikers Guide to client Side Persistent StorageThe Hitchhikers Guide to client Side Persistent Storage
The Hitchhikers Guide to client Side Persistent Storage
Ā 
Networking Israeli Day 2013 - Hecatonchire: Transparent Memory Aggregation
Networking Israeli Day 2013 - Hecatonchire: Transparent Memory AggregationNetworking Israeli Day 2013 - Hecatonchire: Transparent Memory Aggregation
Networking Israeli Day 2013 - Hecatonchire: Transparent Memory Aggregation
Ā 
EC2ćØVarnish恧ē”»åƒé…äæ”
EC2ćØVarnish恧ē”»åƒé…äæ”EC2ćØVarnish恧ē”»åƒé…äæ”
EC2ćØVarnish恧ē”»åƒé…äæ”
Ā 
PHP in the Cloud
PHP in the CloudPHP in the Cloud
PHP in the Cloud
Ā 
Polyglot OSGi
Polyglot OSGiPolyglot OSGi
Polyglot OSGi
Ā 
Oracle+golden+gate+introduction
Oracle+golden+gate+introductionOracle+golden+gate+introduction
Oracle+golden+gate+introduction
Ā 
Magento Imagine 2013: Fabrizio Branca - Learning To Fly: How Angry Birds Reac...
Magento Imagine 2013: Fabrizio Branca - Learning To Fly: How Angry Birds Reac...Magento Imagine 2013: Fabrizio Branca - Learning To Fly: How Angry Birds Reac...
Magento Imagine 2013: Fabrizio Branca - Learning To Fly: How Angry Birds Reac...
Ā 
Meandre 2.0 Alpha Preview
Meandre 2.0 Alpha PreviewMeandre 2.0 Alpha Preview
Meandre 2.0 Alpha Preview
Ā 
Asyncifying WebAssembly for the modern Web
Asyncifying WebAssembly for the modern WebAsyncifying WebAssembly for the modern Web
Asyncifying WebAssembly for the modern Web
Ā 
Offline first, the painless way
Offline first, the painless wayOffline first, the painless way
Offline first, the painless way
Ā 
Bangalore cloudstack user group
Bangalore cloudstack user groupBangalore cloudstack user group
Bangalore cloudstack user group
Ā 
On Failure and Resilience
On Failure and ResilienceOn Failure and Resilience
On Failure and Resilience
Ā 
Building Content Applications with JCR and OSGi
Building Content Applications with JCR and OSGiBuilding Content Applications with JCR and OSGi
Building Content Applications with JCR and OSGi
Ā 
Managing large and distributed Eclipse server applications.
Managing large and distributed Eclipse server applications.Managing large and distributed Eclipse server applications.
Managing large and distributed Eclipse server applications.
Ā 
Tales from the OSGi trenches
Tales from the OSGi trenchesTales from the OSGi trenches
Tales from the OSGi trenches
Ā 
OSGi for mere mortals
OSGi for mere mortalsOSGi for mere mortals
OSGi for mere mortals
Ā 
Sharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Sharded By Business Line: Migrating to a Core Database using MongoDB and SolrSharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Sharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Ā 
Mongo la search platform - january 2013
Mongo la   search platform - january 2013Mongo la   search platform - january 2013
Mongo la search platform - january 2013
Ā 
tofu - COOKPAD's image system
tofu - COOKPAD's image systemtofu - COOKPAD's image system
tofu - COOKPAD's image system
Ā 
ꖙē†ć‚’ę„½ć—ćć™ć‚‹ē”»åƒé…äæ”ć‚·ć‚¹ćƒ†ćƒ 
ꖙē†ć‚’ę„½ć—ćć™ć‚‹ē”»åƒé…äæ”ć‚·ć‚¹ćƒ†ćƒ ę–™ē†ć‚’ę„½ć—ćć™ć‚‹ē”»åƒé…äæ”ć‚·ć‚¹ćƒ†ćƒ 
ꖙē†ć‚’ę„½ć—ćć™ć‚‹ē”»åƒé…äæ”ć‚·ć‚¹ćƒ†ćƒ 
Ā 

More from Tomas Doran

Dockersh and a brief intro to the docker internals
Dockersh and a brief intro to the docker internalsDockersh and a brief intro to the docker internals
Dockersh and a brief intro to the docker internals
Tomas Doran
Ā 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014
Tomas Doran
Ā 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
Tomas Doran
Ā 
Building a smarter application stack - service discovery and wiring for Docker
Building a smarter application stack - service discovery and wiring for DockerBuilding a smarter application stack - service discovery and wiring for Docker
Building a smarter application stack - service discovery and wiring for Docker
Tomas Doran
Ā 
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Tomas Doran
Ā 
Deploying puppet code at light speed
Deploying puppet code at light speedDeploying puppet code at light speed
Deploying puppet code at light speed
Tomas Doran
Ā 
Thinking through puppet code layout
Thinking through puppet code layoutThinking through puppet code layout
Thinking through puppet code layout
Tomas Doran
Ā 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
Tomas Doran
Ā 
"The worst code I ever wrote"
"The worst code I ever wrote""The worst code I ever wrote"
"The worst code I ever wrote"
Tomas Doran
Ā 
Test driven infrastructure development (2 - puppetconf 2013 edition)
Test driven infrastructure development (2 - puppetconf 2013 edition)Test driven infrastructure development (2 - puppetconf 2013 edition)
Test driven infrastructure development (2 - puppetconf 2013 edition)Tomas Doran
Ā 
Test driven infrastructure development
Test driven infrastructure developmentTest driven infrastructure development
Test driven infrastructure development
Tomas Doran
Ā 
London devops - orc
London devops - orcLondon devops - orc
London devops - orc
Tomas Doran
Ā 
London devops logging
London devops loggingLondon devops logging
London devops loggingTomas Doran
Ā 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012Tomas Doran
Ā 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testingTomas Doran
Ā 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testingTomas Doran
Ā 
Dates aghhhh!!?!?!?!
Dates aghhhh!!?!?!?!Dates aghhhh!!?!?!?!
Dates aghhhh!!?!?!?!
Tomas Doran
Ā 
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
Tomas Doran
Ā 
Zero mq logs
Zero mq logsZero mq logs
Zero mq logsTomas Doran
Ā 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pieTomas Doran
Ā 

More from Tomas Doran (20)

Dockersh and a brief intro to the docker internals
Dockersh and a brief intro to the docker internalsDockersh and a brief intro to the docker internals
Dockersh and a brief intro to the docker internals
Ā 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014
Ā 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
Ā 
Building a smarter application stack - service discovery and wiring for Docker
Building a smarter application stack - service discovery and wiring for DockerBuilding a smarter application stack - service discovery and wiring for Docker
Building a smarter application stack - service discovery and wiring for Docker
Ā 
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Ā 
Deploying puppet code at light speed
Deploying puppet code at light speedDeploying puppet code at light speed
Deploying puppet code at light speed
Ā 
Thinking through puppet code layout
Thinking through puppet code layoutThinking through puppet code layout
Thinking through puppet code layout
Ā 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
Ā 
"The worst code I ever wrote"
"The worst code I ever wrote""The worst code I ever wrote"
"The worst code I ever wrote"
Ā 
Test driven infrastructure development (2 - puppetconf 2013 edition)
Test driven infrastructure development (2 - puppetconf 2013 edition)Test driven infrastructure development (2 - puppetconf 2013 edition)
Test driven infrastructure development (2 - puppetconf 2013 edition)
Ā 
Test driven infrastructure development
Test driven infrastructure developmentTest driven infrastructure development
Test driven infrastructure development
Ā 
London devops - orc
London devops - orcLondon devops - orc
London devops - orc
Ā 
London devops logging
London devops loggingLondon devops logging
London devops logging
Ā 
Message:Passing - lpw 2012
Message:Passing - lpw 2012Message:Passing - lpw 2012
Message:Passing - lpw 2012
Ā 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
Ā 
Webapp security testing
Webapp security testingWebapp security testing
Webapp security testing
Ā 
Dates aghhhh!!?!?!?!
Dates aghhhh!!?!?!?!Dates aghhhh!!?!?!?!
Dates aghhhh!!?!?!?!
Ā 
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
Ā 
Zero mq logs
Zero mq logsZero mq logs
Zero mq logs
Ā 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
Ā 

Recently uploaded

ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
Ā 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
Ā 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
Ā 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
Ā 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
Ā 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
Ā 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
Ā 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
Ā 
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
UiPathCommunity
Ā 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
Ā 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
Ā 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
Ā 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
Ā 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
Ā 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
Ā 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
Ā 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
Ā 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
Ā 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
Ā 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
Ā 

Recently uploaded (20)

ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
Ā 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Ā 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Ā 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Ā 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
Ā 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Ā 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Ā 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Ā 
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder ā€“ active learning and UiPath LLMs for do...
Ā 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Ā 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ā 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Ā 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Ā 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Ā 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Ā 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Ā 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Ā 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Ā 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
Ā 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Ā 

Large platform architecture in (mostly) perl

  • 1. Large platform architecture in (mostly) perl - an illustrated tour Tomas (t0m) Doran SĆ£o Paulo.pm perl workshop 2010 YAPC::EU Pisa 2010
  • 2. This talk ā€¢ Is mostly a ramble ā€¢ About what I do for a living ā€¢ Good bits ā€¢ and bad bits (probably mostly bad bits) ā€¢ And when I say ā€˜illustratedā€™, Iā€™m not very good at diagrams, sorry...
  • 3. Making money from independent music ā€¢ IMPOSSIBLE ā€¢ No, no it isnā€™t. But weā€™re very lucky to have people who know the music industry ā€¢ A startup would tank ā€¢ Last.fm guys ā€œkeep losing less moneyā€
  • 4. The state51 conspiracy Consolidated Independent Media Service Provider ā€¢ Several (largely proļ¬table) businesses based on the same technology platform ā€¢ East London (Brick Lane), a warehouse. ā€¢ > 60% of UK independent content goes through us somewhere
  • 5. Being S3 on the cheap ā€¢ WAV ļ¬les are big.Videos are bigger. ā€¢ Transcodes arenā€™t small, especially when you have 15 of them. ā€¢ My music collection is several hundred terrabytes ā€¢ Need to be able to serve this stuff fast and concurrently.
  • 6. MogileFS ā€¢ Is free. ā€¢ Runs on cheap hardware ā€¢ Cheaper then S3. ā€¢ Not so awesome if you arenā€™t Livejournal
  • 7. Data center design ā€¢ 8 amp racks. Seriously, WTF!?!?! ā€¢ Electricity is more expensive than servers, ergo rolling hardware upgrades trivially pay for themselves. ā€¢ Transit is really, really expensive. ā€¢ Worth buying ļ¬ber to other locations to peer if you need lots of bandwidth.
  • 8. Platform overview <VIP> <VIP> <VIP> Varnish Varnish Varnish ESI: ESI: ESI: nginx nginx nginx Apache + mogile Apache + mogile Apache + mogile + custom + custom + custom FCGI FCGI ļƒžle FCGI FCGI ļƒžle FCGI FCGI ļƒžle apps auth apps auth apps auth Also: Encoding (bare metal) Encoding (VMWare) Encoding SOAP service Memcached Mogile Tracker Storage Replication StorageStorage StorageStorageStorage MySQL MySQL StorageStorageStorage StorageStorageStorage Object store Object store StorageStorageStorage Master Slave StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorage Storage
  • 9. Web architecture ā€¢ App servers apache, apps FastCGI, port 81 ā€¢ Varnish + ESI, caching, port 80 ā€¢ 1 varnish per host, talks to all the apaches ā€¢ 1 VIP per host ā€¢ Host fail:VIP transfer ā€¢ Apache/app fail (or overload), varnish rebalances/retries.
  • 10. Web architecture (cont) ā€¢ Varnish doesnā€™t cache media, just provides failover. ā€¢ nginx sends the hit to FastCGI app. ā€¢ Returns X-Accel-Redirect. ā€¢ nginx talks to MogileFS, handles delivery.
  • 11. <VIP> <VIP> <VIP> Varnish Varnish Varnish ESI: ESI: ESI: nginx nginx nginx Apache + mogile Apache + mogile Apache + mogile + custom + custom + custom FCGI FCGI ļƒžle FCGI FCGI ļƒžle FCGI FCGI ļƒžle apps auth apps auth apps auth Also: Encoding (bare metal) Encoding (VMWare) Encoding SOAP service Memcached Mogile Tracker Storage Replication StorageStorage StorageStorageStorage MySQL MySQL StorageStorageStorage StorageStorageStorage Object store Object store StorageStorageStorage Master Slave StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorage Storage
  • 12. Storage architecture ā€¢ Lots of boxes with lots of disk. ā€¢ Many additional roles to storage. (Mogile tracker, memcache node, metal encoding, VMWare, SOAP Service) ā€¢ Not all the boxes do all the roles. ā€¢ All the roles can safely fall over and die. ā€¢ Which is good, as they do. Or the box falls over. Or a, then b.
  • 13. <VIP> <VIP> <VIP> Varnish Varnish Varnish ESI: ESI: ESI: nginx nginx nginx Apache + mogile Apache + mogile Apache + mogile + custom + custom + custom FCGI FCGI ļƒžle FCGI FCGI ļƒžle FCGI FCGI ļƒžle apps auth apps auth apps auth Also: Encoding (bare metal) Encoding (VMWare) Encoding SOAP service Memcached Mogile Tracker Storage Replication StorageStorage StorageStorageStorage MySQL MySQL StorageStorageStorage StorageStorageStorage Object store Object store StorageStorageStorage Master Slave StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorageStorage StorageStorage Storage
  • 14. WAV ļ¬les ā€¢ WAV is a container format. ā€¢ Loosely deļ¬ned. ā€¢ You can stuff XML documents in WAV ļ¬les ā€¢ Some encoders (oh hai ļ¬‚ac) very picky. ā€¢ ā€˜dirtyā€™ and ā€˜cleanā€™ WAV ļ¬les.
  • 15. Transcoding everything ā€¢ Lots of different formats ā€¢ WMA - GNARGGH%$@*&!!
  • 16. Win32 ā€¢ Weā€™re running ActiveState for hysterical raisins. ā€¢ No XS modules ā€¢ Thin as possible
  • 17. Encoding HTTP Nodes HTTP Nodes HTTP Nodes Encoding Service Uploading Service GET & PUT SOAP media Encoder Downloader Uploader Win32 & Local Disk Encoder (mp3) Encoder (wma) Unix
  • 18. Snakes On A Plane ā€¢ SOAP actually works ok here, as we control both ends. ā€¢ Old version of SOAP::Lite ā€¢ Wouldnā€™t recommend interoperating
  • 19. Logging ā€¢ Used to be terribly hard to debug ā€¢ Push logs into syslog ā€¢ Aggregate in splunk - time correlated from encoding machines, web service machines, etc. ā€¢ Much easier to work out what happened.
  • 20. Hardware is shit ā€¢ When you have several 100 Tb, undetected bit error rate of magnetic media is actually signiļ¬cant. ā€¢ See also networks, memory, etc.
  • 21. Things will always fail ā€¢ If you need reliability, you have to design it in from the start. ā€¢ Not only will you have (a lot of) hardware failures, all the software will break in unexpected ways. Lets not talk about netotworks.. ā€¢ Maybe you donā€™t need this..
  • 22. Queueing ā€¢ We have work queues of different types of media (e.g. mp3/wma/aac etc) ā€¢ In the database. ā€¢ Donā€™t do this.
  • 23. MySQL sucks ā€¢ 1 type of JOIN ā€¢ No query rewriting ā€¢ Not enough stats for the planner to be sane
  • 24. This can hurt ā€¢ File Transform table: ā€¢ Master (File) ā€¢ Result (File) ā€¢ Status (pending/complete/failed/running) ā€¢ TransformStep (from/to) ā€¢ Leads to bad join order, massive fail
  • 25. MySQL sucks FAIL
  • 26. How to fail ā€¢ SELECT all ļ¬le transforms that lead to wma (millions). ā€¢ JOIN all ļ¬les, ever (millions). Filter to ļ¬nd those in state ā€˜pendingā€™ ā€¢ All pending looks like a bad bet - cardinality of ā€˜all wmasā€™ looks better than cardinality of ā€˜all pendingā€™. ā€¢ JOIN in the wrong order, nested loop, screwed..
  • 27. Queueing ā€¢ Did I mention queues in the DB suck? ā€¢ Even if youā€™re not screwing it up. ā€¢ Get a Message Queue (or at least an async job server) ā€¢ If your problem is simple - Gearman. Harder or you need interop - RabbitMQ.
  • 28. Mutable state ā€¢ Mutable state is the enemy ā€¢ Too many things rw. ā€¢ No idea how an object got to this state
  • 29. Anemic domain model Object-oriented programming (OOP) is a programming paradigm that uses "objects" ā€“ data structures consisting of data ļ¬elds and methods together with their interactions ā€“ to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, modularity, polymorphism, and inheritance.
  • 30. Anemic domain model ā€¢ Superset of too much mutable state ā€¢ Able to create invalid objects ā€¢ Able to make previously valid objects invalid ā€¢ Violation of the encapsulation and information hiding principles.
  • 31. scripts ā€¢ Lots of our business logic was in scripts that manipulated objects ā€¢ You need people to run scripts (in screen sessions) ā€¢ Ewwww, ewwwww.
  • 32. Jobs ā€¢ Moved to a job based approach ā€¢ Jobs started by ļ¬le creation, or changing state of something in a web app ā€¢ Jobs sent via message queuing. ā€¢ Results go via message queueing ā€¢ Jobs trigger other jobs
  • 33. Jobs Example ā€¢ Validate XLS ļ¬le supplied with order. ā€¢ Valid ļ¬les trigger another job to create objects for each thing in the XLS ā€¢ This then triggers another job to create transforms, which are then done... ā€¢ ... etc ... ā€¢ Canā€™t do this workļ¬‚ow in a web request.
  • 34. Jobs Future ā€¢ More automation of things people run scripts for. ā€¢ Automatic job regeneration (you will lose messages).
  • 35. Lava ļ¬‚ow ā€¢ Old (possibly unclean/invalid) data ā€¢ Old (unused/unmaintained) code ā€¢ ā€œWhat harm does it doā€
  • 36. Relational integrity ā€¢ Seems to be a pipe dream more often then not in the real world. ā€¢ Why? ā€¢ Itā€™s not hard
  • 37. Data consistency ā€¢ This should theoretically be the same thing as relational integrity. ā€¢ In practice...
  • 38. Mumble View Crap ā€¢ Too much logic in templates ā€¢ Copy & paste ā€¢ Business objects viewed as unchangeable ā€¢ Deleted 3000 lines from 2 simple workļ¬‚ows. This ļ¬xed a dozen bugs.
  • 39. Tangram ā€¢ No LEFT JOIN ā€¢ Displaying a product list becomes an x n problem. ā€¢ OUCH ā€¢ Keep stupid - put the entire DB hot in memcache!
  • 40. Donā€™t do web design ā€¢ You are a programmer ā€¢ Make people pay for a design/CSS/HTML person ā€¢ Work with them ā€¢ Be happy
  • 41. Love your sysadmins ā€¢ Help them out. ā€¢ Build packages, or local::libs or something ā€¢ Keep everything in revision control ā€¢ Allow things to be sensibly conļ¬gured. ā€¢ DOCUMENT THE POSSIBLE SETTINGS ā€¢ Use systems management - Puppet?
  • 42. Love your logs ā€¢ Active feedback ā€¢ Aggregate in splunk ā€¢ Actively prune useless stuff ā€¢ Actively add useful stuff after a production incident
  • 43. ESI ā€¢ Is really awesome ā€¢ Make the pain go away ā€¢ PURGE requests ā€¢ Keep everything hot all the time
  • 44. memcache everything ā€¢ Keep the entire database hot in memcache ā€¢ We mostly ask trivial questions, so just cache those paths. ā€¢ 30 Gb of RAM isnā€™t actually much (3 boxes..)
  • 45. memcache ā€¢ IS A CACHE ā€¢ Use sequential port numbers and CNAMES ā€¢ E.g. cache0:11210, cache1:11211, cache2:11212 etc.. ā€¢ Run several per machine ā€¢ Allows you to scale capacity and rebalance without entire cache ļ¬‚ush.
  • 46. Donā€™t push bytes ā€¢ X-Sendļ¬le and X-Accel-Redirect ā€¢ I already talked about ļ¬le delivery like this ā€¢ Using 100Mb of RAM to proxy web requests does not scale.
  • 47. Test everything ā€¢ Redundant systems need testing ā€¢ Youā€™ll still die unexpectedly in production ā€¢ If you can manage it, make responsibility for deployment SEP.
  • 48. ā€¢ Thanks for listening ā€¢ Questions?

Editor's Notes