

# 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>

1.  了解工作负载计算要求。需要考虑的关键要求包括：处理需求、流量模式、数据访问模式、扩展需求和延迟要求。 

1.  了解适用于 AWS 上工作负载的不同计算方案（如 [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/2023-10-03/framework/perf_compute_hardware_select_best_compute_options.html)

1.  评估与每种计算方案相关的成本（如每小时费用或数据传输）和管理开销（如修补和扩展）。 

1.  在非生产环境中进行试验和基准测试，确定哪种计算方案最能满足您的工作负载需求。 

1.  试验并确定新的计算解决方案后，规划迁移并验证性能指标。 

1.  使用 AWS 监控工具（如 [Amazon CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html) ）和优化服务（如 [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) 
+ [容器规范性指南](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) 
+  [无服务器规范性指南](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) 

 **相关视频：** 
+  [如何为初创企业选择计算方案](https://aws.amazon.com/startups/start-building/how-to-choose-compute-option/) 
+  [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&ref=wellarchitected) 
+  [Powering next-gen Amazon EC2: Deep dive into the Nitro system ](https://www.youtube.com/watch?v=rUY-00yFlE4&ref=wellarchitected) 
+  [Deploy ML models for inference at high performance and low cost](https://www.youtube.com/watch?v=4FqHt5bmS2o) 
+  [Better, faster, cheaper compute: Cost-optimizing Amazon EC2](https://www.youtube.com/watch?v=_dvh4P2FVbw&ref=wellarchitected) 

 **相关示例：** 
+  [将 Web 应用程序迁移到容器](https://application-migration-with-aws.workshop.aws/en/container-migration.html) 
+  [运行无服务器 Hello World](https://aws.amazon.com/getting-started/hands-on/run-serverless-code/) 