Вы находитесь на странице: 1из 40

High Availability (HA) Architectures using AWS

March 24, 2012 Soumik Biswas Biju Varghese

Agenda
1. 2. 3. 4.

Introduction - 5 minutes High Availability - 20 minutes Design For Cloud : Best Practices - 5 minutes Q&A

Copyright 2011 GlobalLogic

Introduction

Copyright 2011 GlobalLogic

High Availability

2011 GlobalLogic Inc.

High Availability

2011 GlobalLogic Inc.

Key Services - EC2


Virtual machine on which you can run your applications Elastic : create and run only when required and pay by the hour for active servers Instances can span across multiple geographies to achieve latency optimization and high levels of redundancy. Amazon Machine Image (AMI) : A template used to instantiate (create) a virtual machine within EC2. Template contains a software configuration (i.e., operating system, application server, and applications) AMI can be used to create server resources of different instance types Designed to provide 99.95% availability over a given year.
2011 GlobalLogic Inc.

Key Services - Elastic IP


Similar to static IP Public IP addresses that can be mapped (routed) to any EC2 instance within a particular EC2 Region Associated with an AWS account, not to a specific instance Can be detached from a failed instance and then mapped to a replacement instance within a very short time frame

2011 GlobalLogic Inc.

Key Services - Availability Zones


For most AWS infrastructure services, there are five geographical regions. Within each region are multiple Availability Zones Within each availability zone are multiple "locations" or data centers.

2011 GlobalLogic Inc.

Elastic Load Balancing & Auto Scaling


Elastic Load Balancer (ELB) distributes incoming application traffic across multiple Amazon EC2 instances. ELB can be within a single Availability Zone or across multiple zones Auto Scaling enables EC2 instances to be automatically scale up or down. Scaling can be configured using
Resource utilization Number of instances

Powerful when used along with Elastic Load Balancing (ELB)

2011 GlobalLogic Inc.

Key Services - Route 53


Highly scalable DNS service that allows you to manage your DNS records by creating a HostedZone for every domain you would like to manage. Request is guaranteed to hit the nearest DNS server and hence routed to the nearest deployment for faster access.

2011 GlobalLogic Inc.

10

Key Services - Elastic Block Store (EBS)


Raw block devices (file system), that can be attached to Amazon EC2 instances. EBS volumes are built on replicated back end storage. Snapshots used to create new Amazon EBS volumes. Replicated only within particular region. High I/O latency

2011 GlobalLogic Inc.

11

Key Services - Simple Storage Service


Write, read, and delete objects Number of objects you can store is unlimited Objects stored in a Region never leave the Region unless you transfer them out Object deletion can be
Recurring deletions : Based on rules. Eg. Remove sets of objects after a predefined time period. High volume deletions : Up to 1,000 objects can be deleted with a single request

Support versioning of the objects for further reliability Designed to provide 99.999999999% durability and 99.99% availability of objects over a given year. Common use cases : Content storage and distribution, Storage for data analysis, Backup, Disaster recovery, etc.
2011 GlobalLogic Inc.

12

Key Services - Relational Database Service


Branched off from MySQL Supports MySQL and Oracle DB Engine Handles database management tasks, such as backups, patch management and replication

2011 GlobalLogic Inc.

13

Key Services - Simple Queue


Simple Queue Service (SQS) is a highly reliable distributed messaging system Resolves issues arising from the common producer-consumer problem Does not automatically delete messages once they are sent

2011 GlobalLogic Inc.

14

Recap
Most Application need Compute Storage Messaging Scale Payment Distribution Analytics Monitoring

15

2011 GlobalLogic Inc.

15

High Availability

Copyright 2011 GlobalLogic

16

High Availability Compute


EC2 instance + AMI + ELB + AS + AZ + Region + Route 53 EC2 instance + AMI + ELB + AS + Availability Zones

High Availability

