β Repository β πΌ AWS Well-Architected β πΌ Sustainability β πΌ Software and architecture
πΌ SUS03-BP03 Optimize areas of code that consume the most time or resources
- ID:
/frameworks/aws-well-architected/sustainability/software-and-architecture/bp03
Descriptionβ
Optimize your code that runs within different components of your architecture to minimize resource usage while maximizing performance.
Common anti-patterns:
- You ignore optimizing your code for resource usage.
- You usually respond to performance issues by increasing the resources.
- Your code review and development process does not track performance changes.
Benefits of establishing this best practice: Using efficient code minimizes resource usage and improves performance.
Level of risk exposed if this best practice is not established: Medium
Implementation guidanceβ
It is crucial to examine every functional area, including the code for a cloud- architected application, to optimize its resource usage and performance. Continually monitor your workloadβs performance in build environments and production and identify opportunities to improve code snippets that have particularly high resource usage. Adopt a regular review process to identify bugs or anti-patterns within your code that use resources inefficiently. Leverage simple and efficient algorithms that produce the same results for your use case.
Implementation stepsβ
-
Use efficient programming language: Use an efficient operating system and programming language for the workload.
-
Use an AI coding companion: Consider using an AI coding companion such as Amazon Q Developer to efficiently write code.
-
Automate code reviews: While developing your workloads, adopt an automated code review process to improve quality and identify bugs and anti-patterns.
- Automate code reviews with Amazon CodeGuru Reviewer
- Detecting concurrency bugs with Amazon CodeGuru
- Raising code quality for Python applications using Amazon CodeGuru
-
Use a code profiler: Use a code profiler to identify the areas of code that use the most time or resources as targets for optimization.
- Reducing your organization's carbon footprint with Amazon CodeGuru Profiler
- Understanding memory usage in your Java application with Amazon CodeGuru Profiler
- Improving customer experience and reducing cost with Amazon CodeGuru Profiler
-
Monitor and optimize: Use continuous monitoring resources to identify components with high resource requirements or suboptimal configuration.
- Replace computationally intensive algorithms with simpler and more efficient versions that produce the same result.
- Remove unnecessary code such as sorting and formatting.
-
Use code refactoring or transformation: Explore the possibility of Amazon Q code transformation for application maintenance and upgrades.
Similarβ
Sub Sectionsβ
Section | Sub Sections | Internal Rules | Policies | Flags | Compliance |
---|