Tuesday, April 24, 2012
Tuesday, April 24, 2012
Tuesday, April 24, 2012
Tuesday, April 24, 2012
Angry Birds Shop
                          Cloud Deployment
                                    Presented by
                                    Kian T. Gould and Daniel Pötzinger




Tuesday, April 24, 2012
Tuesday, April 24, 2012
Tuesday, April 24, 2012
Irregular Traffic Behaviour




Tuesday, April 24, 2012
The Angry Birds Magento Universe
                          Magento Store                                     DRM Server


                              Storefronts       Reporting

                              Products +                               Mail Service
                                                Ordermgmt
                          Warehouse Inventory



                                                                     Giftcards

                          Shipwire
                          Manage Warehouse      Fullfillment   Braintree




Tuesday, April 24, 2012
Angrybirds Magento Universe
                                             Sh ipw   ire
                          Magento Store                        bal
                                                                                        DRM Server

                                                      ges  glo
                                             M  ana
                                                            es &
                             Storefronts      Reporting

                                              wa  reh   ous
                              Products +                                           Mail Service
                                             Ordermgmt
                          Warehouse Invetory
                                               inv ent  ory
                                                                ay  for
                                                  ind   be st w
                                                F                    ent         Giftcards

                                                        rF ullf illm
                          Shipwire               o rde
                          Manage Warehouse   Fullfillment                  Braintree




Tuesday, April 24, 2012
Why Amazon Cloud ?


Tuesday, April 24, 2012
✓ Scales quickly on demand
                          ✓ Pay only what you need




Tuesday, April 24, 2012
Powerfull AWS Services


                          EC2   S3         RDS      Cloud     Elastic   ELB   R53
                                                    Front     Cache



                                     Amazon Webservices & Amazon Console




                                              Rightscale Services



Tuesday, April 24, 2012
Cloud Drawbacks?

                           Complexity                Plan for EC2 Failover


                                                        Need to adjust
                          Plan Security
                                                         Application


                                          Lack of Service



Tuesday, April 24, 2012
Cloud Drawbacks? ture               Req uirem ents
                                  Arch itec                          over
                                                              le Fail
                                                           ultip
                                            ailab ility (M
                                  H igh av            cing)
                                               balan
                           Complexity
                                  and   Load
                                                         Bac kend Plan for EC2 Failover
                                                      in
                                             to Adm m Shop-Fro         ntend
                                   M  agen
                                            ende  nt fro
                                    indep                depen  dent
                                           ient a nd in         nage  ment
                                     Effic        nd tas  k ma
                                     back   grou                         Need to adjust
                          Plan Security                ching
                                       In tensi ve Ca                     Application
                                                                   n the cloud
                                                      agem   ent i
                                        Asse   t man

                                           Lack of Service



Tuesday, April 24, 2012
Tuesday, April 24, 2012
Our Cloud Architecture




Tuesday, April 24, 2012
Tuesday, April 24, 2012
Architecture
                                                                  ELB         R53      Cloud Front
                                                                              DNS        CDN for Skin


                          Cloud Front             S3                                Autoscaling
                           CDN for Assets    Assets Storage   Varnish Array



                                            Frontend Array    Backend Array         Worker Array
                                              Autoscaling
                                              FE FE FE




                                                                  RDS
                                                                  mySQL
                          Elastic Cache         S3
                           Cache Backend      Deployment




Tuesday, April 24, 2012
Scaling is about finding
                                    the Bottleneck




Tuesday, April 24, 2012
Scaling and Tuning

                      Bottleneck   Varnish     Load
                                             Varnish Varnish
                                                                   Cloud
                                   Array     Balancing             Front
                      Bandwidth


                      Bottleneck   Frontend Array             FE FE FE FE FE FE
                                                        FE FE FE FE FE FE FE
                      CPU          Autoscaling                FE FE FE FE FE FE



                      Bottleneck
                      Database     RDS       Elastic Cache
                                   mySQL       Cache Backend




Tuesday, April 24, 2012
Image Caching
                                            Frontend       Frontend             Backend

                                                Image
                          Cloud Front           resized?
                           CDN for Assets
                                                            Read and save
                                                            resized images



                                                                             Upload new original
                                S3                                           images to S3
                           Assets Storage




