chief technology officer - imagine.magento.com iv_technical... · standard magento environment...
TRANSCRIPT
Chief Technology Officer
George Cagle
Avoiding Traffic Jams: Architecting Scalable Magento Clusters
Standard Magento Environment
Single point of failure that is difficult to scale
Single-server instance housing both web files and site database
Cache and sessions stored on the file-system
Planning for Traffic Spikes
Build resource baseline from average traffic levels
Plan for 10-20% more traffic than expected
Determine if horizontal or vertical expansion is required
Bring resources online and perform stress-testing
Process is time consuming and can be expensive
01
02
03
04
05
Vertical Expansion Options
Increase CPU/RAM resources on server
Split web and database services across two servers
Horizontal Expansion Options
Load balancer distributes traffic evenly across all nodes
Deploy additional web server nodes
Problems with Expansion
No centralized file storage for /media or /var01
02
03
04
Admin Dashboard errors may occur during uploads/imports
Session data must be stored in database adding overhead
Expansion can be expensive, time consuming, and will require downtime
What About the Unexpected?
Unexpected Traffic SpikesSales, media campaigns, social media trends, etc
Without planning can lead to server overload and lost sales
Unexpected Traffic Spikes
Scalable Architecture to the Rescue!
Scalability Requires a Stateless Environment
A Stateless system keeps no local state/session record
The value of output(s) at any point in time depends only on the value of input(s)
Allows for a virtually unlimited number of new node creations
Data depending on a specific state must be centralized for node access
01
02
03
04
Utilize Stateless Design from Day 1
Provides ability to scale resources vertically and horizontally
Minimize or eliminate downtime
Improve performance
Improve security
Take advantage of load balancing, auto scaling, etc.
01
02
03
04
05
Considerations for Stateless Design
DNS A-record TTL set low to enable fast propagation (or utilize services like CloudFlare)
Session storage in Memcache / Redis
Cache storage in Memcache / Redis / Varnish
CDN for Media access and distribution
Database configured with binary logging for easy replication
Configuration management (Puppet/ Chef / Salt / etc)
01
02
03
04
05
06
Magento Cluster Expansion
• Initial Magento deployment on single-server environment
• Session and Cache data stored on separate daemons
• NFS export created for media and var directories
• Binary logging enabled for database service
• Configurations stores in automation system such as Chef / Puppet / Salt
Magento Cluster Expansion
• Database server config pushed from automation system
• Binary logging used to create a database slave on separate server
• Database slave promoted to master to complete database migration
Magento Cluster Expansion
• Push daemon configuration from automation system to new servers
• Move Session / Cache daemons to individual instances
Magento Cluster Expansion• Utilize low DNS A-record TTL to add a load balancer edge device
• Web Server #1 pulls media and var NFS mounts from admin server
• Cache / Session / Search pulled from centralized daemons
Magento Cluster Expansion
Scalable Architecture in Production
Magento Cluster Elasticity in Action
Magento Cluster Elasticity in Action
Magento Cluster Elasticity in Action
Magento Cluster Elasticity in Action
Magento Cluster Elasticity in Action
Magento Cluster Elasticity in Action
Maximize ROI
Magento Cluster at Peak Utilization – 4 Hours
Without A Scalable Solution:
• $800-1200 per production server• 9 servers in production
• $7,200.00-10,800.00• 3-7 Days For Deployment Prep
Magento Cluster at Peak Utilization – 4 Hours
• $800-1200 per production server• 4 servers in production
• $1.07-1.61 per standby server hour• 5 servers in standby
• $3,221.40-4,832.20• <5 Minutes for Deployment
With A Scalable Solution:
Magento Cluster at Peak Utilization – 4 Hours
With A Scalable Solution:
• $3,221.40-4,832.20
• <5 Minutes for Deployment
• Savings: $3,978.60 – 5,967.80
Without A Scalable Solution:
• $7200.00-10,800.00
• 3-7 Days For Deployment Prep
SummaryUse a stateless design model from Day 1
Maximize ROI
Avoid wasting resources and only pay for what you need
01
02
03
04
Scale infrastructure to meet traffic demands
SummaryUse a stateless design model from Day 1
Maximize ROI
Avoid wasting resources and only pay for what you need
01
02
03
04
Scale infrastructure to meet traffic demands