我们使用cosmos DB并评估系统在负载下的性能。负载低至7-9K请求,我们随机得到服务当前不可用和请求超时错误。
还有其他人遇到过这个问题吗?
下面是代码
创建客户端
private void Initialize()
{
Client = new DocumentClient(new Uri(cosmosDbConfiguration.EndPoint), cosmosDbConfiguration.Key, new ConnectionPolicy
{
RetryOptions = new RetryOptions() { MaxRetryAttemptsOnThrottledRequests = 10, MaxRetryWaitTimeInSeconds = 180 },
ConnectionMode = ConnectionMode.Direct,
ConnectionProtocol = Protocol.Tcp
});
Client.OpenAsync().GetAwaiter();
CreateDatabaseIfNotExistsAsync().Wait();
CreateAllCollectionsIfNotExistsAsync().Wait();
}
创建文档
public async Task<Document> CreateDocumentAsync<T>(string collectionName, T dataRow)
{
return await Client.CreateDocumentAsync(GetCollectionUri(collectionName), dataRow);
}
以下是错误消息以及活动ID
服务当前不可用。 活动编号:6bfcabb0-69b9-4671-b2d1-8bf1a831d77e, RequestStartTime:2019-04-08T21:48:14.3002274Z,尝试的区域数:1 响应时间:2019-04-08T21:48:48.3076636Z,StoreReadResult:StorePhysicalAddress:rntbd://cdb-ms-prod-westus1-fd4.documents.azure.com:14070 / apps / 112e82de-8353-4f6c-804f-e6ce36a8282f / services / 9f5b24ad-6517-4487-855b-ac5e507a6f53 / partitions / e24c749b-c701-4b75-9a16-6dde04028f12 / replicas / 131991744298606536p /,LSN:-1,GlobalCommittedLsn:-1,PartitionKeyRangeId:,IsValid: ,IsGone:True,IsNotFound:False,IsInvalidPartition:False,RequestCharge:0,ItemLSN:-1,SessionToken :、 ResourceType:Document,OperationType:Query ,documentdb-dotnet-sdk / 2.2.1主机/ 64位MicrosoftWindowsNT / 6.2.9200.0
消息:请求超时。 ActivityId:72f7f069-2376-4c71-af44-a78780e53894,请求URI:/ apps / 28ad6635-acc0-4a33-8cbf-513f2a7ecff0 / services / 9015ec89-5cc9-4a36-825d-047766c72037 / partitions / bdc49db7-9018-4dd4-9100- 52dcee4635a4 / replicas / 131992241935694598p /,RequestStats: RequestStartTime:2019-04-08T21:59:06.5769926Z,尝试的区域数:1 ,SDK:documentdb-dotnet-sdk / 2.2.1主机/ 64位MicrosoftWindowsNT / 6.2.9200.0