次の方法で共有


Adding Throttling Counters in SharePoint 2010

Http throttling is a new feature in SharePoint 2010 that allows the server to “back off” of serving requests when it is too busy. Every 5 seconds a job will run that will check the server resources compared to the levels configured. By default the Server CPU, Memory, Request in Queue and Request wait time are being monitored. After 3 unsuccessful checks, the server will enter a throttling period and will remain in this state until a successful check is completed. Requests generated prior to the server entering into the throttling mode will be completed. This will, in theory, keep users from losing any current work when the server begins to throttle requests. Any new HTTP GET and Search Robot request will generate a 503 error message and will be logged in the event viewer. Also while the server is in a throttling period no new timer jobs will be started.

You can enable or disable throttling in central admin. It is managed on a per web application basis. Go into central admin and click on Manage Web Applications under Application Management. Click on a web app to select it, then click on the General Settings drop down and select the Resource Throttling menu. About half way down the page is a section titled HTTP Request Monitoring and Throttling, where you will find a radio button option to turn it off or on (it’s on by default).

You have to use PowerShell to actually view and change the counter parameters that determine whether the web app should be throttled. To view the list of counters and their parameter values use the Get-SPWebApplicationHttpThrottlingMonitor cmdlet; for the Identity parameter pass in the Url to the web application you want to check. It will display something that looks like this:

PS C:\backups> Get-SPWebApplicationHttpThrottlingMonitor -identity https://o14

Category : Processor

Counter : % Processor Time

Instance : _Total

MinValue : 0

MaxValue : 99

UpgradedPersistedProperties : {}

 

Category : Memory

Counter : Available Mbytes

Instance :

MinValue : 20

MaxValue : 3.402823E+38

UpgradedPersistedProperties : {}

 

Category : ASP.NET

Counter : Requests Queued

Instance :

MinValue : 0

MaxValue : 500

UpgradedPersistedProperties : {}

 

Category : ASP.NET

Counter : Request Wait Time

Instance :

MinValue : 0

MaxValue : 30000

UpgradedPersistedProperties : {}

 

To change an existing counter, use the Set-SPWebApplicationHttpThrottlingMonitor cmdlet. For example, here’s how I would change the throttling limit for CPU utilization to 80%:

 

Set-SPWebApplicationHttpThrottlingMonitor -Identity https://o14 -Category "Processor" -Counter "%

Processor Time" -Instance "_Total" -MaxThreshold 80 -MinThreshold 0

 

What if you want to add a new performance counter to monitor? You can do that as well, but it’s not quite as straightforward. You can do this through the object model, but fortunately PowerShell makes that quite achievable. Here’s an example of adding a new counter for interrupts a second to the throttling set:

 

$uri = new-object System.Uri("https://o14")

$webApp=[Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($uri)

$throttle=$webApp.HttpThrottleSettings

$throttle. AddPerformanceMonitor ("Processor", "Interrupts/sec", "_Total", 2300, 0)

$throttle.Update()

 

Now once I’ve completed that, if I run the Get-SPWebApplicationHttpThrottlingMonitors cmdlet again it reflects the new counter I’ve added:

 

PS C:\backups> Get-SPWebApplicationHttpThrottlingMonitor -identity https://o14

 

Category : Processor

Counter : % Processor Time

Instance : _Total

MinValue : 0

MaxValue : 99

UpgradedPersistedProperties : {}

 

Category : Memory

Counter : Available Mbytes

Instance :

MinValue : 20

MaxValue : 3.402823E+38

UpgradedPersistedProperties : {}

 

Category : ASP.NET

Counter : Requests Queued

Instance :

MinValue : 0

MaxValue : 500

UpgradedPersistedProperties : {}

 

Category : ASP.NET

Counter : Request Wait Time

Instance :

MinValue : 0

MaxValue : 30000

UpgradedPersistedProperties : {}

 

Category : Processor

Counter : Interrupts/sec

Instance : _Total

MinValue : 0

MaxValue : 2300

UpgradedPersistedProperties : {}

 

So there you go – a little background about another new feature in SharePoint 2010 that’s designed to make your farm more resilient. It includes the flexibility to adjust and add to the performance counters that are used to determine when to go into throttle mode based on your business needs and usage characteristics.

 

ONE ADDITIONAL NOTE: You may find that if you add the throttling counter I demo'd in this post, that your site may start throwing a "server is busy" message every time you hit the site. So here's the last tip - how to remove a throttle monitor:

 

PS C:\Users\speschka> $uri = new-object System.Uri("https://o14")

PS C:\Users\speschka> $webApp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($uri)

PS C:\Users\speschka> $throttle = $webApp.HttpThrottleSettings

PS C:\Users\speschka> $throttle.RemovePerformanceMonitor("Processor","Interrupts/Sec")

PS C:\Users\speschka> $throttle.Update()

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 30, 2011
    When in throttling mode, do we expect to see anything in the event log? or in another words is there any way to tell that we are in throttling mode?

  • Anonymous
    September 18, 2014
    The comment has been removed