

# PERF03-BP02 评估数据存储的可用配置选项
<a name="perf_data_evaluate_configuration_options_data_store"></a>

 了解并评估数据存储的各种可用功能和配置选项，从而优化工作负载的存储空间和性能。

 **常见反模式：**
+  对所有工作负载都只使用一种存储类型，例如 Amazon EBS。
+  对所有工作负载都使用预调配 IOPS，而没有对所有存储层进行真实测试。
+  不了解所选数据管理解决方案的配置选项。
+  只依赖于增加实例大小，而没有考虑其他可用的配置选项。
+  没有测试数据存储的扩展特性。

 **建立此最佳实践的好处：**通过探索和试用数据存储选项，也许能够降低基础设施成本、提高性能并减少维护工作负载所需的工作量。

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

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

 根据数据存储和访问要求，一个工作负载能够使用一个或多个数据存储。要优化性能效率和成本，必须评估数据访问模式来确定适当的数据存储配置。在研究数据存储选项时，要考虑存储选项、内存、计算、只读副本、一致性要求、连接池和缓存选项等各个方面。尝试使用这些不同的配置选项来改进性能效率指标。

### 实施步骤
<a name="implementation-steps"></a>
+  了解数据存储的当前配置（如实例类型、存储大小或数据库引擎版本）。
+  查看 AWS 文档和最佳实践，了解有助于提高数据存储性能的推荐配置选项。需要考虑的关键数据存储选项如下：


<table>
<thead>
  <tr><th> 配置选项 </th><th> 示例 </th></tr>
</thead>
<tbody>
  <tr><td> 分流读取操作（例如只读副本和缓存） </td><td> <ul><li>  对于 DynamoDB 表，您可以使用 DAX 缓存功能来分流读取操作。 </li><li>  您可以创建一个 Amazon ElastiCache（Redis OSS）集群，并将应用程序配置为首先从缓存中读取，并在请求的项目不存在时使用数据库。 </li><li>  关系数据库（如 Amazon RDS 和 Aurora）以及预置的 NoSQL 数据库（如 Neptune 和 Amazon DocumentDB）全部支持添加只读副本，以便分流工作负载的读取部分。 </li><li>  DynamoDB 等无服务器数据库将自动扩展。确保您预置了足够的读取容量单位（RCU）来处理工作负载。 </li></ul> </td></tr>
  <tr><td> 扩展写入（例如分区键分片或引入队列） </td><td> <ul><li>  对于关系数据库，您可以增加实例的大小来适应增加的工作负载，或增加预调配 IOPS 来增加底层存储的吞吐量。 </li><li>  您还可以在数据库前面引入队列，而不是直接写入数据库。借助此模式，您可以将摄取操作与数据库解耦，并控制流量，这样数据库就不会过载。   </li><li>  对写入请求进行批处理，而不是创建许多短期事务，这样有助于提高有大量写入的关系数据库的吞吐量。 </li><li>  像 DynamoDB 这样的无服务器数据库可以自动扩展写入吞吐量，也可以根据容量模式调整预置的写入容量单位（WCU）。   </li><li>  当达到给定分区键的吞吐量限制时，仍然会遇到热分区问题。这可以通过选择更均匀分布的分区键或对分区键进行写分片来缓解。   </li></ul> </td></tr>
  <tr><td> 用于管理数据集生命周期的策略 </td><td> <ul><li>  您可以使用 <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html">Amazon S3 生命周期</a>在对象的整个生命周期中对其进行管理。如果访问模式未知、变化或不可预测，则可以使用 <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering.html">Amazon S3 Intelligent-Tiering</a>，因为此功能可监控访问模式并自动将尚未访问的对象移动到成本较低的访问层。您可以利用 <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage_lens.html">Amazon S3 Storage Lens 存储统计管理工具</a>指标来识别生命周期管理中的优化机会和差距。 </li><li>  <a href="https://docs.aws.amazon.com/efs/latest/ug/lifecycle-management-efs.html">Amazon EFS 生命周期管理</a>会自动为文件系统管理文件存储。 </li></ul> </td></tr>
  <tr><td> 连接管理和连接池 </td><td> <ul><li>  Amazon RDS 代理可与 Amazon RDS 和 Aurora 结合使用来管理与数据库的连接。   </li><li>  DynamoDB 等无服务器数据库没有与之关联的连接，但会考虑根据预置容量和自动扩展策略来处理负载峰值。 </li></ul> </td></tr>
</tbody>
</table>

