8000 How is API throttling handled in the PowerShell Graph functions? · Issue #281 · microsoftgraph/msgraph-sdk-powershell · GitHub
[go: up one dir, main page]

Skip to content

How is API throttling handled in the PowerShell Graph functions? #281

@KirkMunro

Description

@KirkMunro

From https://docs.microsoft.com/en-us/graph/throttling, Microsoft states:

When a throttling threshold is exceeded, Microsoft Graph limits any further requests from that client for a period of time. When throttling occurs, Microsoft Graph returns HTTP status code 429 (Too many requests), and the requests fail. A suggested wait time is returned in the response header of the failed request. Throttling behavior can depend on the type and number of requests. For example, if you have a high volume of requests, all requests types are throttled. Threshold limits vary based on the request type. Therefore, you could encounter a scenario where writes are throttled but reads are still permitted.

That's somewhat...vague. In large environments where various resource types can easily exceed 50000 in number, when many API calls are one per resource (or multiple per resource if you're pulling back multiple pieces of information), two things become essential: batching requests (assuming that batched requests result in lower counts as far as API limits are concerned), and proper handling of API limits.

For the latter, since PowerShell abstracts away from all of the lower-level REST API calls, what is it doing to handle status code 429?

If the answer to that is simply "nothing yet", then I have a request: add a common parameter to Graph cmdlets called -RetryCount that identifies the number of times you want to retry a given command before it is considered failed, with an internal maximum limit that cannot be exceeded, and handle status code 429 by sleeping for the recommended wait period before trying again internally within Graph commands, up to the maximum number of retries.

Regardless of that request, please share details on what happens now when throttling comes into effect and what the plans are moving forward. Thank you.
AB#7417

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0