SQL Server Engine 当前使用的configuration,称作 In-memory configuration,使用DMV:sys.dm_resource_governor_XXX查看;如果需要对Resource Governor Configuration进行更新,需要分两步。

Step1,更新Stored configuration。对Resource Governor组件的update,实际上修改的是Stored Configuration,并没有影响到SQL Server Engine 当前使用的In-Memory configuration。使用系统表sys.resource_governor_XXX查看Stored configuration的详细信息。

step2,更新Configuration,使用 ALTER RESOURCE GOVERNOR RECONFIGURE; 将SQL Server Engine的In-Memory configuration更新为 Stored Configuration,参考ALTER RESOURCE GOVERNOR (Transact-SQL)

一,查看 Resource Governor metadata

1,查看Resource Pool

sys.dm_resource_governor_resource_pools shows the in-memory configuration.To see the stored configuration metadata, use the sys.resource_governor_resource_pools catalog view.

select rgrp.pool_id,
    rgrp.name,
    rgrp.min_cpu_percent,
    rgrp.max_cpu_percent,
    rgrp.cap_cpu_percent,

    rgrp.min_memory_percent,
    rgrp.max_memory_percent,
    rgrp.max_memory_kb,
    rgrp.target_memory_kb
from sys.dm_resource_governor_resource_pools rgrp

cap_cpu_percent: Hard cap on the CPU bandwidth that all requests in the resource pool will receive. Limits the maximum CPU bandwidth level to the specified level.

min_memory_percent:The current configuration for the guaranteed amount of memory for all requests in the resource pool when there is memory contention. This is not shared with other resource pools.

2,查看Workload Group

默认设置,request_max_memory_grant_percent=25,意味着,a single request能够使用的内存是有上限的,不能超过max_request_grant_memory_kb的限制

select rgwg.group_id,
    rgwg.name,
    rgwg.pool_id,
    rgwg.importance,
    rgwg.max_request_cpu_time_ms,
    rgwg.request_max_cpu_time_sec,

    rgwg.request_max_memory_grant_percent,
    rgwg.max_request_grant_memory_kb,

    rgwg.group_max_requests,
    rgwg.max_dop
from sys.dm_resource_governor_workload_groups rgwg

max_request_cpu_time_ms: Maximum CPU usage, in milliseconds, for a single request.This is a measured value, unlike request_max_cpu_time_sec, which is a configurable setting.

request_max_cpu_time_sec: Maximum CPU use limit, in seconds, for a single request.

request_max_memory_grant_percent: Maximum memory grant, as a percentage, for a single request.

max_request_grant_memory_kb: Maximum memory grant size, in kilobytes, of a single request since the statistics were reset.

group_max_requests: Maximum number of concurrent requests.

max_dop: Maximum degree of parallelism for the workload group. The default value, 0, uses global settings. Is not nullable.

importance: Current value for the relative importance of a request in this workload group. Available importance is Low,Medium,High, with Medium being the default.

3, 查看classifier function

通过 sys.dm_resource_governor_configuration

-- Get the in-memory configuration.
select
    object_schema_name(rgc.classifier_function_id) AS N'Active classifier UDF schema',
    rgc.classifier_function_id,
    o.name as  N'Active classifier UDF name' ,
    o.type,
    o.type_desc,
    rgc.is_enabled,
    sm.definition
from sys.resource_governor_configuration rgc
inner join sys.objects o
    on rgc.classifier_function_id=o.object_id
inner join sys.sql_modules sm
    on o.object_id=sm.object_id

Appendix Script

创建 Resource governor 的示例代码

use master

CREATE RESOURCE POOL rpLowReource_Percent_20
WITH
(
     MIN_CPU_PERCENT ,
     MAX_CPU_PERCENT ,
     CAP_CPU_PERCENT ,
     AFFINITY SCHEDULER = auto,
     MIN_MEMORY_PERCENT ,
     MAX_MEMORY_PERCENT
);
go

CREATE WORKLOAD GROUP wgLowResource_Percent_20
WITH
(
    IMPORTANCE = MEDIUM,
    REQUEST_MAX_MEMORY_GRANT_PERCENT,
    REQUEST_MAX_CPU_TIME_SEC,
    REQUEST_MEMORY_GRANT_TIMEOUT_SEC,
    MAX_DOP,
    GROUP_MAX_REQUESTS
)
using rpLowReource_Percent_20;
go

use master
go

CREATE FUNCTION dbo.rgClassifierFunction_LowResource_Percent_20()
RETURNS sysname
WITH SCHEMABINDING
AS
BEGIN
    DECLARE @Workload_Group_Name AS sysname
      IF (SUSER_NAME() = 'USER_READONLY')
          SET @workload_group_name = 'wgLowResource_Percent_20'
    RETURN @workload_group_name
END;
GO

-- Register the classifier user-defined function and update in-memory configuration.
ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION=dbo.rgClassifierFunction_LowResource_Percent_20);
GO
ALTER RESOURCE GOVERNOR RECONFIGURE;
GO

参考doc:

