Getting Started with Microsoft Graph and Throttling

Microsoft 365 Developer · Beginner ·📰 AI News & Updates ·7y ago
Skills: API Design70%

Key Takeaways

Microsoft Graph throttling limits concurrent calls to prevent overuse of resources, and implements rate-limiting using HTTP status code 429 and retry-after headers

Full Transcript

hello everyone thanks for joining us I'm sorry and today I'm joined by Peter well today we're going to be talking about straddling so Peter what is startling and why do we even have it in Microsoft graph sure every web api needs some form of rate-limiting especially a public API that is exposed for everyone to call we don't have any way of influencing how you're gonna write your code so as a service we need to protect ourselves from applications calling too much consuming too many resources which would affect other applications trying to call Microsoft graph so and it happens all the time we see it in our internal development as well as third-party developers not fully realizing what the volume of all their calls will be and they often find out in production so we have we need a way to not only protect the service but also to let them know that maybe they were making too many calls ok ok so so how does Microsoft graph implement this targeting at some level it's very simple when the when the API decides that you're calling it too much it responds with an error with a status code 4 to 9 okay and it provides a retry after volume panda header so it's basically telling you hey you're calling me too much why don't you back off wait this period of time and then you can try again ok and it's very it's very important that your application code expects that error mmm and it that it does the right thing when it sees it if you for example just kept retrying all the time without backing off the service will keep throttling you and you might never recover ok ok so that the time keeps going in loops or the retry headers what you said 'keep yes it keeps going back ok exactly so let me show you what that looks like in practice absolutely so I have an app here that I wrote in c-sharp ok it's more of a background process app its job is to call Microsoft graph as far as fast as it can - in this case perform license removal operations in a director directory and I know that API is a fairly low throttling level so I picked it for this example okay so what I want to show here I'll just run the app and it's really issuing parallel requests against Microsoft graph okay and I set a break breakpoint somewhere where where I catch that 4:00 to 9:00 and response okay that I mentioned so here we are I'll show you how what this looks like in JSON format so as you can see here in the headers the status is four to nine I'm being throttled and in the headers section I have the retry after header okay and with the value of ten in this case okay since these are dynamic values and that's ten second seconds yes and here I have some human readable information in this case it's telling me that the specific reason why I got through all the implementing implemented by Azure Active Directory ok so what I do here in my application I take that value from the header and I read that request to my retry queues so I implemented retry queues and I put it there with the 10-second interval and my app will pick that request later on ok so if you had a user interface application you've probably handled it a different way you tell the user about the fact that they need to wait a little bit but here I'm just going through all the requests as fast as I can and when I get throttle I just pause and wait a little bit alright that was awesome Peter thank you so much for the overview about darling and thank you everyone for joining us and if you want more information on throttling please look at our documentation on graph Microsoft com thank you

Original Description

Throttling limits the number of concurrent calls to a service to prevent overuse of resources. Microsoft Graph is designed to handle a high volume of requests. If an overwhelming number of requests occurs, throttling helps maintain optimal performance and reliability of the Microsoft Graph service. Learn more about throttling guidance in this video. To learn more about Microsoft Graph and Throttling, visit https://docs.microsoft.com/en-us/graph/throttling. For additional Microsoft Graph tools and resources, visit https://graph.microsoft.com.
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Microsoft 365 Developer · Microsoft 365 Developer · 0 of 60

