Skip to content

Commit 43d1820

Browse files
committed
Throttling doc adjustments
1 parent 1b295a1 commit 43d1820

File tree

1 file changed

+12
-86
lines changed

1 file changed

+12
-86
lines changed

docs/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md

Lines changed: 12 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@ ms.assetid: 33ed8106-d850-42b1-8d7f-5ba83901149c
1010
Find out about throttling in SharePoint Online, and learn how to avoid being throttled or blocked. Includes sample CSOM and REST code you can use to make your task easier.
1111

1212
- [What is throttling?](how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md#BKMK_Whatisthrottling)
13-
14-
13+
1514
- [Common throttling scenarios in SharePoint Online](how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md#BKMK_Commonthrottlingscenarios)
16-
17-
15+
1816
- [Why can't you just tell me the exact throttling limits?](how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md#BKMK_Whycantyoujusttellmetheexactthrottlinglimits)
19-
20-
17+
2118
- [Best practices to handle throttling](how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md#BKMK_Bestpracticestohandlethrottling)
2219

20+
- [How to decorate your traffic to avoid getting throttled?](how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md#BKMK_DecorateSharePointOnlineThrottling)
2321

2422
- [GitHub CSOM code samples: SharePoint Online Throttling](how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md#BKMK_GitHubCSOMandRESTcodesamplesSharePointOnlineThrottling)
2523

@@ -28,71 +26,37 @@ Find out about throttling in SharePoint Online, and learn how to avoid being thr
2826

2927

3028
- [Additional resources](how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md#BKMK_Additionalresources)
31-
32-
3329

3430
Does this sound familiar? You're running a CSOM process - for example, to migrate files in SharePoint Online - but you keep getting throttled. Or even worse, you get completely blocked. What's going on and what can you do to make it stop?
3531

36-
37-
38-
39-
4032
## What is throttling?
4133
<a name="BKMK_Whatisthrottling"> </a>
4234

4335
SharePoint Online uses throttling to maintain optimal performance and reliability of the SharePoint Online service. Throttling limits the number of user actions or concurrent calls (by script or code) to prevent overuse of resources.
4436

45-
46-
4737
That said, it is extremely rare for a user to get throttled in SharePoint Online. The service is robust, and it is designed to handle very high volume. If you do get throttled, 99% of the time it is because of custom code. That doesn't mean that there aren't other ways to get throttled, just that they are less common. For example you spin up 10 machines and have a sync client going on all 10. On each sync 1TB of content. This would likely get you throttled.
4838

49-
50-
5139

52-
53-
54-
5540
![How throttling happens](../images/3b9184db-99a4-416e-ba1e-7f8653484cee.png)
5641

57-
58-
59-
6042
### What happens when you get throttled in SharePoint Online?
6143

6244
When a user exceeds usage limits, SharePoint Online throttles any further requests from that user account for a short period. All user actions are throttled while the throttle is in effect.
6345

64-
65-
66-
6746
- For requests that a user performs directly in the browser, SharePoint Online redirects you to the throttling information page, and the requests fail.
68-
6947

7048
- For all other requests, including CSOM or REST calls, SharePoint Online returns HTTP status code 429 ("Too many requests"), and the requests fail.
71-
7249

7350
If the offending process continues to exceed usage limits, SharePoint Online might completely block the process; in this case, you may see HTTP status code 503 ("Service unavailable"), and we'll notify you of the block in the Office 365 Message Center. The error message is shown below:
74-
75-
76-
77-
78-
79-
80-
51+
8152
![The 503 Server unavailable message](../images/e70a43c1-43ba-4f5c-b25f-e3995f18dd16.png)
82-
83-
84-
53+
8554
503 Server unavailable message.
86-
87-
88-
8955

9056
## Common throttling scenarios in SharePoint Online
9157
<a name="BKMK_Commonthrottlingscenarios"> </a>
9258

9359
The most common causes of per-user throttling in SharePoint Online are client-side object model (CSOM) or Representational State Transfer (REST) code that performs too many actions too frequently.
94-
95-
9660

9761

9862
- **Sporadic traffic**
@@ -103,50 +67,32 @@ The most common causes of per-user throttling in SharePoint Online are client-si
10367

10468
![Sporadic throttling](../images/a61afe25-9597-403f-b3fa-d3f630155021.png)
10569

106-
107-
108-
109-
11070
- **Overwhelming traffic**
11171

11272
A single process dramatically exceeds throttling limits, continually, over a long time period.
11373

11474
- You used web services to build a tool to synchronize user profile properties. The tool updates user profile properties based on information from your line-of-business (LOB) human resources (HR) system. The tool makes calls at too high a frequency.
115-
11675

11776
- You're running a load-testing script on SharePoint Online and you get throttled. Load testing is not allowed on SharePoint Online.
118-
11977

12078
- You customized your team site on SharePoint Online, for example, by adding a status indicator on the Home page. This status indicator updates frequently, which causes the page to make too many calls to the SharePoint Online service - this triggered throttling.
12179

12280
![Steady throttling](../images/7849d413-381f-4558-9e50-b3cc9990d3e3.png)
12381

124-
125-
126-
127-
128-
12982
## Why can't you just tell me the exact throttling limits?
13083
<a name="BKMK_Whycantyoujusttellmetheexactthrottlinglimits"> </a>
13184

13285
Setting and publishing exact throttling limits sounds very straightforward, but in fact, it's not the best way to go. We continually monitor resource usage on SharePoint Online. Depending on usage, we fine-tune thresholds so users can consume the maximum number of resources without degrading the reliability and performance of SharePoint Online. That's why it's so important for your CSOM or REST code to include incremental back off to handle throttling; this lets your code run as fast as possible on any given day, and it lets your code back off "just enough" if it hits throttling limits. The code samples later in this article show you how to use incremental back off.
133-
134-
135-
13686

13787
## Best practices to handle throttling
13888
<a name="BKMK_Bestpracticestohandlethrottling"> </a>
13989

140-
14190
- Reduce the number of operations per request
14291

143-
14492
- Reduce the frequency of calls
14593

146-
14794
- Decorate your traffic so we know who you are (see section on traffic decoration best practice more on that below)
14895

149-
15096
If you do run into throttling, we recommend incremental back off to reduce the number and frequency of calls until no more throttling occurs.
15197

15298
Incremental back off uses progressively longer waits between retries before trying again to run the code that was throttled. You can use the GitHub code samples, later in this article, written as extension methods, to add incremental back off to your code.
@@ -158,6 +104,7 @@ For information about ways to monitor your SharePoint Online activity, see [Dia
158104
For a broader discussion of throttling on the Microsoft Cloud, see [Throttling Pattern](http://msdn.microsoft.com/library/4baf5af2-32fc-47ab-8569-3e5c59a5ebd5.aspx).
159105

160106
## How to decorate your http traffic to avoid throttling?
107+
<a name="BKMK_DecorateSharePointOnlineThrottling"> </a>
161108

162109
To ensure and maintain high-availability, some traffic may be throttled. Throttling happens when system health is at stake and one of the criteria used for throttling is traffic decoration, which impacts directly on the prioritization of the traffic. Well decorated traffic will be prioritized over traffic which is not properly decorated.
163110

@@ -244,29 +191,19 @@ Before you run this code sample:
244191

245192
**Core.Throttling** runs as a console application using a user-only authorization policy, which means this code sample uses the permissions of the current user. In the **Main** method in Program.cs, a while loop repeatedly creates new folders in the test document library. A call is then made to **ctx.ExecuteQueryWithExponentialRetry**, which uses CSOM to perform the **ExecuteQuery** method. **ExecuteQueryWithExponentialRetry** is an extension method on the [ClientContext](https://msdn.microsoft.com/library/office/microsoft.sharepoint.client.clientcontext%28v=office.15%29.aspx) object, and is defined in **ClientContextExtension.cs**.
246193

247-
248-
194+
249195
If SharePoint Online throttles the **ExecuteQuery** statement, **ExecuteQueryWithIncrementalRetry** starts the incremental back off technique by:
250-
251-
252-
253196

254197
- Catching a **WebException** and checking the **HttpWebResponse.StatusCode**. If SharePoint Online throttled the **ExecuteQuery** statement, the **HttpWebResponse.StatusCode** is 429.
255-
256-
198+
257199
- The current thread is suspended for the period specified in **backoffInterval**.
258-
259-
200+
260201
- When the current thread resumes, the **backoffInterval** is doubled and the number of retries performed ( **retryAttempts** ) is incremented. By doubling **backoffInterval** your code suspends activity for a longer period of time before retrying the code that was throttled by SharePoint Online.
261-
262-
202+
263203
- The process is repeated until either the **ExecuteQuery** statement is successful, or the number of allowed retries ( **retryCount** ) is exceeded.
264-
265-
266204

267205
### CSOM Code sample: Incremental back off and retry (calls ExecuteQueryWithIncrementalRetry method, later in this article)
268206

269-
270207
```
271208
272209
using (var ctx = new ClientContext(serverUrl))
@@ -352,24 +289,13 @@ public static void ExecuteQueryWithIncrementalRetry(this ClientContext context,
352289

353290
Blocking is the most extreme form of throttling. We rarely ever block a tenant, unless we detect long-term, extremely excessive traffic that may threaten the overall health of the SharePoint Online service. We apply blocks to prevent excessive traffic from degrading the performance and reliability of SharePoint Online. A block - which is usually placed at the tenancy level - prevents the offending process from running until you fix the problem. If we block your subscription, you must take action to modify the offending processes before the block can be removed.
354291

355-
356-
357292
If we block your subscription, you'll see HTTP status code 503, and we'll notify you of the block in the Office 365 Message Center. The message describes what caused the block, provides guidance on how to resolve the offending issue, and tells you who to contact to get the block removed.
358293

359-
360-
361-
362294
## Additional resources
363295
<a name="BKMK_Additionalresources"> </a>
364296

365-
366297
- [Diagnosing performance issues with SharePoint Online](https://support.office.com/en-us/article/3c364f9e-b9f6-4da4-a792-c8e8c8cd2e86)
367-
368298

369299
- [Capacity planning and load testing SharePoint Online](http://msdn.microsoft.com/library/22fa7e7e-7554-4987-b56f-b39bbf303a0a.aspx)
370-
371300

372-
- [GitHub: SharePoint Online Throttling code sample](https://github.com/OfficeDev/PnP/tree/dev/Samples/Core.Throttling)
373-
374-
375-
301+
- [GitHub: SharePoint Online Throttling code sample](https://github.com/OfficeDev/PnP/tree/dev/Samples/Core.Throttling)

0 commit comments

Comments
 (0)