针对 Azure Cosmos DB 自动提出的建议Automated recommendations for Azure Cosmos DB

所有云服务(包括 Azure Cosmos DB)都会通过频繁更新来提供新的特性、功能和改进内容。All the cloud services including Azure Cosmos DB get frequent updates with new features, capabilities, and improvements. 对于应用程序来说,跟上最新的性能和安全更新非常重要。It's important for your application to keep up with the latest performance and security updates. Azure 门户提供了让你可以最大限度地提高应用程序性能的自定义建议。The Azure portal offers customized recommendations that enable you to maximize the performance of your application. Azure Cosmos DB 的顾问引擎会持续分析 Azure Cosmos DB 资源的使用情况历史记录,并根据工作负载模式提供建议。The Azure Cosmos DB's advisory engine continuously analyzes the usage history of your Azure Cosmos DB resources and provides recommendations based on your workload patterns. 这些建议对应于分区、索引编制、网络和安全性等领域。这些自定义建议有助于提高应用程序的性能。These recommendations correspond to areas like partitioning, indexing, network, security etc. These customized recommendations help you to improve the performance of your application.

查看建议View recommendations

可以通过以下方式查看针对 Azure Cosmos DB 的建议:You can view recommendations for Azure Cosmos DB in the following ways:

  • 查看建议的一种方法是使用“通知”选项卡。如果有新的建议,则会出现一个消息栏。One way to view the recommendations is within the notifications tab. If there are new recommendations, you will see a message bar. 登录到 Azure 门户,导航到你的 Azure Cosmos 帐户。Sign into your Azure portal and navigate to your Azure Cosmos account. 在你的 Azure Cosmos 帐户中,打开“通知”窗格,然后选择“建议”选项卡。你可以选择消息并查看建议。Within your Azure Cosmos account, open the Notifications pane and then select the Recommendations tab. You can select the message and view recommendations.

    从 Azure Cosmos DB 窗格中查看建议

  • 还可以通过 Azure 顾问查找按不同的 Bucket(例如成本、安全性、可靠性、性能和运营绩效)分类的建议。You can also find the recommendations through Azure Advisor in categorized by different buckets such as cost, security, reliability, performance, and operational excellence. 可以选择特定订阅并按资源类型(即 Azure Cosmos DB 帐户)进行筛选。You can select specific subscriptions and filter by the resource type, which is Azure Cosmos DB accounts. 选择某个特定建议后,它会显示可供采用的有益于你的工作负载的操作。When you select a specific recommendation, it displays the actions you can take to benefit your workloads.

    从 Azure 顾问窗格查看建议

并非 Azure Cosmos DB 窗格中显示的所有建议都会显示在 Azure 顾问中,反之亦然。Not all recommendations shown in the Azure Cosmos DB pane are available in the Azure Advisor and vice versa. 这是因为,它们会根据建议类型相应地显示在 Azure 顾问窗格、Azure Cosmos DB 窗格或同时显示在两者中。That's because based on the type of recommendation they fit in either the Azure Advisor pane, Azure Cosmos DB pane or both.

Azure Cosmos DB 目前支持针对以下领域的建议。Currently Azure Cosmos DB supports recommendations on the following areas. 其中每个建议都包含指向文档的相关部分的链接,因此,你可以轻松执行后续步骤。Each of these recommendations includes a link to the relevant section of the documentation, so it's easy for you to take the next steps.

SDK 使用建议SDK usage recommendations

在此类别中,顾问检测到你使用了旧版 SDK,因此建议你升级到更新的版本,以利用最新的 bug 修复和性能改进。In this category, the advisor detects the usage of an old version of SDKs and recommends that you upgrade to a newer version to leverage the latest bug fixes and performance improvements. 目前提供了以下特定于 SDK 的建议:Currently the following SDK-specific recommendations are available:

名称Name 描述Description
旧的 Spark 连接器Old Spark connector 检测到使用了早期版本的 Spark 连接器,建议升级。Detects the usage of old versions of the Spark connector and recommends upgrading.
旧的 .NET SDKOld .NET SDK 检测到使用了早期版本的 .NET SDK,建议升级。Detects the usage of old versions of the .NET SDK and recommends upgrading.
旧的 Java SDKOld Java SDK 检测到使用了早期版本的 Java 连接器,建议升级。Detects the usage of old versions of the Java connector and recommends upgrading.

索引编制建议Indexing recommendations

