sqlserver的资源调控器

参考SQL Server2014管理最佳实战,所做的笔记。
1:创建资源池
use master
go
create resource pool poolAdhoc with
(
min_cpu_percent=10,max_cpu_percent=30,
min_memory_percent=15,max_memory_percent=25
--min_iops_per_volume=0,max_iops_per_volume=2111111111
);


create resource pool poolReports with
(
min_cpu_percent=20,max_cpu_percent=35,
min_memory_percent=15,max_memory_percent=45
--min_iops_per_volume=0,max_iops_per_volume=2111111111
);

create resource pool poolAdmin with
(
min_cpu_percent=15,max_cpu_percent=25,
min_memory_percent=15,max_memory_percent=25
);

2:创建工作负载组并且关联以上三个资源池

create workload group  groupAdhoc using poolAdhoc;
create workload group  groupReports using poolReports;
create workload group  groupAdmin using poolAdmin;

3:创建用户定义的分类函数:

create function rgtest() returns sysname with schemabinding as begin declare @pg_name as sysname if(user_name()='sa') set @pg_name='poolAdhoc' --if (app_name()) return @pg_name end; go

4:将用户自定义的分类函数注册到资源调控器

alter resource governor with(classifier_function=dbo.rgtest);

5,:启用资源管理器

alter resource governor reconfigure

Resource Governor 能够自动判断资源分配比例,如果没有竞争资源池的话,那么会分配100%资源应用,如果竞争激烈,会按照比例分配。从而使得各个资源池中的对象都能够使用一定的服务器资源完成自己的工作,从而可以使得我们预测系统的最差情况,增强对数据库的管理性。

posted @ 2018-05-22 16:41  M哥  阅读(327)  评论(0编辑  收藏  举报