You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/governance/resource-graph/concepts/guidance-for-throttled-requests.md
+48-55Lines changed: 48 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,27 @@
1
1
---
2
-
title: Guidance for throttled requests
3
-
description: Learn to group, stagger, paginate, and query in parallel to avoid requests being throttled by Azure Resource Graph.
2
+
title: Guidance for throttled requests in Azure Resource Graph
3
+
description: Learn to group, stagger, paginate, and query in parallel to avoid requests being throttled in Azure Resource Graph.
4
4
author: davidsmatlak
5
5
ms.author: davidsmatlak
6
-
ms.date: 08/18/2022
6
+
ms.date: 01/04/2024
7
7
ms.topic: conceptual
8
8
ms.custom: devx-track-csharp
9
9
---
10
+
10
11
# Guidance for throttled requests in Azure Resource Graph
11
12
12
13
When creating programmatic and frequent use of Azure Resource Graph data, consideration should be
13
-
made for how throttling impacts the results of the queries. Changing the way data is requested can
14
+
made for how throttling affects the results of the queries. Changing the way data is requested can
14
15
help you and your organization avoid being throttled and maintain the flow of timely data about your
15
16
Azure resources.
16
17
17
18
This article covers four areas and patterns related to the creation of queries in Azure Resource
18
19
Graph:
19
20
20
-
- Understand throttling headers
21
-
- Grouping queries
22
-
- Staggering queries
23
-
- The impact of pagination
21
+
- Understand throttling headers.
22
+
- Grouping queries.
23
+
- Staggering queries.
24
+
- The effect of pagination.
24
25
25
26
## Understand throttling headers
26
27
@@ -42,20 +43,19 @@ first 10,000 subscriptions and the `x-ms-tenant-subscription-limit-hit` header i
42
43
To illustrate how the headers work, let's look at a query response that has the header and values of
43
44
`x-ms-user-quota-remaining: 10` and `x-ms-user-quota-resets-after: 00:00:03`.
44
45
45
-
- Within the next 3 seconds, at most 10 queries may be submitted without being throttled.
46
-
- In 3 seconds, the values of `x-ms-user-quota-remaining` and `x-ms-user-quota-resets-after` will be
47
-
reset to `15` and `00:00:05` respectively.
46
+
- Within the next 3 seconds, at most 10 queries can be submitted without being throttled.
47
+
- In 3 seconds, the values of `x-ms-user-quota-remaining` and `x-ms-user-quota-resets-after` are reset to `15` and `00:00:05` respectively.
48
48
49
49
To see an example of using the headers to _backoff_ on query requests, see the sample in
50
-
[Query in Parallel](#query-in-parallel).
50
+
[Query in parallel](#query-in-parallel).
51
51
52
52
## Grouping queries
53
53
54
54
Grouping queries by the subscription, resource group, or individual resource is more efficient than
55
55
parallelizing queries. The quota cost of a larger query is often less than the quota cost of many
56
56
small and targeted queries. The group size is recommended to be less than _300_.
57
57
58
-
- Example of a poorly optimized approach
58
+
- Example of a poorly optimized approach.
59
59
60
60
```csharp
61
61
// NOT RECOMMENDED
@@ -76,7 +76,7 @@ small and targeted queries. The group size is recommended to be less than _300_.
76
76
}
77
77
```
78
78
79
-
-Example#1ofanoptimizedgroupingapproach
79
+
-Exampleofanoptimizedgroupingapproach.
80
80
81
81
```csharp
82
82
// RECOMMENDED
@@ -99,7 +99,7 @@ small and targeted queries. The group size is recommended to be less than _300_.
99
99
}
100
100
```
101
101
102
-
- Example #2of an optimized grouping approach for getting multiple resources in one query
102
+
- Example of an optimized grouping approach for getting multiple resources in one query.
103
103
104
104
```kusto
105
105
Resources | where id in~ ({resourceIdGroup}) | project name, type
@@ -129,22 +129,21 @@ small and targeted queries. The group size is recommended to be less than _300_.
129
129
130
130
## Staggering queries
131
131
132
-
Because of the way throttling is enforced, we recommend queries to be staggered. That is, instead of
133
-
sending 60 queries at the same time, stagger the queries into four 5-second windows:
132
+
Because of the way throttling is enforced, we recommend queries to be staggered. For example, instead of sending 60 queries at the same time, stagger the queries into four 5-second windows.
Since Azure Resource Graph returns at most 1,000 entries in a single query response, you may need to
209
-
[paginate](./work-with-data.md#paging-results) your queries to get the complete dataset you're
210
-
looking for. However, some Azure Resource Graph clients handle pagination differently than others.
211
-
212
-
- C# SDK
206
+
Because Azure Resource Graph returns a maximum of 1,000 entries in a single query response, you might need to [paginate](./work-with-data.md#paging-results) your queries to get the complete dataset you want. But some Azure Resource Graph clients handle pagination differently than others.
213
207
214
-
When using ResourceGraph SDK, you need to handle pagination by passing the skip token being
215
-
returned from the previous query response to the next paginated query. This design means you need
216
-
to collect results from all paginated calls and combine them together at the end. In this case,
217
-
each paginated query you send takes one query quota:
208
+
When using ResourceGraph SDK, you need to handle pagination by passing the skip token being
209
+
returned from the previous query response to the next paginated query. This design means you need
210
+
to collect results from all paginated calls and combine them together at the end. In this case,
211
+
each paginated query you send takes one query quota.
If you used this article's recommendations and your Azure Resource Graph queries are still being throttled, contact the [Azure Resource Graph team](mailto:[email protected]). The team supports Azure Resource Graph but doesn't support [Microsoft Graph throttling](/graph/throttling).
244
237
245
-
Provide these details:
238
+
Provide these details when you contact the Azure Resource Graph team:
246
239
247
240
- Your specific use-case and business driver needs for a higher throttling limit.
248
241
- How many resources do you have access to? How many of the are returned from a single query?
0 commit comments