It is often difficult to visualize and understand how elasticity works in AWS.
This demo aims to showcase how an application is able to cope with spiky traffic by increasing the number of compute instances based on CPU utilization
The Web UI consist of 3 sections:
This section provides an overview of the number of running instances. Instance serving the request is highlighted in "Green" while instances that are "running" are displayed in "Grey"
This section provides the
- Overall CPU utilization of the Auto-Scaling Group (ASG) instances,
- Total number of "running" instances
- Total number of instance in service that are able to respond to request
This section provides a historical list of instance metadata that has served a request
Each task will opens 100 connections and send 5000 request every 10 seconds for 4 mins
Due to load generation, group CPU utilization will increase over the threshold of 10%. Auto scaling group will be triggered to add additional resources. Once provision, the instance will need pass health check for the next 20 seconds before being added to the application load balancer.
We use Cloudformation to provision our infrastructure
Existing Jenkins server and Ansible script can be repurposed to deploy application to AWS
- Operates mainly out of Asia Pacific (Singapore)
- Workload is a small web application that uses resources in equal proportion
- Most of the traffic happens between 0800 - 2200 (10 hours), with uncertain and unpredictable usage pattern
- A total of 10,000 users, with an average of 1 requests per second
- Each request last an average of 1 second and transfer around 300KB of data
- An estimated usage of 1TB of object storage usage
- Compute resources needed
- 2 baseline instances - minimum needed for non-peak user traffic
- 4 peak instances - maximum needed to handle spike
- Usage of Multi AZ for High availability
Estimated total cost of running this workload: ~$896/month or ~$0.89/customer
With a 1 year commitment, you get ~15.5% discount: ~$758/month or ~$0.75/customer
Service | Pricing | Per month | Estimated cost | Estimated cost w 1 year commitment (reserved instance)* |
---|---|---|---|---|
Cloudfront | $0.140/GB | 300kb * 3600 request per hour * 300 hours | $45.36 | $45.36 |
S3 | $0.025/GB | 1000GB | $25 | $25 |
ELB, Application Load balancer | $0.0252/hour | 720 hour | $18.45 | $18.45 |
Nat Gateway | $0.059/hour | 720 * 2 gateway | $85 | $85 |
Nat Gateway - Data processed | $0.059/GB | 50GB * 2 gateway | $5.90 | $5.90 |
EC2, T3.large - 2 vcpu, 8GiB | $0.1056/hour | 720 hour * 2 instances | $152.01 | $90.5 |
EC2, T3.large - 2 vcpu, 8GiB | $0.1056/hour | 300 hour * 4 instances | $126.72 | $126.72 |
RDS compute - Multi AZ (T3.large) | $0.416/hour | 720 hour | $299.52 | $223.16 |
RDS storage - Multi AZ (20GB) | $0.276/GB | 500 GB | $138 | $138 |
Total | ~$896 | ~$758 |
*Standard 1 year commitment - all upfront