Tuesday, April 24, 2012
The 6 secrets of caching
                          1. achieve a high hit rate
                          2. don‘t flood your cache
                          3. choose your cache backends wisely
                          4. never loose all cache at once
                          5. clean up old cache entries
                          6. be able to clean/refresh on demand




Tuesday, April 24, 2012
Magento Performance Pointers
                          1. Asyncronous Cache Clearing Queue (Aoe_AsyncCache)
                          2. Take care of Cache Cleaning (Aoe_CacheCleaner)
                          3. Disable Magento Logs
                          4. Make page cacheable in Varnish (Aoe_Static)
                          5. Prefix bundeled JS and CSS with timestamp
                          6. and... Profile, Profile, Profile:
                             •xdebug + kcachegrind
                             •Newrelic
                             •xhprof

Tuesday, April 24, 2012
Magento Cloud-Adjustments
                          1. Compress Javascript + CSS on deploy time
                          2. Use Deployment Name as Cache prefix
                          3. Cache Warmup Script as part of Deployment
                          4. Health Check for Loadbalancer
                          5. Automatic Varnish Purging
                          6. Use E-Mail Service
                          7. Establish Asset handling



Tuesday, April 24, 2012
Tuesday, April 24, 2012
Lessons learned
                          1. 404s are too expensive
                             => cache or redirect
                          2. Cloudfront with S3 backend
                          cannot handle gzip
                             => deploy time bundeling/compression

                          3. Don‘t hit „Reports“ in the backend :-)
                          4.You cannot forsee everything
                             => But you can be prepared to fix things quickly
                             => continuous    deployment




Tuesday, April 24, 2012
Tuesday, April 24, 2012
Continuous
                          Deployment



Tuesday, April 24, 2012
Tuesday, April 24, 2012
Don‘t be scared of
               releasing to
               production




Tuesday, April 24, 2012
Definition of Continuous Deployment


                          We want on-demand deployment
                          of tested features and fixes
                          in a quick and reliable way



Tuesday, April 24, 2012
You can achieve this by

                          Automating everything
                            Build
                                    Testing
                                              Deployment

Tuesday, April 24, 2012
..and

                          doing it frequently



Tuesday, April 24, 2012
Tuesday, April 24, 2012
The Deployment
                          Pipeline




Tuesday, April 24, 2012
Tuesday, April 24, 2012
Angry Birds Deployment Pipeline
                                       Backup
                            SVN
                                       Storage



                           Commit                        Install on      Selenium        Performance
                                      Unit Tests
                          and Build                       „latest“    Acceptance Tests      Tests




                                         Build Downstream and Test Strategy


                                                   Feedback to Developers




Tuesday, April 24, 2012
Magento Installation Package
                                               ‣ htdocs [Magento Source]
                                               ‣ media maintenance mode
                          ‣ Filesystem               1.set
                                               ‣ .modman [Custom Packages]
                                                     2.Delta Package prepare
                          ‣ Database           ‣ changelog.txt
                                                     3.apply Database
                          ‣ Install Binaries         4.sync files
                                                     5.run modman deploy-all
                          ‣ settings.php             6.adjust Settings
                                                     7.Post install:
                                                       fix p. / cache clean / ...




Tuesday, April 24, 2012
Angry Birds Deployment Pipeline




                           Install on                   Cloud     Integration     Cloud
                          Deployment    Copy to S3   Deployment      Tests      deployment
                            System                     Staging    AOE + Rovio   production




Tuesday, April 24, 2012
Cloud Deployment
                                                                   R53
                  Deployment „Version 88“                          DNS      Deployment „Version 89“


                                       Varnish Array                        Start new Varnish Array by
                                                                                       release
                          ELB              V   V   V                          ELB          V V V
                                                                            ✓ cloning old deployment
                                                                            ✓ adjusting release number
                            Autoscaling        Backend    Worker               Autoscaling    Backend    Worker
                          Frontend Array        Array      Array             Frontend Array    Array      Array
                            FE FE FE           BE BE BE    W                   FE FE FE       BE BE BE     W



                                                                    RDS
                                                                    mySQL
                                                                                                  S3