EC2 instance + AMI + ELB + Auto Scale EC2 instance + AMI + Elastic Load Balancer EC2 instance + AMI + Elastic IP EC2 instance + Amazon Machine Image EC2 instance

As you go up in the ladder the more reliable your deployment will be

Copyright 2011 GlobalLogic

17

Plain EC2
Detect instance failure Create new instance from base image Install/deploy your application specific content Start the instance. Not "available" at all...

Copyright 2011 GlobalLogic

18

EC2 with AMI


Detect failures Start new EC2 instances with stored AMI images No installation/deployment of packages. Ready on start. Cons: Downtime till the new instance comes up Not an available solution.

Copyright 2011 GlobalLogic

19

EC2 + AMI + Elastic IP


>1 EC2 instances running on pre-configured AMIs. Elastic IP points to one of the many EC2 instances. If 1 EC2 instance fails, we detect failure and re-assign Elastic IP to one of the other running instances. Downtime = Time taken to detect instance failure + time taken to re-assign Elastic IP. Not a HA approach.

Copyright 2011 GlobalLogic

20

EC2 + AMI + Elastic IP


Your site Your site

Elastic IP 172.168.7.31 EC2 - 1 EC2 - 2 EC2 - 1

Elastic IP 172.168.7.31 EC2 - 2

DB Master

Replication

DB Slave

DB Master

Replication

DB Slave

Backup

Backup

Amazon S3

Amazon S3

Copyright 2011 GlobalLogic

21

EC2 + AMI + E-IP + ELB


Multiple EC2 instances spun from AMIs assigned to a Elastic Load Balancer Group with shared Elastic IPs. ELB will take care of balancing load over the shared IPs. Failure of a instance will have minimal effect as other instances will take up the load. However, we need to add new instances to this eventually depleting pool of instances. No downtime till we run out of instances in the ELB.

Copyright 2011 GlobalLogic

22

EC2 + AMI + E-IP + ELB


Your Your site site Elastic IP 172.168.7.31 Elastic Load Balancer Your Your site site Your Elastic IP site 172.168.7.31 Elastic Load Balancer

EC2 - 1

EC2 - 2

EC2 - 1

EC2 - 2

DB Master

Replication

DB Slave

DB Master

Replication

DB Slave

Backup

Backup

Amazon S3

Amazon S3

Copyright 2011 GlobalLogic

23

EC2 + AMI + E-IP + ELB + AutoScaling


All instances in a ELB assigned to a AutoScaling group. AutoScaling takes care of monitoring (using CloudWatch) health of EC2 instances and automates scaling up/down on specific thresholds. Sends notification on each scaling activity. No downtime, assuming no zone failures.

Copyright 2011 GlobalLogic

24

EC2 + AMI + E-IP + ELB + AutoScaling


Your site Your site Elastic IP 172.168.7.31 Elastic Load Balancer Your site Your site Elastic IP 172.168.7.31 Elastic Load Balancer

Auto Scale EC2 - 1 EC2 - 1 EC2 - 2

Auto Scale

EC2 - 2

EC2 - 3

DB Master

Replication

DB Slave

DB Master

Replication

DB Slave

Backup

Backup

Amazon S3

Amazon S3

Copyright 2011 GlobalLogic

25

EC2 + AMI + E-IP + ELB + AS + AZ


Create ELB + AutoScaling group with EC2 instances across multiple availability zones. Amazon allows for ELB and AutoScaling groups to extend beyond a particular AZ. No downtime as long as there is no region wide calamitous situation.

Copyright 2011 GlobalLogic

26

EC2 + AMI + E-IP + ELB + AS + AZ


Your site Your site Elastic IP 172.168.7.31 Elastic Load Balancer Auto Scale Zone 1 EC2 - 1 Zone 2 EC2 - 3 Zone 1 EC2 - 1 Your site Your site Elastic IP 172.168.7.31 Elastic Load Balancer Auto Scale Zone 2 EC2 - 3