+  在非生产环境中进行试验和基准测试，确定哪种配置选项可以满足工作负载要求。
+  试验完成后，规划迁移并验证性能指标。
+  使用 AWS 监控工具（如 [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/)）和优化工具（如 [Amazon S3 Storage Lens 存储统计管理工具](https://aws.amazon.com/s3/storage-lens/)），在实际使用模式下持续优化数据存储。

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

 **相关文档：**
+  [使用 AWS 进行云存储](https://aws.amazon.com/products/storage/?ref=wellarchitected) 
+  [Amazon EBS 卷类型](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) 
+  [Amazon EC2 存储](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Storage.html) 
+  [Amazon EFS：Amazon EFS 性能](https://docs.aws.amazon.com/efs/latest/ug/performance.html) 
+  [适用于 Lustre 的 Amazon FSx 性能](https://docs.aws.amazon.com/fsx/latest/LustreGuide/performance.html) 
+  [适用于 Windows File Server 的 Amazon FSx 性能](https://docs.aws.amazon.com/fsx/latest/WindowsGuide/performance.html) 
+  [Amazon Glacier：Amazon Glacier 文档](https://docs.aws.amazon.com/amazonglacier/latest/dev/introduction.html) 
+  [Amazon S3：请求速率和性能注意事项](https://docs.aws.amazon.com/AmazonS3/latest/dev/request-rate-perf-considerations.html) 
+  [Amazon EBS I/O 特性](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-io-characteristics.html) 
+  [ 云数据库AWS](https://aws.amazon.com/products/databases/?ref=wellarchitected) 
+  [AWS 数据库缓存](https://aws.amazon.com/caching/database-caching/?ref=wellarchitected) 
+  [DynamoDB Accelerator](https://aws.amazon.com/dynamodb/dax/?ref=wellarchitected) 
+  [Amazon Aurora 最佳实践](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.BestPractices.html?ref=wellarchitected) 
+  [Amazon Redshift 性能](https://docs.aws.amazon.com/redshift/latest/dg/c_challenges_achieving_high_performance_queries.html?ref=wellarchitected) 
+  [Amazon Athena 十大性能技巧](https://aws.amazon.com/blogs/big-data/top-10-performance-tuning-tips-for-amazon-athena/?ref=wellarchitected) 
+  [Amazon Redshift Spectrum 最佳实践](https://aws.amazon.com/blogs/big-data/10-best-practices-for-amazon-redshift-spectrum/?ref=wellarchitected) 
+  [Amazon DynamoDB 最佳实践](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/BestPractices.html?ref=wellarchitected) 

 **相关视频：**
+  [AWS re:Invent 2023: Improve Amazon Elastic Block Store efficiency and be more cost-efficient](https://www.youtube.com/watch?v=7-CB02rqiuw) 
+  [AWS re:Invent 2023: Optimize storage price and performance with Amazon Simple Storage Service](https://www.youtube.com/watch?v=RxgYNrXPOLw) 
+  [AWS re:Invent 2023: Building and optimizing a data lake on Amazon Simple Storage Service](https://www.youtube.com/watch?v=mpQa_Zm1xW8) 
+  [AWS re:Invent 2023: What's new with AWS file storage](https://www.youtube.com/watch?v=yXIeIKlTFV0) 
+  [AWS re:Invent 2023: Dive deep into Amazon DynamoDB](https://www.youtube.com/watch?v=ld-xoehkJuU) 

 **相关示例：**
+  [AWS Purpose Built Databases 讲习会](https://catalog.us-east-1.prod.workshops.aws/workshops/93f64257-52be-4c12-a95b-c0a1ff3b7e2b/en-US) 
+  [Databases for Developers](https://catalog.workshops.aws/db4devs/en-US) 
+  [AWS Modern Data Architecture Immersion Day](https://catalog.us-east-1.prod.workshops.aws/workshops/32f3e732-d67d-4c63-b967-c8c5eabd9ebf/en-US) 
+  [Amazon EBS Autoscale](https://github.com/awslabs/amazon-ebs-autoscale) 
+  [Amazon S3 示例](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-examples.html) 
+  [Amazon DynamoDB 示例](https://github.com/aws-samples/aws-dynamodb-examples) 
+  [AWS 数据库迁移示例](https://github.com/aws-samples/aws-database-migration-samples) 
+  [Database Modernization 讲习会](https://github.com/aws-samples/amazon-rds-purpose-built-workshop) 
+  [Working with parameters on your Amazon RDS for Postgress DB](https://github.com/awsdocs/amazon-rds-user-guide/blob/main/doc_source/Appendix.PostgreSQL.CommonDBATasks.Parameters.md) 