

# PERF02-BP01 为工作负载选择最佳计算方案
<a name="perf_compute_hardware_select_best_compute_options"></a>

 通过为工作负载选择最合适的计算方案，可以提高性能，减少不必要的基础设施成本以及维护工作负载所需的运营工作。

 **常见反模式：**
+  使用本地所用的计算方案。
+  对云计算方案、功能和解决方案以及这些解决方案可以如何提高计算性能缺乏认识。
+  为了满足扩展或性能要求，过度预置现有计算方案，而使用替代计算方案可以更准确地满足工作负载特征需求。

 **建立此最佳实践的好处：**通过确定计算要求并对可用方案进行评估，可以让工作负载更高效地利用资源。

 **在未建立这种最佳实践的情况下暴露的风险等级：**高 

## 实施指导
<a name="implementation-guidance"></a>

 为了提高性能效率而优化云工作负载时，请务必根据应用场景和性能要求选择最合适的计算方案。AWS 提供了多种计算方案，可满足云中不同工作负载的需求。例如，您可以使用 [Amazon EC2](https://docs.aws.amazon.com/ec2/) 启动和管理虚拟服务器，使用 [AWS Lambda](https://docs.aws.amazon.com/lambda/?icmpid=docs_homepage_featuredsvcs) 运行代码而不必预置或管理服务器，使用 [Amazon ECS](https://aws.amazon.com/ecs/) 或 [Amazon EKS](https://aws.amazon.com/eks/) 运行和管理容器，或者使用 [AWS Batch](https://aws.amazon.com/batch/) 并行处理大量数据。应根据自己的规模和计算需求，选择和配置最适合自己情况的计算解决方案。也可以考虑在单个工作负载中使用多种类型的计算解决方案，因为每种解决方案都有自己的优缺点。

 以下步骤将指导您根据自身工作负载的特征和性能要求，选择合适的计算方案。

## 实施步骤
<a name="implementation-steps"></a>
+  了解工作负载计算要求。需要考虑的关键要求包括：处理需求、流量模式、数据访问模式、扩展需求和延迟要求。
+  了解适用于工作负载的不同 [AWS 计算服务](https://docs.aws.amazon.com/whitepapers/latest/aws-overview/compute-services.html)。有关更多信息，请参阅 [PERF01-BP01 了解并掌握可用的云服务和功能](perf_architecture_understand_cloud_services_and_features.md)。以下介绍了一些关键的 AWS 计算方案、这些方案的特征和常见应用场景：    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/wellarchitected/latest/framework/perf_compute_hardware_select_best_compute_options.html)
+  评估与每种计算方案相关的成本（如每小时费用或数据传输）和管理开销（如修补和扩展）。
+  在非生产环境中进行试验和基准测试，确定哪种计算方案最能满足工作负载要求。
+  试验并确定新的计算解决方案后，规划迁移并验证性能指标。
+  使用 [Amazon CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html) 等 AWS 监控工具和 [AWS Compute Optimizer](https://aws.amazon.com/compute-optimizer/) 等优化服务，根据实际使用模式持续优化计算资源。

 

## 资源
<a name="resources"></a>

 **相关文档：**
+  [使用 AWS 进行云计算](https://aws.amazon.com/products/compute/?ref=wellarchitected) 
+  [Amazon EC2 实例类型](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html?ref=wellarchitected) 
+  [Amazon EKS 容器：Amazon EKS Worker 节点](https://docs.aws.amazon.com/eks/latest/userguide/worker.html?ref=wellarchitected) 
+  [Amazon ECS 容器：Amazon ECS 容器实例](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html?ref=wellarchitected) 
+  [函数：Lambda 函数配置](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html?ref=wellarchitected#function-configuration) 
+ [Prescriptive Guidance for Containers](https://aws.amazon.com/prescriptive-guidance/?apg-all-cards.sort-by=item.additionalFields.sortText&apg-all-cards.sort-order=desc&awsf.apg-new-filter=*all&awsf.apg-content-type-filter=*all&awsf.apg-code-filter=*all&awsf.apg-category-filter=categories%23containers&awsf.apg-rtype-filter=*all&awsf.apg-isv-filter=*all&awsf.apg-product-filter=*all&awsf.apg-env-filter=*all) 
+  [Prescriptive Guidance for Serverless](https://aws.amazon.com/prescriptive-guidance/?apg-all-cards.sort-by=item.additionalFields.sortText&apg-all-cards.sort-order=desc&awsf.apg-new-filter=*all&awsf.apg-content-type-filter=*all&awsf.apg-code-filter=*all&awsf.apg-category-filter=categories%23serverless&awsf.apg-rtype-filter=*all&awsf.apg-isv-filter=*all&awsf.apg-product-filter=*all&awsf.apg-env-filter=*all) 

 **相关视频：**
+  [AWS re:Invent 2023 - AWS Graviton: The best price performance for your AWS workloads](https://www.youtube.com/watch?v=T_hMIjKtSr4&ab_channel=AWSEvents) 
+  [AWS re:Invent 2023 - New Amazon Elastic Compute Cloud generative AI capabilities in AMS](https://www.youtube.com/watch?v=sSpJ8tWCEiA) 
+  [AWS re:Invent 2023 - What’s new with Amazon Elastic Compute Cloud](https://www.youtube.com/watch?v=mjHw_wgJJ5g) 
+  [AWS re:Invent 2023 - Smart savings: Amazon Elastic Compute Cloud cost-optimization strategies](https://www.youtube.com/watch?v=_AHPbxzIGV0) 
+  [AWS re:Invent 2021 - Powering next-gen Amazon Elastic Compute Cloud: Deep dive on the Nitro System](https://www.youtube.com/watch?v=2uc1vaEsPXU) 
+  [AWS re:Invent 2019 - Optimize performance and cost for your AWS compute](https://www.youtube.com/watch?v=zt6jYJLK8sg) 
+  [AWS re:Invent 2019 - Amazon Elastic Compute Cloud foundations](https://www.youtube.com/watch?v=kMMybKqC2Y0) 
+  [AWS re:Invent 2022 - Deploy ML models for inference at high performance and low cost](https://www.youtube.com/watch?v=4FqHt5bmS2o) 
+  [AWS re:Invent 2019 - Optimize performance and cost for your AWS compute ](https://www.youtube.com/watch?v=zt6jYJLK8sg) 
+  [Amazon EC2 foundations](https://www.youtube.com/watch?v=kMMybKqC2Y0) 
+  [部署 ML 模型，以便进行高性能和低成本的推理](https://www.youtube.com/watch?v=4FqHt5bmS2o) 

 **相关示例：**
+  [Migrating the Web application to containers](https://application-migration-with-aws.workshop.aws/en/container-migration.html) 
+  [运行无服务器程序“Hello World”](https://aws.amazon.com/getting-started/hands-on/run-serverless-code/) 
+  [Amazon EKS 研讨会](https://www.eksworkshop.com/) 
+  [Amazon EC2 讲习会](https://ec2spotworkshops.com/) 
+  [Efficient and Resilient Workloads with Amazon Elastic Compute Cloud Auto Scaling](https://catalog.us-east-1.prod.workshops.aws/workshops/20c57d32-162e-4ad5-86a6-dff1f8de4b3c/en-US) 
+  [Migrating to AWS Graviton with Container Services](https://catalog.us-east-1.prod.workshops.aws/workshops/dcab7555-32fc-42d2-97e5-2b7a35cd008f/en-US/) 