azure-cosmosdb - Cosmos DB - 较慢的性能问题
问题描述
这些天来,在我们的 cosmos db 中,我们有非分区集合,最近将我们的应用程序数据移动到分区集合以克服单个分区上 10gb 的上限。
在引入分区之后我们注意到的几件事。
ResourceResponse.ContentLocation 属性返回 null。(通常它返回像“dbs/developmentdb/colls/accountmodel”这样的集合路径作为非分区集合的值)
对于“GetAll”查询(提供在分区和非分区集合中维护的相同数据)
- RUs 上升(从 400RUs 到 750RUs)
- 响应时间较慢
供您参考,下面包含使用的代码。感谢您对减少 RU 和提高响应时间 (OR) 的任何建议,这些都是迁移到分区集合的开销吗?请建议
使用的示例代码:
var docClient = await _documentClient;
var docDb = await _documentDatabase;
var docCollection = await _documentCollection;
var queryFeed = new FeedOptions()
{
MaxItemCount = -1,
MaxDegreeOfParallelism = -1,
EnableCrossPartitionQuery = true
};
var documentCollectionUri = UriFactory.CreateDocumentCollectionUri(docDb.Id, docCollection.Id);
IDocumentQuery<T> query = docClient.CreateDocumentQuery<T>(documentCollectionUri, queryFeed).AsDocumentQuery();
while (query.HasMoreResults)
{
var page = await query.ExecuteNextAsync<T>();
result.AddRange(page);
_rULogHelper.LogFromFeedResponse(page, docDb.Id, docCollection.Id, DBOperationType.GET.ToString()); //custom logging related code
}
解决方案
推荐阅读
- azure - 如何将 Office365 Exchange 与我的 Azure Portal AD 连接/同步?
- c++ - C++:使用“auto”在二维数组上嵌套 For 循环
- angular - Angular 9 - 指令,如何从组件中读取属性
- git - 关于通过 SSH 和 GitHub 上的现有存储库部署到实时 Web 服务器的建议
- javascript - React Router:组件未呈现,但 URL 已更新
- android - Android Studio - 此应用程序无法启动,因为无法初始化 Qt 平台插件
- c - 小字典的散列
- oracle11g - 如何使用 SQL Developer 在 oracle 中导出/导入 DB 转储?
- c# - Excel将我的数字的最后一位更改为零
- python - 熊猫中的 groupby() 和 agg()