Skip to content

Commit 9aa4c7e

Browse files
authored
Add documentation for new RNTBD fields
1 parent 0a86859 commit 9aa4c7e

File tree

1 file changed

+87
-54
lines changed

1 file changed

+87
-54
lines changed

articles/cosmos-db/sql/troubleshoot-dot-net-sdk-slow-request.md

Lines changed: 87 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,21 @@ try
5757
ItemResponse<Book> response = await this.Container.CreateItemAsync<Book>(item: testItem);
5858
if (response.Diagnostics.GetClientElapsedTime() > ConfigurableSlowRequestTimeSpan)
5959
{
60-
// Log the diagnostics and add any additional info necessary to correlate to other logs
61-
Console.Write(response.Diagnostics.ToString());
60+
// Log the response.Diagnostics.ToString() and add any additional info necessary to correlate to other logs
6261
}
6362
}
6463
catch (CosmosException cosmosException)
6564
{
66-
// Log the full exception including the stack trace
67-
Console.Write(cosmosException.ToString());
68-
// The Diagnostics can be logged separately if required.
69-
Console.Write(cosmosException.Diagnostics.ToString());
65+
// Log the full exception including the stack trace with: cosmosException.ToString()
66+
67+
// The Diagnostics can be logged separately if required with: cosmosException.Diagnostics.ToString()
7068
}
7169