Tuesday, April 24, 2012
Tuesday, April 24, 2012
The real life




Tuesday, April 24, 2012
Tuesday, April 24, 2012
Day 1 - Release 1




Tuesday, April 24, 2012
Day 2 - Release 2 - „get ready for Space“




Tuesday, April 24, 2012
Day 3 - „People want it so badly“

                                                          USA wakes up
                                        Space game
                                        launched
                                        Array scales up
                          New release
                          deployed




Tuesday, April 24, 2012
Day 4 - Release 3 „Performance Improvement“

                          40% average
                          CPU usage.

                          1-2 FE Servers
                          are enough




Tuesday, April 24, 2012
Tuesday, April 24, 2012
Thank you

                                      Follow us on Twitter:

                                      AOE:      @aoemedia
                                      Daniel P: @typo3media

Tuesday, April 24, 2012

Angrybirds Magento Cloud Deployment

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
    Angry Birds Shop Cloud Deployment Presented by Kian T. Gould and Daniel Pötzinger Tuesday, April 24, 2012
  • 6.
  • 7.
  • 8.
  • 9.
    The Angry BirdsMagento Universe Magento Store DRM Server Storefronts Reporting Products + Mail Service Ordermgmt Warehouse Inventory Giftcards Shipwire Manage Warehouse Fullfillment Braintree Tuesday, April 24, 2012
  • 10.
    Angrybirds Magento Universe Sh ipw ire Magento Store bal DRM Server ges glo M ana es & Storefronts Reporting wa reh ous Products + Mail Service Ordermgmt Warehouse Invetory inv ent ory ay for ind be st w F ent Giftcards rF ullf illm Shipwire o rde Manage Warehouse Fullfillment Braintree Tuesday, April 24, 2012
  • 11.
    Why Amazon Cloud? Tuesday, April 24, 2012
  • 12.
    ✓ Scales quicklyon demand ✓ Pay only what you need Tuesday, April 24, 2012
  • 13.
    Powerfull AWS Services EC2 S3 RDS Cloud Elastic ELB R53 Front Cache Amazon Webservices & Amazon Console Rightscale Services Tuesday, April 24, 2012
  • 14.
    Cloud Drawbacks? Complexity Plan for EC2 Failover Need to adjust Plan Security Application Lack of Service Tuesday, April 24, 2012
  • 15.
    Cloud Drawbacks? ture Req uirem ents Arch itec over le Fail ultip ailab ility (M H igh av cing) balan Complexity and Load Bac kend Plan for EC2 Failover in to Adm m Shop-Fro ntend M agen ende nt fro indep depen dent ient a nd in nage ment Effic nd tas k ma back grou Need to adjust Plan Security ching In tensi ve Ca Application n the cloud agem ent i Asse t man Lack of Service Tuesday, April 24, 2012
  • 16.
  • 17.
  • 18.
  • 19.
    Architecture ELB R53 Cloud Front DNS CDN for Skin Cloud Front S3 Autoscaling CDN for Assets Assets Storage Varnish Array Frontend Array Backend Array Worker Array Autoscaling FE FE FE RDS mySQL Elastic Cache S3 Cache Backend Deployment Tuesday, April 24, 2012
  • 20.
    Scaling is aboutfinding the Bottleneck Tuesday, April 24, 2012
  • 21.
    Scaling and Tuning Bottleneck Varnish Load Varnish Varnish Cloud Array Balancing Front Bandwidth Bottleneck Frontend Array FE FE FE FE FE FE FE FE FE FE FE FE FE CPU Autoscaling FE FE FE FE FE FE Bottleneck Database RDS Elastic Cache mySQL Cache Backend Tuesday, April 24, 2012
  • 22.
    Image Caching Frontend Frontend Backend Image Cloud Front resized? CDN for Assets Read and save resized images Upload new original S3 images to S3 Assets Storage Tuesday, April 24, 2012
  • 23.
    The 6 secretsof caching 1. achieve a high hit rate 2. don‘t flood your cache 3. choose your cache backends wisely 4. never loose all cache at once 5. clean up old cache entries 6. be able to clean/refresh on demand Tuesday, April 24, 2012
  • 24.
    Magento Performance Pointers 1. Asyncronous Cache Clearing Queue (Aoe_AsyncCache) 2. Take care of Cache Cleaning (Aoe_CacheCleaner) 3. Disable Magento Logs 4. Make page cacheable in Varnish (Aoe_Static) 5. Prefix bundeled JS and CSS with timestamp 6. and... Profile, Profile, Profile: •xdebug + kcachegrind •Newrelic •xhprof Tuesday, April 24, 2012
  • 25.
    Magento Cloud-Adjustments 1. Compress Javascript + CSS on deploy time 2. Use Deployment Name as Cache prefix 3. Cache Warmup Script as part of Deployment 4. Health Check for Loadbalancer 5. Automatic Varnish Purging 6. Use E-Mail Service 7. Establish Asset handling Tuesday, April 24, 2012
  • 26.
  • 27.
    Lessons learned 1. 404s are too expensive => cache or redirect 2. Cloudfront with S3 backend cannot handle gzip => deploy time bundeling/compression 3. Don‘t hit „Reports“ in the backend :-) 4.You cannot forsee everything => But you can be prepared to fix things quickly => continuous deployment Tuesday, April 24, 2012
  • 28.
  • 29.
    Continuous Deployment Tuesday, April 24, 2012
  • 30.
  • 31.
    Don‘t be scaredof releasing to production Tuesday, April 24, 2012
  • 32.
    Definition of ContinuousDeployment We want on-demand deployment of tested features and fixes in a quick and reliable way Tuesday, April 24, 2012
  • 33.
    You can achievethis by Automating everything Build Testing Deployment Tuesday, April 24, 2012
  • 34.
    ..and doing it frequently Tuesday, April 24, 2012
  • 35.
  • 36.
    The Deployment Pipeline Tuesday, April 24, 2012
  • 37.
  • 38.
    Angry Birds DeploymentPipeline Backup SVN Storage Commit Install on Selenium Performance Unit Tests and Build „latest“ Acceptance Tests Tests Build Downstream and Test Strategy Feedback to Developers Tuesday, April 24, 2012
  • 39.
    Magento Installation Package ‣ htdocs [Magento Source] ‣ media maintenance mode ‣ Filesystem 1.set ‣ .modman [Custom Packages] 2.Delta Package prepare ‣ Database ‣ changelog.txt 3.apply Database ‣ Install Binaries 4.sync files 5.run modman deploy-all ‣ settings.php 6.adjust Settings 7.Post install: fix p. / cache clean / ... Tuesday, April 24, 2012
  • 40.
    Angry Birds DeploymentPipeline Install on Cloud Integration Cloud Deployment Copy to S3 Deployment Tests deployment System Staging AOE + Rovio production Tuesday, April 24, 2012
  • 41.
    Cloud Deployment R53 Deployment „Version 88“ DNS Deployment „Version 89“ Varnish Array Start new Varnish Array by release ELB V V V ELB V V V ✓ cloning old deployment ✓ adjusting release number Autoscaling Backend Worker Autoscaling Backend Worker Frontend Array Array Array Frontend Array Array Array FE FE FE BE BE BE W FE FE FE BE BE BE W RDS mySQL S3 Tuesday, April 24, 2012
  • 42.
  • 43.
    The real life Tuesday,April 24, 2012
  • 44.
  • 45.
    Day 1 -Release 1 Tuesday, April 24, 2012
  • 46.
    Day 2 -Release 2 - „get ready for Space“ Tuesday, April 24, 2012
  • 47.
    Day 3 -„People want it so badly“ USA wakes up Space game launched Array scales up New release deployed Tuesday, April 24, 2012
  • 48.
    Day 4 -Release 3 „Performance Improvement“ 40% average CPU usage. 1-2 FE Servers are enough Tuesday, April 24, 2012
  • 49.
  • 50.
    Thank you Follow us on Twitter: AOE: @aoemedia Daniel P: @typo3media Tuesday, April 24, 2012