Scalability & Resilience with AWS

What is Scalability?

Scalability is the capacity for an architecture to grow vertically (increasing the power of the machines) or horizontally (adding new machines) depending on the parameter (example: CPU usage or traffic).

AWS has an auto-scaling service that automatically resizes your instance clusters. You set the minimum and maximum number of your instance pool. The machines will start and stop automatically according to your needs and within your limits.

With Cloud Watch, you can manage on what you want to scale: CPU utilization, latency, network traffic. It is also possible to use custom metrics.

What is Resilience ?

Resilience is the ability of an architecture to continue providing the same quality of service even if some of its resources become inaccessible. For example, if one of your web servers falls over, the website continues to work properly.

AWS has several choices that provide your architectures resilience, such as the RDS Multi-AZ deployment that allows you to have multiple databases with different datacenters, so if a datacenter with your database fails, the other replications take over. You can also do this with your web servers and ELB service to redirect your traffic only to the operational servers.

Introduction

Below is a list of AWS architectures of varying complexities. The choice is made according to your budget and your traffic. Some of these architectures offer resilience or scalability.

1 user

When you’re building your infrastructure you need basic components to start your web application.  

You have a single instance (Amazon EC2). You attach an Elastic IP address to it. And you put an entry in AWS managed DNS service (Route 53). That’s simple to run your first app in AWS!

A more powerful instance will soon be needed if you have more traffic or actions on your application. It is possible to start with a “t2.micro” but if performance is of any concern, it will be necessary to move to an m3.xlarge or even more. All the magic of AWS lies in the fact that you can increase the size of your servers on-demand, but this is a manual action. Attention, with this instance there’s no failover, no redundancy.

RESILIENCE : NO
SCALABILITY : NO

Find this stack on Artifakt Marketplace.

From than 1 user to 100

Once there are several users on your web application, you should consider separating the database from the web server. That way you can scale your instances independently of each other. Indeed, the website & data have different needs.

The possibility of using a database management service makes it possible to not have a team specifically dedicated to administering the database. Here AWS offers Self-Managed services (Amazon EC2) or Fully Managed services (Amazon RDS, Amazon DynamoDB, Amazon Redshift).

The objective of this approach is to have copies of your data in multiple places so you never lose it. Plus, if the web server instance falls over, you don’t lose your data and your database.

Beyond 100 users, I strongly advise you to use the micro services that AWS offers. For example, add in an RDS multi-AZ for better failover.

RESILIENCE : A BIT (Database and web server apart)
SCALABILITY : NO

Find this stack on Artifakt Marketplace.

More than 1,000 users

The more users there are on the web app, the more failover and redundancy issues arise. The first thing to do is to add a new web instance in a second availability zone.

The latency between these two availability zones is a few milliseconds.

Finally, Elastic Load Balancing (ELB) enables the users to be divided between web instance 1 or 2, according to the traffic in each of the availability zones. If one of the web servers becomes unavailable, the Load Balancer redirects the traffic to the other web server (resilience).

RESILIENCE : YES FULL
SCALABILITY : NO

10,000 – 100,000 users

By adding a multitude of availability zones and web instances within each, it is possible to accommodate more than 100,000 concurrent users on your application.

Put static content in Amazon S3 (object-based store: good place to put all static content – JavaScript, CSS files, images, videos) & front it with Amazon CloudFront. These elements do not need to be in one instance but rather separate ones, allowing for better performance and cost reduction.

RESILIENCE : YES FULL
SCALABILITY : YES

Over 1,000,000 users

Your app can accommodate over 1 million users using all of the above mentioned items:

  • Multi availability zone: by adding the number of instances your app needs in each of the multiple availability zones as required.
  • Elastic Load Balancing
  • Auto Scaling
  • Service Oriented Architecture
  • Serving content smartly
  • Caching off DB
  • Moving state off tiers that auto scale

Beyond 1 million users, each availability zone then looks like this schema. It’s not just about scalability, but about high availability.

Other microservices can be added:

  • Amazon SES: sending mail
  • CloudWatch: monitoring → not only for auto scaling but also for everything regarding your application in the AWS infrastructure
  • Lambda and Worker Instance: Will be the subject of an upcoming blog post (propose a post subject!)

RESILIENCE : YES FULL
SCALABILITY : YES FULL

Follow Artifakt.io news on social media

Camille Benard
Camille Benard
Share