SharePoint 2013 Apps, Load Testing and Resources throttling

If you are building a SharePoint 2013 Apps you will need at some point in your development lifecycle to do load testing for your app to see how it will behave under big user load especially if you are building LOB application that you expect to have a big load.

This is great but the problem with that is you may receive the below error at your testing tool at high user load:
HTTP/1.1 429 Too Many Requests
You may say okay it’s the http throttling then you go to the central administration site close it and retest then you get the same error again.

But if you dig more in the uls you will find the below error:
ResourceBudgetExceeded, sending throttled status code. Exception=Microsoft.SharePoint.SPResourceBudgetExceededException: ResourceBudgetExceeded at Microsoft.SharePoint.SPResourceTally.Check(Int32 value) at Microsoft.SharePoint.SPAggregateResourceTally.Check(SPResourceKind kind, Int32 value) at Microsoft.SharePoint.Client.SPClientServiceHost.OnBeginRequest()

Okay what is this?! this is another validation and throttling the SharePoint team added specially to the SP APPs and in the current situation it checks the time for the request that the app makes to the client.svc service (CSOM Calls) and if its bigger than 150,000 Milliseconds your app CSOM request will be blocked and throttled.

So what can you do now?!:
1- You can review your app code and try to optimize it to bypass this throttling.

2- You can say okay I know that my performance lab has small resources and at production I will be in a good servers which will work faster and I just need to increase this 150 MS limit, okay no problem just use the below PowerShell:
$webapp = Get-SPWebApplication -Identity http://<URL of your on-premises farm>
$webapp.AppResourceTrackingSettings.Rules.Add(
[Microsoft.SharePoint.SPResourceKind]::ClientServiceRequestDuration, 300000, 300000)

3- What if you need to just disable it? this is also very easy:
$webapp = Get-SPWebApplication -Identity http://<URL of your on-premises farm>
$rule = $webapp.AppResourceTrackingSettings.Rules.Get(
[Microsoft.SharePoint.SPResourceKind]::ClientServiceRequestDuration)
$rule.Remove()

Finally, I hope that this post save you some time while you are doing your load testing for the SP2013 APPs

Advertisements

About Mahmoud Hamed

SharePoint Evangelist, Architect, Developer
This entry was posted in SharePoint 2013 and tagged , , . Bookmark the permalink.

One Response to SharePoint 2013 Apps, Load Testing and Resources throttling

  1. Andreas Ritter says:

    There’s something missing in your script 🙂 – without the $webapp.Update() in the end the change won’t be saved.

    $webapp = Get-SPWebApplication -Identity https://URL-WEBAPP
    $rule = $webapp.AppResourceTrackingSettings.Rules.Get([Microsoft.SharePoint.SPResourceKind]::ClientServiceRequestDuration)
    $rule.Remove()
    $webapp.Update()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s