7270
// When using Stream APIs
7371
ResponseMessage response = await this.Container.CreateItemStreamAsync(partitionKey, stream);
7472
if (response.Diagnostics.GetClientElapsedTime() > ConfigurableSlowRequestTimeSpan || !response.IsSuccessStatusCode)
7573
{
76-
// Log the diagnostics and add any additional info necessary to correlate to other logs
77-
Console.Write(response.Diagnostics.ToString());
74+
// Log the diagnostics and add any additional info necessary to correlate to other logs with: response.Diagnostics.ToString()
7875
}
7976
```
8077

@@ -202,58 +199,94 @@ Show the time for the different stages of sending and receiving a request in the
202199
* *Transit time is large*, which leads to a networking problem. Compare this number to the `BELatencyInMs`. If `BELatencyInMs` is small, then the time was spent on the network, and not on the Azure Cosmos DB service.
203200
* *Received time is large* might be caused by a thread starvation problem. This is the time between having the response and returning the result.
204201

202+
### <a name="ServiceEndpointStatistics"></a>ServiceEndpointStatistics
203+
Information about a particular backend server. The SDK can open multiple connections to a single backend server depending upon the number of pending requests and the MaxConcurrentRequestsPerConnection.
204+
205+
* `inflightRequests` The number of pending requests to a backend server (maybe from different partitions). A high number may to lead to more traffic and higher latencies.
206+
* `openConnections` is the total Number of connections open to a single backend server. This can be useful to show SNAT port exhausion if this number is very high.
207+
208+
### <a name="ConnectionStatistics"></a>ConnectionStatistics
209+
Information about the particular connection (new or old) the request get's assigned to.
210+
211+
* `waitforConnectionInit`: The current request was waiting for new connection initialization to complete. This will lead to higher latencies.
212+
* `callsPendingReceive`: Number of calls that was pending receive before this call was sent. A high number can show us that there were a lot of calls before this call and it may lead to higher latencies. If this number is high it points to a head of line blocking issue possibly caused by another request like query or feed operation that is taking a long time to process. Try lowering the CosmosClientOptions.MaxRequestsPerTcpConnection to increase the number of channels.
213+
* `LastSentTime`: Time of last request that was sent to this server. This along with LastReceivedTime can be used to see connectivity or endpoint issues. For example if there are a lot of receive timeouts, Sent time will be much larger than the Receive time.
214+
* `lastReceive`: Time of last request that was received from this server
215+
* `lastSendAttempt`: Time of the last send attempt
216+
217+
### <a name="Request and response sizes"></a>Request and response sizes
218+
* `requestSizeInBytes`: The total size of the request sent to Cosmos DB
219+
* `responseMetadataSizeInBytes`: The size of headers returned from Cosmos DB
220+
* `responseBodySizeInBytes`: The size of content returned from Cosmos DB
221+
205222
```json
206223
"StoreResult": {
207-
"ActivityId": "a3d325c1-f4e9-405b-820c-bab4d329ee4c",
208-
"StatusCode": "Created",
224+
"ActivityId": "bab6ade1-b8de-407f-b89d-fa2138a91284",
225+
"StatusCode": "Ok",
209226
"SubStatusCode": "Unknown",
210-
"LSN": 1766,
211-
"PartitionKeyRangeId": "0",
212-
"GlobalCommittedLSN": -1,
213-
"ItemLSN": -1,
214-
"UsingLocalLSN": false,
215-
"QuorumAckedLSN": 1765,
216-
"SessionToken": "-1#1766",
217-
"CurrentWriteQuorum": 1,
218-
"CurrentReplicaSetSize": 1,
227+
"LSN": 453362,
228+
"PartitionKeyRangeId": "1",
229+
"GlobalCommittedLSN": 0,
230+
"ItemLSN": 453358,
231+
"UsingLocalLSN": true,
232+
"QuorumAckedLSN": -1,
233+
"SessionToken": "-1#453362",
234+
"CurrentWriteQuorum": -1,
235+
"CurrentReplicaSetSize": -1,
219236
"NumberOfReadRegions": 0,
220-
"IsClientCpuOverloaded": false,
221237
"IsValid": true,
222-
"StorePhysicalAddress": "rntbd://127.0.0.1:10253/apps/DocDbApp/services/DocDbServer92/partitions/a4cb49a8-38c8-11e6-8106-8cdcd42c33be/replicas/1p/",
223-
"RequestCharge": 11.05,
224-
"BELatencyInMs": "7.954",
225-
"RntbdRequestStats": [
226-
{
227-
"EventName": "Created",
228-
"StartTime": "2021-06-15T13:53:10.1302477Z",
229-
"DurationInMicroSec": "6383"
230-
},
231-
{
232-
"EventName": "ChannelAcquisitionStarted",
233-
"StartTime": "2021-06-15T13:53:10.1366314Z",
234-
"DurationInMicroSec": "96511"
235-
},
236-
{
237-
"EventName": "Pipelined",
238-
"StartTime": "2021-06-15T13:53:10.2331431Z",
239-
"DurationInMicroSec": "50834"
240-
},
241-
{
242-
"EventName": "Transit Time",
243-
"StartTime": "2021-06-15T13:53:10.2839774Z",
244-
"DurationInMicroSec": "17677"
238+
"StorePhysicalAddress": "rntbd://127.0.0.1:10253/apps/DocDbApp/services/DocDbServer92/partitions/a4cb49a8-38c8-11e6-8106-8cdcd42c33be/replicas/1s/",
239+
"RequestCharge": 1,
240+
"RetryAfterInMs": null,
241+
"BELatencyInMs": "0.304",
242+
"transportRequestTimeline": {
243+
"requestTimeline": [
244+
{
245+
"event": "Created",
246+
"startTimeUtc": "2022-05-25T12:03:36.3081190Z",
247+
"durationInMs": 0.0024
248+
},
249+
{
250+
"event": "ChannelAcquisitionStarted",
251+
"startTimeUtc": "2022-05-25T12:03:36.3081214Z",
252+
"durationInMs": 0.0132
253+
},
254+
{
255+
"event": "Pipelined",
256+
"startTimeUtc": "2022-05-25T12:03:36.3081346Z",
257+
"durationInMs": 0.0865
258+
},
259+
{
260+
"event": "Transit Time",
261+
"startTimeUtc": "2022-05-25T12:03:36.3082211Z",
262+
"durationInMs": 1.3324
263+
},
264+
{
265+
"event": "Received",
266+
"startTimeUtc": "2022-05-25T12:03:36.3095535Z",
267+
"durationInMs": 12.6128
268+
},
269+
{
270+
"event": "Completed",
271+
"startTimeUtc": "2022-05-25T12:03:36.8621663Z",
272+
"durationInMs": 0
273+
}
274+
],
275+
"serviceEndpointStats": {
276+
"inflightRequests": 1,
277+
"openConnections": 1
245278
},
246-
{
247-
"EventName": "Received",
248-
"StartTime": "2021-06-15T13:53:10.3016546Z",
249-
"DurationInMicroSec": "7079"
279+
"connectionStats": {
280+
"waitforConnectionInit": "False",
281+
"callsPendingReceive": 0,
282+
"lastSendAttempt": "2022-05-25T12:03:34.0222760Z",
283+
"lastSend": "2022-05-25T12:03:34.0223280Z",
284+
"lastReceive": "2022-05-25T12:03:34.0257728Z"
250285
},
251-
{
252-
"EventName": "Completed",
253-
"StartTime": "2021-06-15T13:53:10.3087338Z",
254-
"DurationInMicroSec": "0"
255-
}
256-
],
286+
"requestSizeInBytes": 447,
287+
"responseMetadataSizeInBytes": 438,
288+
"responseBodySizeInBytes": 604
289+
},
257290
"TransportException": null
258291
}
259292
```
@@ -265,4 +298,4 @@ Contact [Azure support](https://aka.ms/azure-support).
265298
## Next steps
266299

267300
* [Diagnose and troubleshoot](troubleshoot-dot-net-sdk.md) problems when you use the Azure Cosmos DB .NET SDK.
268-
* Learn about performance guidelines for [.NET v3](performance-tips-dotnet-sdk-v3-sql.md) and [.NET v2](performance-tips.md).
301+
* Learn about performance guidelines for [.NET v3](performance-tips-dotnet-sdk-v3-sql.md) and [.NET v2](performance-tips.md).

0 commit comments

Comments
 (0)