← Previous Next →
1 Adaptive Cards community call-February 2019
Adaptive Cards community call-February 2019
Microsoft 365 Developer
2 PowerApps community call-February 2019
PowerApps community call-February 2019
Microsoft 365 Developer
3 Microsoft Graph community call-March 2019
Microsoft Graph community call-March 2019
Microsoft 365 Developer
4 Office Add ins community call-March 2019
Office Add ins community call-March 2019
Microsoft 365 Developer
5 PowerApps community call-March 2019
PowerApps community call-March 2019
Microsoft 365 Developer
6 Microsoft Teams community call-March 2019
Microsoft Teams community call-March 2019
Microsoft 365 Developer
7 Using React and Office UI Fabric React Components
Using React and Office UI Fabric React Components
Microsoft 365 Developer
8 Build Microsoft Teams customization using SharePoint Framework
Build Microsoft Teams customization using SharePoint Framework
Microsoft 365 Developer
9 Microsoft Graph community call-April 2019
Microsoft Graph community call-April 2019
Microsoft 365 Developer
10 Using Change Notifications and Track Changes with Microsoft Graph
Using Change Notifications and Track Changes with Microsoft Graph
Microsoft 365 Developer
11 Office Add Ins community call-April 2019
Office Add Ins community call-April 2019
Microsoft 365 Developer
12 Adaptive Cards community call-April 2019
Adaptive Cards community call-April 2019
Microsoft 365 Developer
13 Microsoft Teams community call-April 2019
Microsoft Teams community call-April 2019
Microsoft 365 Developer
14 Getting Started with Microsoft Graph and Application Registration
Getting Started with Microsoft Graph and Application Registration
Microsoft 365 Developer
15 Getting Started with Microsoft Graph and the Directory API
Getting Started with Microsoft Graph and the Directory API
Microsoft 365 Developer
16 Getting Started with Microsoft Graph and Microsoft Teams
Getting Started with Microsoft Graph and Microsoft Teams
Microsoft 365 Developer
17 Getting Started with Microsoft Graph Explorer
Getting Started with Microsoft Graph Explorer
Microsoft 365 Developer
18 Getting Started with Microsoft Graph
Getting Started with Microsoft Graph
Microsoft 365 Developer
19 Getting Started with Microsoft Graph and Mail API
Getting Started with Microsoft Graph and Mail API
Microsoft 365 Developer
20 Getting Started with Microsoft Graph and Office 365 Groups
Getting Started with Microsoft Graph and Office 365 Groups
Microsoft 365 Developer
21 Getting Started with Microsoft Graph and the Calendar API
Getting Started with Microsoft Graph and the Calendar API
Microsoft 365 Developer
22 Getting Started with the Microsoft Graph Toolkit
Getting Started with the Microsoft Graph Toolkit
Microsoft 365 Developer
23 Getting Started with Microsoft Graph and JavaScript SDKs
Getting Started with Microsoft Graph and JavaScript SDKs
Microsoft 365 Developer
24 Getting Started with Microsoft Graph and .NET SDKs
Getting Started with Microsoft Graph and .NET SDKs
Microsoft 365 Developer
25 Discover how businesses can be more productive with Microsoft 365 integrations
Discover how businesses can be more productive with Microsoft 365 integrations
Microsoft 365 Developer
26 Adaptive Cards community call-May 2019
Adaptive Cards community call-May 2019
Microsoft 365 Developer
27 Office Add-ins community call-May 2019
Office Add-ins community call-May 2019
Microsoft 365 Developer
28 Why We Built on Microsoft Teams
Why We Built on Microsoft Teams
Microsoft 365 Developer
29 Microsoft Teams community call-May 2019
Microsoft Teams community call-May 2019
Microsoft 365 Developer
30 Microsoft Graph community call-June 2019
Microsoft Graph community call-June 2019
Microsoft 365 Developer
31 Build Angular SPA's with Microsoft Graph - June 2019
Build Angular SPA's with Microsoft Graph - June 2019
Microsoft 365 Developer
32 Office Add -ins community call-June 2019
Office Add -ins community call-June 2019
Microsoft 365 Developer
33 Build Android native apps with the Microsoft Graph Android SDK - June 2019
Build Android native apps with the Microsoft Graph Android SDK - June 2019
Microsoft 365 Developer
34 Build MVC apps with Microsoft Graph - June 2019
Build MVC apps with Microsoft Graph - June 2019
Microsoft 365 Developer
35 Authenticate and connect with Microsoft Graph - June 2019
Authenticate and connect with Microsoft Graph - June 2019
Microsoft 365 Developer
36 Microsoft Graph data connect - June 2019
Microsoft Graph data connect - June 2019
Microsoft 365 Developer
37 Change notifications with Microsoft Graph - June 2019
Change notifications with Microsoft Graph - June 2019
Microsoft 365 Developer
38 Build iOS native apps with the Microsoft Graph REST API - June 2019
Build iOS native apps with the Microsoft Graph REST API - June 2019
Microsoft 365 Developer
39 Build Node.js Express apps with Microsoft Graph - June 2019
Build Node.js Express apps with Microsoft Graph - June 2019
Microsoft 365 Developer
40 Smart UI with Microsoft Graph - June 2019
Smart UI with Microsoft Graph - June 2019
Microsoft 365 Developer
41 Leveraging the Microsoft Graph API from the SharePoint Framework - June 2019
Leveraging the Microsoft Graph API from the SharePoint Framework - June 2019
Microsoft 365 Developer
42 Build UWP apps with Microsoft Graph - June 2019
Build UWP apps with Microsoft Graph - June 2019
Microsoft 365 Developer
43 Build React SPA's with Microsoft Graph - June 2019
Build React SPA's with Microsoft Graph - June 2019
Microsoft 365 Developer
44 Getting Started with Microsoft Graph and Batching
Getting Started with Microsoft Graph and Batching
Microsoft 365 Developer
45 Getting Started with Microsoft Graph and Change Notifications
Getting Started with Microsoft Graph and Change Notifications
Microsoft 365 Developer
46 Getting Started with Microsoft Graph and Consent Permissions
Getting Started with Microsoft Graph and Consent Permissions
Microsoft 365 Developer
47 Getting Started with Microsoft Graph and Education
Getting Started with Microsoft Graph and Education
Microsoft 365 Developer
48 Getting Started with Microsoft Graph and Financials
Getting Started with Microsoft Graph and Financials
Microsoft 365 Developer
49 Getting Started with Microsoft Graph and Excel
Getting Started with Microsoft Graph and Excel
Microsoft 365 Developer
50 Getting Started with Microsoft Graph and Data Connect
Getting Started with Microsoft Graph and Data Connect
Microsoft 365 Developer
51 Getting Started with Microsoft Graph and Intune
Getting Started with Microsoft Graph and Intune
Microsoft 365 Developer
52 Getting Started with Microsoft Graph and Notifications
Getting Started with Microsoft Graph and Notifications
Microsoft 365 Developer
53 Getting Started with Microsoft Graph and OneNote
Getting Started with Microsoft Graph and OneNote
Microsoft 365 Developer
54 Getting Started with Microsoft Graph and OneDrive
Getting Started with Microsoft Graph and OneDrive
Microsoft 365 Developer
55 Getting Started with Microsoft Graph and Open Extensions
Getting Started with Microsoft Graph and Open Extensions
Microsoft 365 Developer
56 Getting Started with Microsoft Graph and Paging
Getting Started with Microsoft Graph and Paging
Microsoft 365 Developer
57 Getting Started with Microsoft Graph and Schema Extensions
Getting Started with Microsoft Graph and Schema Extensions
Microsoft 365 Developer
58 Getting Started with Microsoft Graph and Security API
Getting Started with Microsoft Graph and Security API
Microsoft 365 Developer
59 Getting Started with Microsoft Graph and Query Parameters
Getting Started with Microsoft Graph and Query Parameters
Microsoft 365 Developer
60 Getting Started with Microsoft Graph and Reporting API
Getting Started with Microsoft Graph and Reporting API
Microsoft 365 Developer

