Resource Governor

Leave a comment (1) Go to comments

Resource Governor is a feature that you can use to manage SQL Server workload and system resource consumption. Resource Governor enables you to limit the amount of CPU and memory that incoming application requests can use.

In an environment where multiple distinct workloads are present on the same server, Resource Governor enables you to differentiate these workloads and allocate shared resources as they are requested, based on the limits that you specify. These resources are CPU and memory.Note:

Resource limits can be reconfigured in real time with minimal impact on workloads that are executing.

Types of Resource Issues

Resource Governor is designed to address the following types of resource issues which are commonly found in a database environment:

  • Run-away queries on the server. In this scenario a resource intensive query can take up most or all of the server resources.
  • Unpredictable workload execution. In this scenario concurrent applications on the same server have workloads of different size and type. For example, two data warehouse applications or a mix of OLTP and data warehouse applications. These applications are not isolated from each other and the resulting resource contention causes unpredictable workload execution.
  • Setting workload priority. In this scenario one workload is allowed to proceed faster than another or is guaranteed to complete if there is resource contention. Resource Governor enables you to assign a relative importance to workloads.
  • All of the preceding scenarios require the ability to differentiate workloads in some way. Resource Governor provides:
  • The ability to classify incoming connections and route their workloads to a specific group.
  • The ability to monitor resource usage for each workload in a group.
  • The ability to pool resources and set pool-specific limits on CPU usage and memory allocation. This prevents or minimizes the probability of run-away queries.
  • The ability to associate grouped workloads with a specific pool of resources.
  • The ability to identify and set priorities for workloads.

Resource Governor Constraints


This release of Resource Governor has the following constraints:

  • Resource management is limited to the SQL Server Database Engine. Resource Governor cannot be used for Analysis Services, Integration Services, and Reporting Services.
  • There is no workload monitoring or workload management between SQL Server instances.
  • Limit specification applies to CPU bandwidth and memory managed by SQL Server.
  • OLTP workloads. Resource Governor can manage OLTP workloads but these types of queries, which are typically very short in duration, are not always on the CPU long enough to apply bandwidth controls. This may skew in the statistics returned for CPU usage %.

    Resource Governor Concepts

    You can treat resource pools, workload groups, and classifications as components. The following illustration shows these components and their relationship with each other as they exist in the database engine environment. From a processing perspective, the simplified flow is as follows:

    • There is an incoming connection for a session (Session 1 of n).
    • The session is classified (Classification).
    • The session workload is routed to a workload group, for example, Group 4.
    • The workload group uses the resource pool it is associated with, for example, Pool 2.
    • The resource pool provides and limits the resources required by the application, for example, Application 3.Resource Pools

      A resource pool, or pool, represents the physical resources of the server. You can think of a pool as a virtual SQL Server instance inside of a SQL Server instance.

      A pool has two parts. One part does not overlap with other pools, which enables minimum resource reservation. The other part is shared with other pools, which supports maximum possible resource consumption. In this release of Resource Governor the pool resources are set by specifying one of the following for each resource:

      • MIN or MAX for CPU
      • MIN or MAX for memory

      MIN and MAX represent the minimum guaranteed resource availability of the pool and the maximum size of the pool, respectively, for each of these resources.

      The sum of MIN values across all pools cannot exceed 100 percent of the server resources. MAX value can be set anywhere in the range between MIN and 100 percent inclusive.

      If a pool has a nonzero MIN defined the effective MAX value of other pools is readjusted as the minimum of the configured MAX value of a pool and the sum of the MIN values of other pools subtracted from 100 percent.

      Workload Groups

      A workload group serves as a container for session requests that are similar according to the classification criteria that are applied to each request. A workload group allows the aggregate monitoring of resource consumption and the application of a uniform policy to all the requests in the group. A group defines the policies for its members.

      Resource Governor predefines two workload groups: the internal group and the default group. A user cannot change anything classified as an internal group, but can monitor it. Requests are classified into the default group when the following conditions exist:

      • There are no criteria to classify a request.
      • There is an attempt to classify the request into a non-existent group.
      • There is a general classification failure.

      Classification

      Resource Governor supports the classification of incoming sessions. Classification is based on a set of user-written criteria contained in a function. The results of the function logic enable Resource Governor to classify sessions into existing workload groups. Note:

      The internal workload group is populated with requests that are for internal use only. You cannot change the criteria used for routing these requests and you cannot classify requests into the internal workload group.

      • You can write a scalar function that contains the logic that is used to assign incoming sessions to a workload group. Before you can use this function, you must complete the following actions:
      • Create and register the function using the ALTER RESOURCE GOVERNOR statement. For more information, see ALTER RESOURCE GOVERNOR (Transact-SQL).
      • Update the Resource Governor configuration using the ALTER RESOURCE GOVERNOR statement with the RECONFIGURE parameter.

      After you create the function and apply the configuration changes, the Resource Governor classifier will use the workload group name returned by the function to send a new request to the appropriate workload group.

      • The user-defined function has the following characteristics and behaviors:
      • The user-defined function is evaluated for every new session, even when connection pooling is enabled.
      • The user-defined function gives workload group context for the session. After group membership is determined, the session is bound to the workload group for the lifetime of the session.
      • If the user-defined function returns NULL, default, or the name of non-existent group the session is given the default workload group context. The session is also given the default context if the function fails for any reason.
      • The function should be defined with server scope (master database).
      • The classifier user-defined function designation only takes effect after ALTER RESOURCE GOVERNOR RECONFIGURE is executed.
      • Only one user-defined function can be designated as a classifier at a time.
      • The classifier user-defined function cannot be dropped or altered unless its classifier status is removed.
      • In the absence of a classifier user-defined function, all sessions are classified into the default group.
      • The workload group returned by the classifier function is outside the scope of the schema-binding restriction. For example, you cannot drop a table, but you can drop a workload group.

      Classification Process

      In the context of Resource Governor, the login process for a session consists of the following steps:

      • Login authentication
      • LOGON trigger execution
      • Classification

      When classification starts, Resource Governor executes the classifier function and uses the value returned by the function to send requests to the appropriate workload group.

      Implementing Resource Governor

    After you install SQL Server 2008, Resource Governor is available for use but is not enabled. The internal and default workload groups and their corresponding resource pools exist.

    To create and use your own resource pools and workload groups, you must complete the following steps:

    • Create a resource pool that has the limits you specify.
    • Create a workload group that has the limits and policies that you specify, and identify the resource pool to which the workload group belongs.
    • Define and activate a classifier function that you want to use for incoming requests.

      Resource Governor Download White Paper from Microsoft.

EOF - Resource Governor, SQL Server 2012 , 2008 R2 , 2008 , 2005 , 2000
Leave a comment

1 Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *


*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Trackbacks and Pingbacks: