28. Client → DNS → CDN -> DNS
Load Balancer
• ELB: Amazon Elastic Load Balancer
• Terminate TLS
• Route requests to application servers
28
29. Client → DNS → CDN -> DNS -> Load Balancer
Application Servers
• EC2: Amazon Elastic Compute Cloud
• Virtual Machines
• EC2 instances are provisioned via Auto Scaling Group
• Auto Scaling is based on instance CPU load
• Scale up/down if CPU load over/under 55%/20% for 2
minutes
29
30. Client → DNS → CDN -> DNS -> Load Balancer
Application Servers
• Node.js/Express
• Authentication
• Determine location of tiles
• Fetch tiles and return them
30
31. Client → DNS → CDN -> DNS -> Load Balancer
Application Servers
Fetching tiles
• check simultanously in local cache (redis) and object store
(s3)
• return from where is found first
• if only found in object store, update local cache
31
32. Client → DNS → CDN -> DNS -> Load Balancer
Application Servers
Cache vs. Object Store
• redis: 50% cache hits
• (60% non-cdn = 30% total requests)
• redis is used as least-recently used cache, thus popular tiles
for a region are usually cached
• redis is provisioned by AWS via ElastiCache
32
38. Deploy to many regions
• constantly have around 300 EC2 instances running
• last months spike was 1000 EC2 instances (batch jobs)
• can't care for individual EC2 instances
• every developer handles deployment themselves
38
40. Deploying cloudformation stacks
mapbox-cli
• the tool, the infrastructure team gives to developers
• abstracts and automates common tasks
• encodes our conventions for using AWS
40
44. Deploys with interruptions
• Take region out of Route 53
• Wait for traffic to cease
• Update stack
• Put region back into Route 53
44
45. • mapbox-cli is built with node.js
• mostly based around the aws-js sdk
• github.com/mapbox
• cfn-config
• cfn-stack-event-stream
• as-replace-instances
45