Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

High-Performance Magento in the Cloud

6.929 Aufrufe

Veröffentlicht am

The Angry Birds global web shop (at times the highest traffic Magento platform in the world) runs on Magento Enterprise, scales 100% automatically in the AWS infrastructure and is designed to easily handle 20x traffic peaks during marketing and new release peaks. Learn how to implement a Magento store for optimal performance, how to run it in a cloud environment, about the infrastructure and the applied strategies for continuous delivery, auto-scaling and zero-downtime rollouts.

Veröffentlicht in: Technologie
  • You also have another option when it comes to hosting Magento on cloud. You can host Magento on cloud, like AWS or GCE, using a managed hosting platform. By far, managed hosting has proven to be efficient method for hosting because it saves a lot of time and effort. You can install Magento in just one click and there are many other benefits like you don't have to configure web server and caching yourself and you don't need to bother with CLI. Here is an example of hosting Magento on AWS using managed hosting: http://www.cloudways.com/blog/how-to-install-magento-on-amazon-aws-cloud/
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier

High-Performance Magento in the Cloud

  1. 1. Magento High Performance …in the cloud php[world] 2014 – Washington D.C.
  2. 2. Fabrizio Branca
  3. 3. fbrnc fbrnc
  4. 4. E-Commerce: Magento CMS: TYPO3 Portals: ZF, FLOW,… Mobile Searchperience: SOLR >120 people world-wide High Performance /Scale Global Enterprise Projects
  5. 5. San Francisco, CA Janine Fiona that’s me Leo
  6. 6. Who’s runs a shop with 10 orders/hour? Who’s runs a shop with 10 orders/min? Who’s runs a shop with 10 orders/sec? YOU...?
  7. 7. PC games (download) Plush toys, shirts, ...
  8. 8. > 24.000.000 likes > 500.000 followers Social Media Impact
  9. 9. your application one process of… execution time memory
  10. 10. that’s your server …running your application
  11. 11. 𝑡𝑜𝑡𝑎𝑙 𝑚𝑒𝑚𝑜𝑟𝑦 = 𝑐𝑜𝑛𝑐𝑢𝑟𝑟𝑒𝑛𝑡 𝑢𝑠𝑒𝑟𝑠 ∗ 𝑚𝑒𝑚𝑜𝑟𝑦/𝑝𝑟𝑜𝑐𝑒𝑠𝑠 256 MB /process 100 users 25 GB RAM 1000 users250 GB RAM
  12. 12. Option 1 Make your app “smaller” make it faster!make it consume less memory!
  13. 13. Option 2 Make your box “bigger” a.k.a. “vertical scaling”
  14. 14. Option 3 Add more boxes a.k.a. “horizontal scaling”
  15. 15. Vertical Scaling Optimization Horizontal Scaling bigger box more boxes smaller “app” Scaling
  16. 16. Single Server Multi-Server vs. Single server vs. Multi server What’s the big deal?
  17. 17. Shared nothing? Session Storage Cache Code JS/CSS bundles DatabaseAssets
  18. 18. Multi Server Deployment
  19. 19. “Hello World! Free Shipping for everyone!”
  20. 20. “Hello World! Free Shipping for everyone!” “Check out our new product!” “Holiday Season!”
  21. 21. Slow response times, server crashes,…
  22. 22. Waste of money
  23. 23. Waste of money Slow response times, server crashes,…
  24. 24. Auto Scaling! Pay per hour
  25. 25. Actually, it looks more like this
  26. 26. Cloud (in case you haven’t noticed…:)
  27. 27. Amazon EC2 Amazon S3 Amazon RDS CloudFront Route 53ElastiCache Elastic Load Balancing Cloud Services AWS Management ConsoleRightScale Amazon SWFOpsWorks AWS CloudFormation
  28. 28. EC2 instance
  29. 29. EC2 instance Server Array (or “auto-scaling group”) Based on various metrics
  30. 30. Server Array (or “auto-scaling group”) EC2 instance
  31. 31. Server Array (or “auto-scaling group”) EC2 instance
  32. 32. Elastic Architecture Booting new instances fully automatic Auto-healing Infrastructure as Code
  33. 33. Loose Coupling No hardcoding! “RightScale API, give me all frontend servers” “ELB, here I am”
  34. 34. S3 Deployment X Backend Array Frontend Array Worker Array Varnish Array S3 RDSElastiCache CloudFront CloudFrontRoute 53 shop.angrybirds.com Braintree MailDRM Giftcards ELB
  35. 35. ELB Backend Array Frontend Array Worker Array Varnish Array Deployment X Route 53
  36. 36. Deployment X+1 Worker Array nt X Route 53 ELB Backend Array Frontend Array W Varnish Array
  37. 37. Worker Array nt X Route 53 Backend Array Frontend Array W Varnish Array Deployment X+1 ELB
  38. 38. Route 53 Backend Array Deployment X+1 Frontend Array Worker Array Varnish Array Deployment X ELB ELB
  39. 39. Downtime Number of lost carts Number of lost sessions and logins
  40. 40. 1.000.000unique visitors. per day.
  41. 41. concurrent users.
  42. 42. Orders. 10 5 6 7 8 9 per second. Yes, per second!
  43. 43. AWS OpsWorks “DevOps Application Management Service”
  44. 44. Stacks, Layers Instances and Apps e.g. “production” Varnish PHP DB Instances
  45. 45. Lifecycle Events
  46. 46. Build InstallationDeploymentProvisioning Chef deploy cookbook before_ migrate.rb Jenkins Setup Conf Deploy
  47. 47. Route 53 ELB CloudFront: Theme (JS/CSS,…) CloudFront: media files Internet S3: media files S3: build packages Continuous Integration Pipeline (Jenkins) OpsWorks Availability Zone AWS CloudFormation CloudWatch ✓ ✓inherently fault tolerant ✓ ✓ ✓ ✓ ✓ Redis: Sessions Redis: Cache Backend RDS DB instance RDS DB instance standby (Multi-AZ) ✓ ✓ Auto Scaling Group Frontend Layer Backend Layer Worker Layer Varnish Layer Data Layer RDS DB Read replica (for reports) Redis: Full page cache backend ✓ Production Stack External Services (Fulfillment, DRM, Giftcards,…) SES: Transactional emails ✓ SQS: Queue ✓ OpsWorks Setup “Stack” (= Environment) “Layers” App Instances
  48. 48. VarnishCustom Layer Redis Cache Redis Sessions Custom Layer Magento Production, Magento Staging, Wordpress,… PHP App Layer MySQL DB Layer Minimal Setup Route 53 ELB CloudFront: Theme (JS/CSS,…) ✓ ✓ ✓ S3: build packages Continuous Integration Pipeline (Jenkins) ✓ reuse instance for multiple layers Not recommended! Just a thought experiment… < $120/month for a c3.2xlarge
  49. 49. AppVarnish Reverse Proxy Protecting the application Only a few requests hit your app!
  50. 50. 90% Varnish Tweaking Cache Hitrate
  51. 51. 80% Varnish Tweaking Cache Hitrate
  52. 52. 98.6% Varnish Tweaking Cache Hitrate
  53. 53. Reduce Number of Requests … hitting your application
  54. 54. Use a CDN
  55. 55. Offload dynamic parts Do Ajax
  56. 56. Request a page (HTTP Request) deliver static page Request Delivering static content Placeholders for dynamic parts. Cache-Control headers Ajax call request dynamic parts and transfers the id of the currently visited product JSON response with dynamic content Replace placeholder Write session id to cookie Render the page Browser Varnish Application
  57. 57. use cookies or localStorage Don’t Ajax
  58. 58. Request a page (HTTP Request) deliver static page Request Delivering static content Placeholders for dynamic parts. Cache-Control headers Ajax call request dynamic parts and transfers the id of the currently visited product JSON response with dynamic content Replace placeholder Write session id to cookie Render the page Browser Varnish Application
  59. 59. 3xx 4xx 5xx Redirects Client errors Cache other status codes Server errors
  60. 60. http://example.com/ ?utm_source=phpworld14 &utm_medium=slides …and many more. Normalize URLs Filter these!
  61. 61. Reduce Number of Requests … hitting your application Don’t AjaxDo Ajax 3xx 4xx 5xx Cache other status codes http://example.com/ ?utm_source=pw14 &utm_medium=slides Normalize URLsUse a CDN
  62. 62. Bottleneck Candidates Dynamic requests are still too slow?
  63. 63. How do you know?
  64. 64. StackDriver New Relic Aoe_Profiler Xdebug Server App Profile! minimal overhead Knows about Magento… Very detailed!
  65. 65. RAM & CPU That’s easy…
  66. 66. DatabaseThat’s not so easy… offload the database less queries (caching!) more efficient queries (indexes,…) scaling sharding master/slave Percona Toolkit (slow) query log
  67. 67. Growing Data Trimming the fat! Orders Promotions cms / banners Aoe_CacheCleaner Aoe_QuoteCleaner
  68. 68. File I/O especially on virtual machines!
  69. 69. lib community core local Number of *.php files by location Less file operations
  70. 70. Aoe_ClassPathCache Magento Compiler Solution File I/O …also check Magento 2!
  71. 71. External Components Frontend? Cache Backend? Web Services? Webserver?
  72. 72. Bottleneck Candidates Memory CPU File I/ODatabase External Components
  73. 73. Launch! Deployment Space game launch! USA wakes up
  74. 74. http://joind.in/talk/view/11889
  75. 75. Thank you! Any questions? {firstname}.{lastname}@aoe.com http://www.aoe.com http://www.fabrizio-branca.de @fbrnc Follow me on twitter! My blog

×