Request Manager in SharePoint 2013

What is Request Management?

Allows SharePoint to understand more about, and control the handling of, incoming HTTP requests. Having knowledge of the nature of incoming requests allows SharePoint to customize the response to each request

Architectural Overview

  • Request Manager is the first code that runs in response to HTTP requests
  • Request Manager runs in process on the web server
  • Request Management Service Instance should run on the web server
  • No Central Administration
  • 100% Windows PowerShell

Capacity Management

  • Request Management can send multiple or single requests to web servers that are designated to handle them.
  • Request Management can send requests to logical groups of servers based upon request characteristics

Deployment Modes

  • Integrated Mode : Request Management Service runs on the web servers in a farm
  • Dedicated Mode : A dedicated SharePoint farm which manages requests exclusively, and routes request to other farms

At a high level, the goals of RM are this:

  • RM can route to WFEs with better health, keeping low-health WFEs alive
  • RM can identify harmful requests and deny them immediately
  • RM can prioritize requests by throttling lower-priority ones (bots) to serve higher-priority ones (end-users)
  • RM can send all requests of specific type, like search for example, to specific machines
  • Isolated traffic can help troubleshoot errors on one machine
  • RM can send heavy requests to more powerful WFEs

 Routing and throttling rules are implemented like this:

  • Routing rules route requests and are associated with MachinePools
  • MachinePools contain servers
  • Servers use weights for routing – static weights and health weights
  • Static weights are constant for WFEs; health weights change dynamically based on health scores

Let’s walk through an example now:

#Get a reference to the SPWebApplication
$w = Get-SPWebApplication -identity http://foo

#Get a reference to the request management settings for the web application
$rmset = $w | Get-SPRequestManagementSettings

#Create one or more criteria
$criteria = New-SPRequestManagementRuleCriteria -Property Url -Value “.*\.docx” -MatchType Regex

#Get a reference to a machine pool, or create a new one if needed
$mp = Add-SPRoutingMachinePool -RequestManagementSettings $rmset -Name MyRulePool -MachineTargets ($rmset | Get-SPRoutingMachineInfo -Name WFE1)

#Add the rule
$rmset | Add-SPRoutingRule -Name “Word Doc Rule” -Criteria $criteria -MachinePool $mp

Let’s look at that routing rule now:
$rr = $rmset | Get-SPRoutingRule -Name “Word Doc Rule”

#see the criteria
$rr.Criteria

#change the expiration date and time of the routing rule
$rr.Expiration = “12/25/2013 5:00:00 PM”

There you go – now you have a routing rule.  Creating a throttling rule is very similar:

#Add a new criteria rule that looks for OneNote requests.  It can do this by examining the UserAgent in the request and looking for the header that OneNote uses.
$criteria = New-SPRequestManagementRuleCriteria -Property UserAgent -Value “.*Microsoft Office OneNote 2010*” -MatchType Regex

#Add a throttling rule that uses the criteria rule when the server health reaches a score of 8.
#Note that throttle rules apply to the entire web application, #not to individual machines so you don’t
#use a machine pool with it.
$rmset | Add-SPThrottlingRule -Name “OneNote Throttle Rule” -Criteria $criteria -Threshold 8

#now view all routing rules for the web application
$rmset.RoutingRules

#View all of the throttling rules
$rmset.ThrottlingRules

Let’s look a little deeper at working with Machine Pools now:

#Get all routing machines that are available
Get-SPWebApplication | Get-SPRequestManagementSettings | Get-SPRoutingMachineInfo -Availability Available

#Get every machine in a specific pool
Get-SPWebApplication | Get-SPRequestManagementSettings | Get-SPRoutingMachinePool -Name yourPoolName | % { $_.MachineTargets} | Format-Table

#Add machine WFE1 to every machine pool for a particular web application; a million thanks to Tyler who helped me with this one – I ain’t a PowerShell guy really
$a = Get-SPWebApplication -Identity http://contoso
$b = $a | Get-SPRequestManagementSettings | Get-SPRoutingMachineInfo -Name WFE1
Get-SPWebApplication | Get-SPRequestManagementSettings | Get-SPRoutingMachinePool | % { $_ | Set-SPRoutingMachinePool -machinetargets ($_.machinetargets + $b) }

#Add machine WFE1 to a specific pool
$a = Get-SPWebApplication -Identity http://contoso
$b = $a | Get-SPRequestManagementSettings | Get-SPRoutingMachineInfo -Name WFE1
$pool = $a | Get-SPRequestManagementSettings | Get-SPRoutingMachinePool -Name yourPoolName
$pool | Set-SPRoutingMachinePool -MachineTargets ($pool.MachineTargets + $b)

#Remove WFE1 from every machine pool
Get-SPWebApplication | Get-SPRequestManagementSettings | Get-SPRoutingMachineInfo -Name WFE1 | Remove-SPRoutingMachineInfo

RMArchitecture

RM_Rules

For more details : Configure Request Manager in SharePoint Server 2013

Advertisements