Scaling in the Cloud with AWS By: Eli White (CTO & Co-Founder @ mojolive) eliw.com - @eliw - mojolive.com
Welcome! Why is this guy talking to us? Please ask questions! 2
What is Scaling anyway? Enabling your application to grow as traffic grows! Related to performance, but not the same. 3
Traditional Scalable Architecture How we used to do this 4
Vertical Scaling Start with one server 5
Vertical Scaling Break out additional machines by purpose 6
Vertical Scaling Then you buy bigger machines 7
Vertical Scaling And BIGGER machines! 8
Vertical Scaling - Summary Pros Simpler to code against Less machines to maintain Cons Downtime needed for upgrades Capacity has to be increased in large chunks 9
Horizontal Scaling Again, we start with one server 10
Horizontal Scaling Again, we start separating based upon purpose 11
Horizontal Scaling But now, we use load balancers to add more machines 12
Horizontal Scaling And we use Master/Slave replication to increase DB throughput 13
Horizontal Scaling Then continue to add servers, even at disparate rates 14
Horizontal Scaling - Summary Pros Commodity hardware Smooth expansion as needed Cons Code complexity increases Individual response performance can be limited 15
Translating this to the Cloud How the cool kids are doing it 16
Before we talk Amazon The Competitors Microsoft Azure Platform as a Service (PaaS) - Primarily Windows only Google App Engine Fully Platform as a Service (PaaS) No PHP Support Rackspace Infrastructure as a Service (IaaS) Machine instances only vary by memory & storage not CPU Allows upgrades in place however Offers traditional machine hosting as well 17
What s Amazon got then? Amazon Web Services (AWS) Infrastructure as a Service (IaaS) Designed to closely mimic the traditional scaling models Numerous machine types/capacities available Countless other services provided Database, Message Queues, Email Services, etc. Keep adding new features & dropping prices 18
Scaling web servers with Amazon Horizontal Scalability Add additional servers within minutes! 19
Vertical scaling too! Vertical Scalability 12 different instance sizes! - Up to 68 GB of RAM - Up to 88 ECU (CPU equivalent) 20
EC2 Instance types Standard Micro Instance - 613 MB of memory, up to 2 ECUs (for short periodic bursts) Small Instance - 1.7 GB of memory, 1 ECUs, 160 GB Large Instance - 7.5 GB of memory, 4 ECUs, 850 GB Extra Large Instance - 15 GB of memory, 8 ECUs, 1690 GB High-Memory Extra Large Instance - 17.1 GB memory, 6.5 ECU, 420 GB Double Extra Large Instance - 34.2 GB of memory, 13 ECUs, 850 GB Quadruple Extra Large Instance - 68.4 GB of memory, 26 ECUs, 1690 GB High-CPU Medium Instance - 1.7 GB of memory, 5 ECUs, 350 GB Extra Large Instance - 7 GB of memory, 20 ECUs, 1690 GB Cluster Compute Quadruple Extra Large - 23 GB memory, 33.5 ECUs, 1690 GB, 10 Gigabit Ethernet Eight Extra Large - 60.5 GB memory, 88 ECUs, 3370 GB, 10 Gigabit Ethernet Cluster GPU Quadruple Extra Large - 22 GB memory, 33.5 ECUs, 2 NVIDIA Fermi M2050 GPUs 21
Availability Regions & Zones Geodiversity & Redundancy Multiple availability zones per region! Regions: -US East (Northern Virginia) -US West (Oregon) -US West (Northern California) -EU (Ireland) -Asia Pacific (Singapore) -Asia Pacific (Tokyo) -South America (Sao Paulo) 22
Load Balancing with Amazon Distribute load across any number of EC2 instances in multiple availability zones Balances any TCP protocol via DNS Elastic Load Balancing (ELB) Health checks via HTTP, TCP, SSL 23
Scaling your Database with Amazon Relational Database System (RDS) MySQL or Oracle 1-click backups & multi-zone auto failover Seamless vertical scaling! Easy horizontal replication 24
RDS Instance types Small DB Instance: 1.7 GB memory, 1 ECU (1 virtual core with 1 ECU), Moderate I/O Capacity Large DB Instance: 7.5 GB memory, 4 ECUs (2 virtual cores with 2 ECUs each), High I/O Capacity Extra Large DB Instance: 15 GB of memory, 8 ECUs (4 virtual cores with 2 ECUs each), High I/O Capacity High-Memory Extra Large Instance: 17.1 GB memory, 6.5 ECU (2 virtual cores with 3.25 ECUs each), High I/O Capacity High-Memory Double Extra Large DB Instance: 34 GB of memory, 13 ECUs (4 virtual cores with 3,25 ECUs each), High I/O Capacity High-Memory Quadruple Extra Large DB Instance: 68 GB of memory, 26 ECUs (8 virtual cores with 3.25 ECUs each), High I/O Capacity 25
Automatic Scaling Works in conjunction with CloudWatch (Amazon s Monitoring Service) as well as Elastic Load Balancing! Auto Scaling Launch & destroy instances as needed for your application 26
Other features of Amazon Automatic or easy, either way, features that make life simpler 27
NoSQL Solutions Non-relational databases Item-Attribute-Value Store You want NoSQL? They ve got NoSQL SimpleDB - Query via a SQL-like language - Very simple, no relations - Auto scales, just keep adding DynamoDB (New) - High query performance - Fair more restrictive in access - Provisioned scaling 28
Simple Storage Service (S3) Store & serve any file Files can be publicly accessible via HTTP, or privately via API only Organize files into folders called buckets 29
CloudFront Static content delivery network Read your static content from an S3 bucket, or from any website 30
ElastiCache How Amazon does Memcached Protocol compliant with Memcached Quick creation of entire clusters Failed nodes are automatically replaced 31
Elastic Block Store (EBS) External Storage Drive for EC2 Persistent data storage across instance creation/deletion Can only be attached to a single EC2 instance at a time 32
Simple Email Service (SES) API driven email delivery Easy to use Perfect for handling transactional email 33
Simple Queue Service (SQS) Message Queues Similar to RabbitMQ & similar systems 14 day message life, 64kb max size Allows easier distributed processing tasks 34
And what else? Other services exist: Elastic Beanstalk (Java PaaS) CloudFormation (Bulk Sysadmin Tools) Map Reduce (Using EC2 to do map reduce functionality) Amazon Fulfillment Service FWS (Product Sales) Virtual Private Cloud VPC (VPN) Route 53 (DNS Hosting) GovCloud (Meets Government Hosting Requirements) Mechanical Turk (Use Real People) Flexible Payments Service FPS & DevPay (It is Amazon after all) Simple Workflow Service SWF (Essentially super-cron) 35
And What s Next? Constantly adding new services! Regularly reducing prices 36
Questions? For this presentation & more: http://eliw.com/ Twitter: @eliw mojolive: http://mojolive.com/ Rate me: https://joind.in/6041 37