Microsoft Graph implements throttling to prevent overuse of resources, and developers can handle throttling by expecting HTTP status code 429 and retry-after headers in their application code. This video demonstrates how to handle throttling in a C# application.

Key Takeaways
  1. Understand Microsoft Graph throttling and its purpose
  2. Implement rate-limiting in API design using HTTP status code 429 and retry-after headers
  3. Handle throttling in application code by expecting HTTP status code 429 and retry-after headers
  4. Use retry queues to pause and wait before retrying requests
  5. Handle throttling differently in user interface applications
💡 Throttling is necessary to prevent overuse of resources and maintain optimal performance and reliability of the Microsoft Graph service

Related Reads

📰
AI Theatre: The Gap Between Talking About AI and Actually Using It
Learn to identify the gap between discussing AI and actual implementation, and why it matters for professionals
Medium · Cybersecurity
📰
How to Structure Content for AI-First Indexing: 7 Rules That Get You Cited
Learn to structure content for AI-first indexing to increase citation chances, as Google AI Overviews now appear in 47% of US search results
Medium · AI
📰
The Last Premium: What Stays Expensive When Thinking Gets Free
Discover what stays expensive when AI commoditizes human thinking and how it impacts various industries
Medium · Data Science
📰
Microsoft said the patches would get bigger. I measured how much bigger.
Measure the impact of Microsoft's patches on Windows updates to understand the growth in size due to AI-powered vulnerability discovery
Dev.to · Erik Rekola
Up next
PLATO Exoplanet Hunter Launch 2026 Searching for New Earths in a Warming World
Tech Folk Insights
Watch →