Autoscaling Magento in the cloud

25

Transcript of Autoscaling Magento in the cloud

  • 1. Performance e Autoscaling 2 Due lati della stessa medaglia

2. 3 Aspetta, provo questo e andiamo online! 3. Chi sono 4 LUIGI MOLINARO neen Di cosa parler Che cosa l'auto-scaling ? Di cosa ho bisogno per scalare ? Scaling & Perfomance: Strumenti di Benchmark Tuning Magento per lauto-scaling Video scaling Analisi dei Benchmark effettuati Rischi legati all'autoscaling 4. Traffic Patterns 5 Predictable Bursts1 Un Predictable Bursts2 Constantly Growing3 5. Upfront server investment 6 CAPACITY TIME Source AWS Large upfront investment Large upfront investment FIXED CAPACITY PREDICTION 6. 7 CAPACITY TIME Source AWS FIXED CAPACITY ACTUAL DEMAND Fixed vs Actual demand 7. 8 CAPACITY TIME Source AWS FIXED CAPACITY ACTUAL DEMAND 1 Problema: Capacit inutilizzata 8. 9 CAPACITY TIME Source AWS FIXED CAPACITY ACTUAL DEMAND 2 Problema: Picchi non gestiti 9. 10 CAPACITY TIME Source AWS ACTUAL DEMAND VIRTUALIZED INFRASTRUCTURE Autoscaling We can closely align our infrastructure with our load requirements and save costs 10. Why Amazon AWS? 11 Il cloud pubblico pi famoso al mondo Ambiente standard e conosciuto per i test Ottimo sistema di Autoscaling Cloud Specialist 11. Solution components 12 Magento CE EC2 (Elastic Compute Cloud) EBS (Elastic Block Storage) ELB (Elastic Load Balancer) Amazon Elastic Ip Address (Varnish) Amazon ClaudWatch NFS Nginx Php-fpm APC Redis Memcache Varnish 12. Autoscaling Benchmarks 13 BENCHMARK 1 Un singolo server (senza cache, cache, redis/memcache, Magento Tuned, Mage 100k) BENCHMARK 2 Scaling Orizzontale dellinfrastruttura BENCHMARK 3 Scaling con Varnish (no cache-cache) 13. Autoscaling Key 14 Varnish CloudWatch Template studiato per scalare Memcache sessioni, Redis cache 14. Template studiato per scalare 15 Immaginare come si comporta un nuovo server da zero Sfruttare sistemi di automazione (Puppet, Chef, oppure ingegnarsi! :-) Php Session Log Server remoto Monitoring Server Il server pu essere terminato Storage distribuito (NFS) 15. CloudWatch metrics 16 Create new launch configuration: > as-create-launch-config my-launch-config image-id (template ottimizzato frontend) instance type m1.small key my-key-pair group my-security-group Create auto scale group: > as-create-auto-scaling-group my-as-group --availability-zone eu-west-1 launch- configuration my-launch-config max-size 10 min-size 1 cooldown 180 load-balancers my-load-balancer Create auto scale group: > as-create-or-update-trigger my-as-trigger auto-scaling-group namespace mm14 -- measure CPU Utilization statistics Average dimension AutoscalingGroupName= my-as- group --period 60 lower-treshold 20 upper-treshold 80 lower-breach-increment 2 upper-breach-increment 4 breach-duration 180 16. Redis + memcache 17 Redis good for cache Memcache good for sessions 17. Strumenti per lanalisi 18 Strumenti di analisi lato server (Munin, Nagios, Cacti, Zabbix, Ganglia) Strumenti di analisi applicativo / profiling (Zend server, Xdebug, Xhprof, MySql tuner, New Relic) Strumenti grafici (kcachegring, webgring, xhgui, xhprof.io) Stress testing tools Opensource / Commerciali (Apache Jmeter, Siege, Httperf, Tsung / LoadImpact, flood.io, Load Tester) 18. Test applicativo 19 Si presa la sitemap.xml e la si data in pasto a SIEGE (Usare log Varnish/web server in casi complicati o per avvicinarsi al caso reale pi possibile) Script per popolare database con 100.000 prodotti Si lanciato SIEGE con uno script in bash per aumentare la concorrenza gradualmente Ogni 30 secondi incremento di 10 utenze contemporanee I dati si sono graficati grazie a highcharts.com 19. 20 Autoscaling video 20. Analisi grafici 21 Riepilogativo dei test, con evidenza dei possibili visitatori / costi nelle varie ipotesi http://www.neen.it/meet-magento/b1.html http://www.neen.it/meet-magento/b2.html http://www.neen.it/meet-magento/b3.html 21. Varnish 22 Cos Perch Criticit nellinserirlo allinterno dellautoscaling Amazon Soluzione al problema 22. Analisi costi 23 Soluzione Utenti contemporanei Costi indicativi (al mese) 1 Nodo 10 $ 80,00 2 Nodi (www + MySql) 35 $ 200,00 3 Nodi (www + NFS + MySql) 35 $ 240,00 12 nodi (10x www + NFS + MySql) 150 $ 720,00 4 Nodi (www + NFS + MySql + Varnish no cache) + 9x www al 10% 150 $ 450,00 4 Nodi (www + NFS + MySql + Varnish cache) + 6x www al 10% > 150 $ 440,00 23. 24 GRAZIE! 24. Follow us 25 facebook.com/neen.datacenter @neendatacenter youtube.com/neendatacenter linkedin.com/company/neen-srl neen s.r.l. Via Mecenate 76/20A - 20138 Milano T: (+39) 02.45485420 - F: (+39) 02.45485432 E: [email protected] Web: www.neen.it Follow me @luigimolinaro it.linkedin.com/in/luigimolinaro/