在此类别中,顾问会检测索引编制模式、索引编制策略、索引路径,并会在当前配置影响查询性能的情况下提供更改建议。In this category, the advisor detects the indexing mode, indexing policy, indexed paths and recommends changing if the current configuration impacts the query performance. 目前提供了以下特定于索引编制的建议:Currently the following indexing-specific recommendations are available:

名称Name 描述Description
惰性索引编制Lazy indexing 检测到使用了惰性索引编制模式,建议改用一致的索引编制模式。Detects usage of lazy indexing mode and recommends using consistent indexing mode instead. Azure Cosmos DB 的惰性索引编制模式的用途有限,在某些情况下会影响查询结果的新鲜度,因此建议使用一致的索引编制模式。The purpose of Azure Cosmos DB's lazy indexing mode is limited and can impact the freshness of query results in some situations so consistent indexing mode is recommended.
复合索引编制Composite indexing 检测到其中的查询可以从复合索引中受益的帐户,建议使用它们。Detects the accounts where queries could benefit from composite indexes and recommend using them. 复合索引可以显著改进某些查询的性能和吞吐量消耗。Composite indexes can dramatically improve the performance and throughput consumption of some queries.
具有许多索引路径的默认索引编制策略Default indexing policy with many indexed paths 检测到以默认索引编制方式运行的具有许多索引路径的容器,建议自定义索引编制策略。Detects containers running on default indexing with many indexed paths and recommends customizing the indexing policy.
RU/秒费用很高的 ORDER BY 查询ORDER BY queries with high RU/s charge 检测到所发出的 ORDER BY 查询具有很高的 RU/秒费用的容器,建议尝试使用复合索引。Detects containers issuing ORDER BY queries with high RU/s charge and recommends exploring composite indexes.
无索引且 RU/秒消耗很高的 MongoDB 3.6 帐户MongoDB 3.6 accounts with no index and high RU/s consumption 检测到使用 3.6 版容器的 Azure Cosmos DB API for MongoDB 以很高的 RU/秒费用发出查询,建议添加索引。Detects Azure Cosmos DB's API for MongoDB with 3.6 version of containers issuing queries with high RU/s charge and recommends adding indexes.

成本优化建议Cost optimization recommendations

在此类别中,顾问在检测 RU/秒使用情况后,确定你可以通过对资源进行一些更改或利用不同的定价模型来优化价格。In this category, the advisor detects the RU/s usage and determines that you can optimize the price by making some changes to your resources or by leveraging a different pricing model. 目前提供了以下特定于成本优化的建议:Currently the following cost optimization-specific recommendations are available:

名称Name 描述Description
非活动容器Inactive containers 检测到超过 30 天未使用的容器,建议减小此类容器的吞吐量或删除它们。Detects the containers that haven't been used for more than 30 days and recommends reducing the throughput for such containers or deleting them.
吞吐量高的新订阅New subscriptions with high throughput 检测到其中的帐户每天支出的 RU/秒费用非常高的新订阅,向它们提供了通知。Detects new subscriptions with accounts spending unusually high RU/s per day and provides them a notification. 此通知专用于让新客户知道 Azure Cosmos DB 使用基于预配吞吐量的模型运行,而非使用基于消耗的模型运行。This notification is specifically to bring awareness to new customers that Azure Cosmos DB operates on provisioned throughput-based model and not consumption-based model.

迁移建议Migration recommendations

在此类别中,顾问检测到你使用的是旧功能,建议进行迁移,以便能够利用 Azure Cosmos DB 的巨大可伸缩性和其他优点。In this category, the advisor detects that you are using legacy features recommends migrating so that you can leverage Azure Cosmos DB's massive scalability and other benefits. 目前提供了以下特定于迁移的建议:Currently the following migration-specific recommendations are available:

名称Name 描述Description
未分区的容器Non-partitioned containers 检测到固定大小的容器即将达到其最大存储限制,建议将它们迁移到已分区容器。Detects fixed-size containers that are approaching their max storage limit and recommends migrating them to partitioned containers.

查询使用情况建议Query usage recommendations

在此类别中,顾问会在检测查询执行情况后确定能否通过一些更改来优化查询性能。In this category, the advisor detects the query execution and identifies that the query performance can be tuned with some changes. 目前提供了以下查询使用情况建议:Currently the following query usage recommendations are available:

名称Name 描述Description
具有固定页面大小的查询Queries with fixed page size 检测到使用固定页面大小发出的查询,建议使用 -1(不限制页面大小)而非定义特定值。Detects queries issued with a fixed page size and recommends using -1 (no limit on the page size) instead of defining a specific value. 此选项可减少检索所有结果所需的网络往返次数。This option reduces the number of network round trips required to retrieve all results.

后续步骤Next steps