EC2 - 2

EC2 - 4

EC2 - 2

EC2 - 4

DB Master

Replication Backup

DB Slave

DB Master

Replication Backup

DB Slave

Amazon S3

Amazon Amazon S3 S3

Copyright 2011 GlobalLogic

27

(EC2 + AMI + E-IP + ELB + AS + AZ) x 2 + Route53


AWS doesn't allow services to span across regions. Inter-region data transfer is also charged. To cast a wider net on HA, need to have a backup site on different Region with identical setup which syncs data from the active site. Using Route53 DNS services we can route the incoming requests to the backup site in case of disasters. Disaster Recovery management with minimal downtime.

Copyright 2011 GlobalLogic

28

AWS Persistence Services (EBS, S3)


S3 : Has SLAs in place for HA. To improve on it, we can replicate objects across different regions. EBS EBS volumes are replicated within an AZ. Better approach: Snapshot EBS volumes to store to S3, which is replicated across AZs. Have more EBS volumes in RAID10 configuration with snapshot backup to S3.

Copyright 2011 GlobalLogic

29

AWS Database Services (RDS + SimpleDB + DynamoDB)


RDS Relational Database (branched off MySQL) with HA across AZ, with automated backups, automatic host replacement. Built on top of EBS; Amazon manages scalability with read replicas. Better approach than using MySQL/PostgreSQL and managing clustering/scaling. SimpleDB/DynamoDB SimpleDB key-value storage; DynamoDB BigTable NoSQL database. Highly available, distributed non-relational database, with builtin fault tolerance through eventual consistency. Suitable for simple document/key-value data storage.
Copyright 2011 GlobalLogic 30

What data to go where

Copyright 2011 GlobalLogic

31

Design for Cloud Best Practices

Copyright 2011 GlobalLogic

32

Best Practices
Design for failure and nothing will fail Decouple your components Implement elasticity Think parallel Keep dynamic data closer to the compute & static data closer to the end-user

Copyright 2011 GlobalLogic

33

Design for Failure


Each component of your solution should be designed to handle failures. Use pre-configured AMIs for application servers for quick launch & faster recovery. Have consistent backup and recovery strategy for all components. Automate instantiation, backup/recovery as much as possible using Chef, Puppet etc. Should support process resumption on instance reboot/instantiation. Support application state restoration by reading messages off SQS or off EBS/S3/SimpleDB. Means application should not store state.

Copyright 2011 GlobalLogic

34

Decouple your components


The more loosely coupled the components of the system, the bigger and better it scales Build asynchronous components and scale horizontally One can build a loosely coupled system using messaging queues.

Copyright 2011 GlobalLogic

35

Implement Elasticity
Use auto-scaling to set thresholds for scaling up or down. Requires having pre-configured AMIs and bootstrapping them. Automate resource management and configuration using Chef, Puppet etc. Use EBS to manage volumes which can be dynamically detached from failing instances and attached to new instances.

Copyright 2011 GlobalLogic

36

Think Parallel
Maximize opportunities to parallelize processing. On demand creation of AWS EC2 instances greatly helps in getting parallel tasks done quicker With ELB you can load-balance dynamically. AWS also gives you MapReduce framework.

Copyright 2011 GlobalLogic

37

Keep dynamic data closer to the compute & static data closer to the end-user
Keep data as close as possible to your compute to reduce latency and cost When large quantity of data available outside the cloud that needs to be processed, it might be cheaper and faster to ship the data to cloud For data generated in the cloud, then the applications that consume the data should also be deployed in the cloud For static data which does not change often (for Eg. images, video, audio, PDFs, JS, CSS files), take advantage of content delivery service (Cloud Front) so that the static data is cached at an edge location closer to the end-user

Copyright 2011 GlobalLogic

38

Q&A

Copyright 2011 GlobalLogic

39

Thank you

Copyright 2011 GlobalLogic

40

Вам также может понравиться