Sub topic 6
Performance Efficiency: using resources effectively
This chapter assumes you know the core AWS services (EC2, S3, VPC, CloudWatch) and the shared responsibility model from earlier chapters. It also assumes you know how a review uses questions and risk levels. The chapter covers the pillar's goal, its design principles, its five focus areas, how to measure performance, the common mistakes, and how the pillar trades off against the others.
What the pillar is about
The Performance Efficiency pillar is about using computing resources efficiently to meet system requirements, and keeping that efficiency as demand and technology change. It does not mean "make everything as fast as possible". It means choosing the right resource types and sizes for the workload, and revisiting those choices over time.
Two ideas run through the pillar:
- Performance is a requirement you measure, not a feeling. A requirement such as "95% of checkout requests finish in under 300 ms" can be tested. "The site should be fast" cannot.
- The best choice today may not be the best choice next year. AWS releases new instance families, storage classes, and managed services all the time. A workload that never revisits its choices drifts away from efficient.
Under the shared responsibility model, AWS is responsible for the performance of the underlying infrastructure. You are responsible for selecting and configuring the services, sizing them, and measuring the result.
Design principles
The framework lists five design principles for this pillar.
- Democratize advanced technologies. Consume complex capabilities such as machine learning, media transcoding, or NoSQL databases as managed services. Your team spends its time using the capability instead of learning to run it.
- Go global in minutes. Deploy in multiple Regions, or use edge locations, to cut latency for users who are far from your primary Region.
- Use serverless architectures. Services such as AWS Lambda, Amazon DynamoDB, and AWS Fargate remove the work of provisioning and scaling servers. Capacity follows demand.
- Experiment more often. Cloud resources are cheap to create and delete. Load-test a different instance family or database engine, compare the results, and keep the winner.
- Consider mechanical sympathy. Choose the technology that fits how you access the data. A key-value lookup, a relational join, and a full-text search each suit a different engine. Match the tool to the access pattern.
The five focus areas
Reviews group the pillar's questions into focus areas. The table maps each one to its typical decisions.
| Focus area | Question it answers | Typical decisions |
|---|---|---|
| Architecture selection | Which overall pattern fits? | Serverless, containers, or virtual machines; synchronous or event-driven |
| Compute and hardware | Which compute and how big? | Instance family, Graviton or x86, GPU, Lambda memory size, Auto Scaling policy |
| Data management | Where and how is data stored and accessed? | Database engine, storage class, caching, partitioning, read replicas |
| Networking and content delivery | How do requests travel? | Region choice, CloudFront, VPC endpoints, Global Accelerator, protocol choice |
| Process and culture | How do you keep it efficient? | Load testing, monitoring, performance reviews, trade-off documentation |
Architecture selection
Start from the workload's characteristics: request pattern, latency target, state, and team skills. A spiky, event-driven job such as thumbnail generation fits Lambda. A steady, high-throughput service with long-lived connections often fits containers or EC2 better. Document why you chose the pattern. A future reviewer needs to know which assumptions the choice depends on.
Compute and hardware
Right-size from data. Look at utilization over a representative period, not one quiet afternoon. Instances with consistently low CPU and memory use are oversized. Instances that run hot, with high CPU, queueing, or throttling, are undersized.
AWS Compute Optimizer analyzes CloudWatch metrics and recommends instance types. This command lists recommendations for your EC2 instances. Compute Optimizer must be enabled for the account first.
aws compute-optimizer get-ec2-instance-recommendations \
--max-results 5 \
--query 'instanceRecommendations[].{Instance:instanceArn,Finding:finding,Current:currentInstanceType,Options:recommendationOptions[0].instanceType}' \
--output tableA finding of OVER_PROVISIONED means a smaller or cheaper type would likely meet the same demand. UNDER_PROVISIONED means the instance is likely limiting performance.
Also consider processor architecture. AWS Graviton instances often give better price-performance for workloads that can run on ARM, but you must confirm that your binaries and container images support arm64.
Scaling belongs here too. Auto Scaling policies should track a metric that reflects real load, such as request count per target or queue depth. CPU alone is often a poor proxy for load.
Data management
Data choices usually dominate performance. The main levers are:
- Engine fit. Use a relational database for transactions and joins, DynamoDB for predictable single-digit-millisecond key lookups at scale, and a search service for text queries.
- Caching. Put Amazon ElastiCache in front of hot reads, or use DynamoDB Accelerator, to avoid repeated expensive queries.
- Access pattern design. A DynamoDB partition key that concentrates traffic on a few values creates a hot partition and throttling, however much capacity you provision.
- Storage type. Choose EBS volume types by IOPS and throughput need, and S3 storage classes by access frequency.
Networking and content delivery
Latency is bounded by distance. Put workloads in the Region closest to most users, and serve static and cacheable content from CloudFront edge locations. Use VPC endpoints so traffic to services such as S3 and DynamoDB stays on the AWS network instead of going through a NAT gateway. Place components that talk often, such as an application tier and its cache, in the same Availability Zone where your availability design allows, because cross-AZ calls add latency and data transfer charges.
Process and culture
Performance work is a loop, not a one-time tuning pass. The loop is: define targets, measure, change one thing, measure again, and record the result.
Measuring performance
You cannot judge efficiency without metrics. Collect them at four levels:
- User experience: latency percentiles (p50, p95, p99) and error rates. Averages hide slow tails, so track percentiles.
- Application: request rates, queue depth, cache hit ratio, and database query time.
- Resource: CPU, memory, disk I/O, and network throughput. Memory is not collected by CloudWatch for EC2 by default, so install the CloudWatch agent.
- Synthetic checks: scheduled canary requests (CloudWatch Synthetics) that measure the user path even when real traffic is low.
Use AWS X-Ray or another tracing tool to find which downstream call makes a request slow. Set CloudWatch alarms on the targets you defined, so a regression pages someone before users complain.
Reviewing the pillar in the Well-Architected Tool
The earlier chapters introduced the Tool. To see the performance questions and their current answers for a workload, filter by pillar. The pillar ID for this pillar is performance.
aws wellarchitected list-answers \
--workload-id <workload-id> \
--lens-alias wellarchitected \
--pillar-id performanceEach question in the output has a Risk value such as UNANSWERED, NONE, MEDIUM, or HIGH. A question such as "How do you select appropriate cloud resources?" may be marked high risk if you never evaluate instance types after launch. That finding goes into your improvement plan.
Common errors
- Choosing once and never revisiting. An instance family picked three years ago may now cost more and run slower than a current one. Schedule a periodic review.
- Sizing from guesses. Estimates made before launch are rarely right. Load-test with realistic data and traffic shape, then adjust from production metrics.
- Tuning the wrong layer. Doubling instance size will not fix a missing database index or a hot partition. Find the bottleneck with traces first.
- Watching averages only. A p50 of 80 ms with a p99 of 4 s means one in a hundred users has a bad experience.
- Ignoring cold starts and scaling lag. Lambda cold starts and slow Auto Scaling warm-up can break latency targets during sudden spikes. Provisioned concurrency or pre-warmed capacity can address this at a cost.
- Caching without an invalidation plan. A cache that serves stale data trades a performance problem for a correctness problem.
Trade-offs with other pillars
Performance Efficiency seldom wins automatically. The common conflicts are:
| Performance choice | Pillar under pressure | Why |
|---|---|---|
| Over-provision for peak load | Cost Optimization, Sustainability | Idle capacity costs money and energy |
| Multi-Region deployment for latency | Cost Optimization, Operational Excellence | More resources, replication costs, and more to operate |
| Aggressive caching | Reliability, Security | Stale data, and cached sensitive data needs protection |
| Skipping encryption to save CPU | Security | Rarely worth it, because modern hardware handles TLS cheaply |
Some choices help several pillars at once. Right-sizing cuts cost and energy use. Moving to Graviton or serverless often improves price-performance and efficiency together. When a real conflict exists, record the decision and the reason. The review process asks for exactly that record.
Exercise
A team's API shows a p50 latency of 90 ms but a p99 of 3.5 s. CPU on every instance stays below 25%. A trace shows the slow requests spend most of their time on one DynamoDB query. What should the team check before resizing the instances, and which focus area does this fall under?
Show answer
They should check the DynamoDB access pattern, especially whether the partition key creates a hot partition, whether the query uses a scan instead of a key lookup, and whether a cache would remove repeated reads. Low CPU shows the compute tier is not the bottleneck, so resizing instances would not help. This falls under Data management, with the tail-latency measurement belonging to Process and culture.
Exercise
Name two design principles from this pillar and give one practical action for each in a workload that processes uploaded images.
Show answer
Using serverless architectures: trigger a Lambda function from an S3 upload event to resize images, so capacity scales with the number of uploads. Experiment more often: load-test the resize function at several memory sizes, because Lambda allocates CPU in proportion to memory, then keep the setting with the best cost and duration. Going global with CloudFront for delivering the resized images is also an acceptable second action.