sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Throttling responses from Provider Hosted Add-in using OfficeDevPnP ExecuteQueryRetry

Open SchauDK opened this issue 8 years ago • 4 comments

Starting last Friday we started to receive an significant increased amount of 429 responses from CSOM requests, all from our SharePoint Provider Hosted Add-in. It started to occur on multiple tenants at the same time and is now a problem on up to 60 different tenants.

We are using best practices to avoid Throttling like decorating request with a User Agent and are using Office Dev PnP ExecuteQueryRetry for executing all requests. Before Friday this hasn't been a problem on any tenants. No changes have been made from our site to cause this.

Any help would be appreciated.

Thank you

SchauDK avatar Jan 16 '18 16:01 SchauDK

This started out of the blue two days ago for a light-usage customer of ours. (Connecting to their SharePoint Online tenancy over C# CSOM from one of their Azure VMs.)

mwardm avatar Feb 08 '18 12:02 mwardm

What I'm going to share is that your multi-tenant app can be throttled across all tenants where it is deployed, without getting 503 responses and without getting notified in the Offece 365 Message Center.

According to the following section https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online#what-should-you-do-if-you-get-blocked-in-sharepoint-online a block i usually placed on tenant level, but a "subscription" can also be blocked. In our case we were NOT receiving 503 responses and were NOT notified in any way that our multi-tenant app was blocked. Instead from one day to another we were receiving 429 responses across 60 different tenants at the same time. Also tenants with very low traffic.

So what was really going on? It took Microsoft engineers TWO WEEKS!!! to come up with the following explaination.

Cause: Apps that perform bulk operations over a large corpus (crawl/sync/backup/migration/scanning/etc), are deprioritized when the service is busy to reserve resources for interactive traffic (users browsing pages and opening documents). As the app uses the same AppTitle and userAgen across all tenants, performing the kind of operations that it did, it was considered to be making bulk operations, and as such it was throttled when the traffic was needed for user activities.

Resolution: After analysing the traffic from the app, and checking it is a multi-tenant app, it has now been classified as interactive traffic, and is no longer considered to be performing bulk operations. With that change, the number of 429 request your customers might see is drastically reduced, as the app is now considered prioritary.

The issue isn't completely solved, but it is definitely better after they changed the status of our app. Microsoft for sure changed something recently, that is now causing issues for a lot of people. This can really be devastating to many businesses. As an ISV we're providing a business critical solution to most of our customers, and if this throttling issue isn't solved, we (and other ISVs) could risk that our customers don't trust our product.

So spread the word to the community. If you have a multi-tenant app you need to contact Microsoft to get it "flagged" as prioritary. And good luck with that. The Office 365 supporters know absolutely zip about this.

SchauDK avatar Feb 08 '18 23:02 SchauDK

Much appreciated, Michael.

In our case it's even worse - or maybe better. Our app isn't multi-tenant; each of our clients is running their own copy from their own (Azure) server.
(Actually, writing that has given me pause for thought. The same app instance is sometimes used to connect to both "test" and "live" SharePoints - I think in this problem case they're different sites in the same SharePoint tenancy [if I've got my terminology right]. I might have to check and see whether that's the case, and whether it looks like it might exacerbate throttling.)

We've raised a call with Microsoft. I'm hoping it's just some overloaded server thing. Using a browser to examine the aspx pages for the X-SharePointHealthScore header, I was frequently seeing 6 and 7 with an absolute minimum of 2 (when documentation says you'll normally see zero :-) ).

[I've just looked at that header again, 11pm at night. Now I'm seeing zeroes. So either Microsoft have fixed something, or else they're running their servers too hot....]

If this error gets cleared up, I'll get back to looking at the intermittent 500 0 64 errors we've been seeing in our service's IIS logs when trying to connect from Dynamics Online plug-ins. That only started happening just before Christmas. Probably a resource thing too, I'm thinking....

Cheers, Mike.

mwardm avatar Feb 08 '18 23:02 mwardm

This issue is being closed as part of an issue list cleanup project. Issues with no activity in the past 6 months that aren't tracked by engineering as bugs were closed as part of this inititive. If this is still an issue, please follow the steps outlined to re-open the issue.

msft-github-bot avatar Jan 22 '20 21:01 msft-github-bot