How Your Client Application can know when your SharePoint 2010 Farm is Busy

SharePoint 2010 has a number of new features built in to keep your farm up and running as happily and healthy as possible. One of the features it uses to do that is called Http Throttling. It allows you to set thresholds for different performance counters. You decide which counters to use and what thresholds are “healthy” for your environment. I covered this concept in more detail in this post: https://blogs.technet.com/speschka/archive/2009/10/27/adding-throttling-counters-in-sharepoint-2010.aspx.

One of the things you may not know is that client applications get information about the health of the farm based on those throttling rules every time they make a request to the farm. When SharePoint responds, it adds a special response header called X-SharePointHealthScore. If you’re writing a client application that works with data in a SharePoint server, you should consider regularly reading the value of this header to determine whether it’s okay to continue at your current pace, or as the score gets higher, consider dialing back the number of requests you are making.

To demonstrate this concept I’ve created an web part for admins that I’ll be releasing later this year (I haven’t decided exactly how I’m going to distribute it). It’s designed to let you monitor one to many farms based on the response header I’ve described above. It’s a nice little quick view of the health of your farm. Here’s an example of what the web part looks like – in this case it’s retrieving health data for two different farms I have:

The web part is built using a combination of web part, Silverlight, jQuery, and ASPX page. When it receives an error, like the server is busy error you can get with Http Throttling, you can click the plus sign at the bottom of the web part to see the error details. Here’s an example of what that looks like:

Take a look at this when you’re writing your client applications, and understand how best to respond when your farm is getting busy.