sys.dm_resource_governor_resource_pools (Transact-SQL)

sys.dm_resource_governor_workload_groups (Transact-SQL)

sys.dm_resource_governor_configuration (Transact-SQL)

Resource Governor Related Dynamic Management Views (Transact-SQL)

Resource governor2:Configuration query的更多相关文章

  1. 解读ASP.NET 5 & MVC6系列(5):Configuration配置信息管理

    在前面的章节中,我们知道新版的MVC程序抛弃了原来的web.config文件机制,取而代替的是config.json,今天我们就来深入研究一下配置文件的相关内容. 基本用法 新版的配置信息机制在Mic ...

  2. 开发错误11:Configuration with name ‘default’ not found

    开发错误11:Configuration with name 'default' not found 今天在导入一个sdkdemoapp3.0项目时,发现project build.gradle 与m ...

  3. VS EF Error: Configuration Error extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider"

    错误截图: Configuration Error :<add extension=".edmx" type="System.Data.Entity.Design. ...

  4. asp.net core源码飘香:Configuration组件

    简介: 这是一个基础组件,是一个统一的配置模型,配置可以来源于配置文件(json文件,xml文件,ini文件),内存对象,命令行参数,系统的环境变量又或者是你自己扩展的配置源,该组件将各个配置源的数据 ...

  5. (转)Spring4.0:@Configuration

    从Spring3.0,@Configuration用于定义配置类,可替换xml配置文件,被注解的类内部包含有一个或者多个被@Bean注解的方法,这些方法将会被AnnotationConfigAppli ...

  6. Android Studio3.1.2升级问题:Configuration 'compile' is obsolete and has been replaced with 'implementation'.

    每次升级Android Studio时,一般情况下Gradle版本的也会相应的升级,我之前Android Studio 3.0.1.Gradle 是4.1升级后为:Android Studio 3.1 ...

  7. spring4.0之二:@Configuration的使用

    从Spring3.0,@Configuration用于定义配置类,可替换xml配置文件,被注解的类内部包含有一个或多个被@Bean注解的方法,这些方法将会被AnnotationConfigApplic ...

  8. VMware:Configuration file was created by a VMware product with more features than this version

    Few days ago,I opened the Genesys demo VM by VMware Server 1.0.4 and got an error like this: "C ...

  9. 转:spring4.0之二:@Configuration的使用

    从Spring3.0,@Configuration用于定义配置类,可替换xml配置文件,被注解的类内部包含有一个或多个被@Bean注解的方法,这些方法将会被AnnotationConfigApplic ...

随机推荐

  1. solr update接口常用方法

    solr索引数据更新接口:http://localhost:8080/solr/update 有以下一些操作可以通过update接口完成,只能使用post的形式提交数据. 1.添加索引 确保field ...

  2. 管理Scope和Lifetime

    Nick Blumhardt’s Autofac lifetime primer 是一个学习Autofac Scope和Lifetime的好地方.这里有很多未理解的,混淆的概念,因此我们将尝试在这里完 ...

  3. 如何设置GridView中某个字段显示数据的一部分?

    后台方法: /// <summary> /// 截取字符串 /// </summary> /// <param name="str">要截取的字 ...

  4. Hibernate中Criteria的完整用法

    1,CriteriaHibernate 设计了 CriteriaSpecification 作为 Criteria 的父接口,下面提供了 Criteria和DetachedCriteria .2,De ...

  5. PHP date函数时间相差8个小时解决办法

    php中date时间相差8个小时的解决办法 作者: PHP中文网|标签:|2016-7-25 08:46 在Windows上,在默认的PHP配置下,date函数返回的时间值和当地时间总是相差8小时,即 ...

  6. jQuery整理

    近几日总是在用js写一些东西,jq用的反而少了,最近在工作中总是会用到不常用的jQuery方法,之前觉得可能用到的情况比较少,便没在意这些方法,结果吃了亏,现在准备重新总结一些jQuery中的一些常用 ...

  7. Daily Scrum02 12.13

    之前由于编译的第二次审查,大家又紧张地忙了一阵,调Bug的调Bug,换文法的换文法,双十二的会议也停了一次,给大家完成数据库大作业留一个缓冲的时间.但是我们的进度还要继续抓紧啊!! Member 任务 ...

  8. sqlmap用户手册 | WooYun知识库

    sqlmap用户手册 说明:本文为转载,对原文中一些明显的拼写错误进行修正,并标注对自己有用的信息. 原文:http://drops.wooyun.org/tips/143  ============ ...

  9. Javascript初学篇章_6(BOM)

    BOM 浏览器对象模型 BOM (浏览器对象模型),它提供了与浏览器窗口进行交互的对象 一.window对象 Window对 象表示整个浏览器窗口. 1.系统消息框 alert() alert('he ...

  10. XCod5 SVN

    近日开始学习IOS开发, 涉及版本管理问题,老大说要使用SVN, 在Windows系统中使用SVN的经验使得俺以为需要首先安装SVN,然后再配置等等, 殊不知XCode5中已经内置了SVN, 在百度一 ...