Performance efficiency pillar in AWS - Time & Space Complexity
We want to understand how the time to perform cloud tasks changes as we add more resources or users.
How does the system keep up when demand grows?
Analyze the time complexity of the following operation sequence.
// Create multiple EC2 instances
for (let i = 0; i < n; i++) {
ec2.runInstances({
ImageId: 'ami-12345678',
InstanceType: 't3.micro',
MinCount: 1,
MaxCount: 1
}).promise();
}
This sequence launches n EC2 instances one by one to handle increased workload.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: EC2 runInstances API call to launch one instance
- How many times: n times, once per instance
Each new instance requires a separate API call and provisioning time.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 EC2 runInstances calls |
| 100 | 100 EC2 runInstances calls |
| 1000 | 1000 EC2 runInstances calls |
Pattern observation: The number of operations grows directly with the number of instances requested.
Time Complexity: O(n)
This means the time to launch instances grows in direct proportion to how many you want.
[X] Wrong: "Launching more instances happens instantly and does not add time."
[OK] Correct: Each instance requires a separate API call and setup time, so more instances mean more total time.
Understanding how cloud operations scale helps you design systems that stay fast as they grow.
"What if we launched instances in parallel instead of one by one? How would the time complexity change?"
Practice
Solution
Step 1: Understand the purpose of the Performance Efficiency pillar
This pillar focuses on how well your system performs and adapts to changes in demand. Only To make sure your system runs fast and adapts to changes talks about running fast and adapting, which matches the pillar's goal.Final Answer:
To make sure your system runs fast and adapts to changes -> Option AQuick Check:
Performance Efficiency = Fast and adaptable system [OK]
- Confusing performance with security
- Thinking cost reduction is the main goal
- Mixing organization with performance
Solution
Step 1: Identify the service that adjusts server count automatically
AWS Auto Scaling changes the number of servers based on demand. Eliminate unrelated services: Amazon S3 stores files, Amazon RDS manages databases, and AWS IAM controls access, so they don't adjust server numbers.Final Answer:
AWS Auto Scaling -> Option DQuick Check:
Auto Scaling = Adjust servers automatically [OK]
- Choosing storage or database services instead
- Confusing IAM with scaling
- Not knowing what Auto Scaling does
Solution
Step 1: Understand ELB and Auto Scaling roles
ELB spreads traffic across servers; Auto Scaling adds servers when demand rises. Auto Scaling will add servers to handle more users, and ELB will balance the load.Final Answer:
Auto Scaling adds more servers and ELB distributes traffic evenly -> Option CQuick Check:
More traffic = More servers + balanced load [OK]
- Thinking ELB rejects traffic
- Assuming the app crashes immediately
- Believing Auto Scaling removes servers on high load
Solution
Step 1: Check Auto Scaling configuration
If scaling policies are missing or incorrect, Auto Scaling won't add servers when needed. Using ELB correctly helps performance, a fast database is good, and monitoring helps detect issues, so they are not causes.Final Answer:
Auto Scaling is not configured with proper scaling policies -> Option AQuick Check:
Wrong scaling policies cause slow response [OK]
- Blaming ELB when it's set up right
- Thinking a fast database causes slowdowns
- Ignoring the importance of scaling policies
Solution
Step 1: Identify best practices for unpredictable traffic
Auto Scaling adjusts servers automatically, ELB balances traffic, and fast SSD storage speeds data access. Use Auto Scaling with Elastic Load Balancer and fast SSD storage uses all these features, while others rely on manual or slow methods.Final Answer:
Use Auto Scaling with Elastic Load Balancer and fast SSD storage -> Option BQuick Check:
Auto Scaling + ELB + fast storage = best performance [OK]
- Choosing fixed or manual scaling
- Ignoring load balancing
- Using slow storage for performance
Ready to prove it?
Pass the test and this pattern moves unknown
