Per-user throttling in SharePoint Online: a Recipe for getting blocked in SharePoint Online and way to Avoid it


Suppose you have a CSOM or REST API based code that connects with your SharePoint online Site. 

This code tends to update several fields including metadata of a number of files in a document library in complex manner. 

Or 

Try, for instance, creating site collection in Pnp Powershell using "New-SPOSite" serveral times. 

Or 

Someone decides to Load test SharePoint Online site. 
These are some of the use cases as well which you can can find on Miscrosoft documentation given in the rederence below. 

Now you will notice, if you run into aforementioned situation, at certain point that SharePoint Online will return HTTP status code 429 i.e. Too many requests or 503 i.e. Server Too Busy (an HTTP response status 503 on Windows server means Service Unavailable.) and requests will result in failure.

Furthermore, if one continues with one's transgressions i.e. keeps on running the script, as warned by Microsoft, the script will eventually exceed its usage limits and SharePoint Online may block the process. A notification of being blocked will be shown in the Office 365 Message Center.

So above are the receipies of getting blocked by SharePoint Online. These  are the most common causes of per-user throttling in SharePoint Online where a user making use of CSOM or REST code  (may also apply to apps using Graph API) performs too many complex actions, really too frequently, 


To Avoid that here are some of the best practices as mention in Microsoft documentation:
  • Reduce the number of operations per request
  • Reduce the frequency of calls by e.g. Retry-After HTTP header
  • Choose Microsoft Graph APIs over CSOM and REST APIs when possible
  • Decorate your traffic so we know who you are (see section on traffic decoration best practice more on that below)
  • Leverage the Retry-After HTTP header
  • I also have an opinion that these limits tend to be more stringent during working hours so that means the evening and weekend hours for a specific region of your tenant will be good enough such scripts with repetitive tasks. 
Reference:

Comments

Popular posts from this blog

SharePoint 2010 Migration Woes: Importing and exporting lists template between different SP2010 Servers

How to Stop People From Reading Your Mind and Judging You

Powershell: Filling up an Existing Excel Sheet with data from SQL Server