Notikumi
Microsoft 365 kopienas konference
6. maijs 14 - 9. maijs 00
Prasme atbilst AI laikmetam galvenajā kopienas vadītajā Microsoft 365 pasākumā, kas notiks no 6. līdz 8. maijam Lasvegasā.
Uzzināt vairākŠī pārlūkprogramma vairs netiek atbalstīta.
Jauniniet uz Microsoft Edge, lai izmantotu jaunāko līdzekļu, drošības atjauninājumu un tehniskā atbalsta sniegtās priekšrocības.
Typically, testing throttling is hard because it occurs rarely, when Microsoft 365 servers are under heavy load. Using the Dev Proxy, you can simulate throttling responses, and check if your application handles it correctly.
To simulate throttling on Microsoft 365 APIs, use the GraphRandomErrorPlugin and the RetryAfterPlugin. The GraphRandomErrorPlugin
returns throttling responses for Microsoft 365 APIs. The RetryAfterPlugin
verifies that your app backs-off as instructed by the API.
To start, enable the GraphRandomErrorPlugin
and RetryAfterPlugin
in your Dev Proxy configuration file.
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.24.0/rc.schema.json",
"plugins": [
{
"name": "RetryAfterPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll"
},
{
"name": "GraphRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"configSection": "graphRandomErrorPlugin"
}
],
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
"https://graph.microsoft.com/beta/*",
"https://graph.microsoft.us/v1.0/*",
"https://graph.microsoft.us/beta/*",
"https://dod-graph.microsoft.us/v1.0/*",
"https://dod-graph.microsoft.us/beta/*",
"https://microsoftgraph.chinacloudapi.cn/v1.0/*",
"https://microsoftgraph.chinacloudapi.cn/beta/*",
"!https://*.sharepoint.*/*_api/web/GetClientSideComponents",
"https://*.sharepoint.*/*_api/*",
"https://*.sharepoint.*/*_vti_bin/*",
"https://*.sharepoint-df.*/*_api/*",
"https://*.sharepoint-df.*/*_vti_bin/*"
]
}
Uzmanību
Add the RetryAfterPlugin
before the GraphRandomErrorPlugin
in your configuration file. If you add it after, the request will be failed by the GraphRandomErrorPlugin
before the RetryAfterPlugin
has a chance to handle it.
Next, configure the GraphRandomErrorPlugin
to simulate throttling errors.
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.24.0/rc.schema.json",
"plugins": [
{
"name": "RetryAfterPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll"
},
{
"name": "GraphRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"configSection": "graphRandomErrorPlugin"
}
],
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
"https://graph.microsoft.com/beta/*",
"https://graph.microsoft.us/v1.0/*",
"https://graph.microsoft.us/beta/*",
"https://dod-graph.microsoft.us/v1.0/*",
"https://dod-graph.microsoft.us/beta/*",
"https://microsoftgraph.chinacloudapi.cn/v1.0/*",
"https://microsoftgraph.chinacloudapi.cn/beta/*",
"!https://*.sharepoint.*/*_api/web/GetClientSideComponents",
"https://*.sharepoint.*/*_api/*",
"https://*.sharepoint.*/*_vti_bin/*",
"https://*.sharepoint-df.*/*_api/*",
"https://*.sharepoint-df.*/*_vti_bin/*"
],
"graphRandomErrorPlugin": {
"allowedErrors": [ 429 ]
}
}
Start Dev Proxy with your configuration file and test your app to see how it handles throttling.
If your application backs-off when throttled, but doesn't wait for the amount of time specified on the requests, you see a message similar to Calling https://graph.microsoft.com/v1.0/endpoint again before waiting for the Retry-After period. Request will be throttled
.
This message indicates that your application isn't handling throttling correctly and unnecessarily prolongs throttling. To improve how your app handles throttling, update your code to wait for the amount of time specified in the Retry-After
header before retrying the request.
Dev Proxy atsauksmes
Dev Proxy ir atklātā pirmkoda projekts. Atlasiet saiti, lai sniegtu atsauksmes:
Notikumi
Microsoft 365 kopienas konference
6. maijs 14 - 9. maijs 00
Prasme atbilst AI laikmetam galvenajā kopienas vadītajā Microsoft 365 pasākumā, kas notiks no 6. līdz 8. maijam Lasvegasā.
Uzzināt vairākApmācība
Modulis
Protect your APIs on Azure API Management - Training
Protect your backend APIs from information exposure and implement throttling (rate limiting) to prevent resource exhaustion with policies in Azure API Management.
Dokumentācija
Simulate errors from Microsoft Graph APIs - Dev Proxy
How to configure Dev Proxy to simulate errors from Microsoft Graph APIs
Update my application code to use Microsoft Graph JavaScript SDK - Dev Proxy
How to update your application code to use the Microsoft Graph JavaScript SDK