What Traffic Decoration Is And How You Can Use It To Best Avoid Throttling In SharePoint Online

SharePoint Online uses throttling at different levels to ensure reliability & meet performance requirements the SharePoint online service. Throttling is a means by which any over use of resources is disallowed by SharePoint whenever a script or code gets executes. As the infrastructure for the Office365 is maintained by Microsoft this becomes inevitable to ensure the availability of the platform. This throttling is done at a user level & these limits are not defined.

SharePoint Online uses throttling at different levels to ensure reliability & meet performance requirements of the SharePoint online service. Throttling is a means by which any overuse of resources is disallowed by SharePoint whenever a script or code gets executed. As the infrastructure for the Office365 is maintained by Microsoft this becomes inevitable to ensure the availability of the platform. This throttling is done at a user level & these limits are not defined.

What really happens when you get throttled?
  • Any page that you hit in the browser you get redirected to the throttle error page under layouts named throttle.htm
  • Any requests that you send to SharePoint online through code fails and returns with an HTTP status code 429 which is too many requests.
  • If the user continues doing the operations further then the system will end up blocking the process completely with a 503 service unavailable error.
There are multiple ways including reducing the number of requests in your code, reducing the number of frequent calls & using incremental back off techniques where you basically use ExecuteQueryWithIncrementalRetry instead of ExecuteQuery.

Traffic Decoration

There are a few throttle scenarios which are maintained to ensure high availability. One factor used in prioritization of the traffic is traffic decoration. Well-decorated traffic is always given higher priority than the one which is not.

How do you decorate your traffic

To decorate your traffic, you pass a user agent string along with your request to SharePoint Online be it CSOM or REST API. The user agent is built using a defined format that includes ISV or NONISV flag, the company name & the app if or app title.
Below are the formats of the two options of user agents
  1. ISV Application – ISV|CompanyName|AppName/Version
  2. Enterprise Application – NONISV|CompanyName|AppName/Version
If you are calling any SharePoint APIs, do pass the user agent as part of your request. If you are building Javascript libraries to be used in your application, then have your httprequests include the user agent string. And wherever possible, you need to register your application and use the app id/title in your user strings. While including such user strings SharePoint online can understand the requests are from various apps and prioritize these requests for you.

Hope this article helped you to understand basic concepts of throttling and how we can best avoid the same.