You can watch the replay for this Geek Sync webcast in the IDERA Resource Center: http://ow.ly/jmY250A5qtB
Given budgeting and licensing constraints, database servers have seen dramatic amounts of database consolidation. Managing performance in densely consolidated environments is always a challenge because you will have some users who are trying to run reports while other users are trying to execute OLTP workloads. What if there was a way to do load balancing between these workloads while putting your feet up on your desk? Well, there is and it's called the Resource Governor.
Watch the on demand webinar to learn the different ways to make your job easier through the utilization of SQL Server Resource Governor.
2. Joey D’Antoni
• Joey has over 15 years of experience with a wide variety of data platforms,
in both Fortune 50 companies as well as smaller organizations
• He is a frequent speaker on database administration, big data, and career
management
• He is the co-president of the Philadelphia SQL Server User’s Group
• MSCE, Business Intelligence, Data Platform
• He wants you to make sure you can restore your data
Joeydantoni.com
3. Agenda
The Problems with sharing your SQL Servers
An Introduction to Resource Governor
How to Implement Resource Governor
Demo
9. Introducing Resource Governor
Introduced in SQL Server 2008
Enterprise Edition Only
Controls CPU and Memory Resources (2008-2012)
Controls CPU, IOPs, and Memory Resources (2014)
10. Why Use Resource Governor?
Prioritization
between apps
and users
Limit runaway
queries
Give control
back to the
DBA
11. Resource Governor Concepts
Resource Pool
Manages server resources
Workload Group
Aggregates similar session requests
Classifier Function
Classifies connection to its workload group
12. Resource Governor Workloads
Split Workloads
• Application Name
• Login
• Not Database
Per Request Limits
• Max Memory %
• Max CPU Time
• Grant Timeout
Resource Monitoring
SQL Server
Memory, CPU, Threads
Resources
Admin
Workload
OLTP
Workload
Report
Workload
14. Resource Governor Pools
Resource Pool: A subset of database resources
Controls
• Minimum CPU %
• Maximum CPU %
• Minimum Memory %
• Maximum Memory %
Workload Group Controls
• Importance
• Maximum Requests
• CPU Time (sec)
• Memory Grant %
• Grant Time Out
• MaxDOP
• Min and Max IOPS Per Volume
16. Classifier Function
User defined scalar function to classify incoming connections to resource group
One per instance
Does not apply to internal workload group
Evaluated for every new connection
Should be in master database
If no function all connections go to default group
18. Limitations
Internal Pool always wins
Default Pool is always there
No resource contention=no resource governing
Importance is only weight
Does not recognize waiting tasks
No TempDB limits
22. Other Limitations
Database Engine
Only—Nothing for
SSAS, SSRS, SSIS
Limit of 18 user-
defined resource
pools
Many components
(Database Mail,
linked server
queries, XPs) are
not subject to
resource governor
No IO throttling
until SQL 2014
What we did before to control resource usage was inflexible and largely reactive:
Kill SPIDs with “runaway” queries
utilize SET QUERY_GOVERNOR_COST_LIMIT per query (or per instance with sp_configure)
use separate instances with affinity to separate workloads
juggle scheduled jobs to avoid peak activity times
schedule creation / destruction of procedures or even changing passwords to block certain groups during peak load times
Classifier function - Return workload name (sysname)
Collation sensitive workload name
Error assigns DEFAULT group
Can’t assign INTERNAL group
Must be schema-bound
xA bucket of “similar” requests (as determined by you). Thing to that your connection has been assigned to after it has been classified.If classifier function does not work, default poolDDL
Internal Tasks (Lazy-writer, checkpoint, ghost cleanup) run under internal group. It can pressurize everything else.Default Group has no limit but can get pressurize by everything else.Max Requests.
One pool : many groups (no limit)
Controls:
Importance (Low, Normal, High)
Max Concurrent Requests
Request Max CPU Time Seconds
Request Max Memory Grant Percent
Request Max Memory Grant Timeout
Request MAX DOP
Please note: Amount of Memory is not what you might think. Its amount of “query execution memory” given to that connection. Its NOT total amount of Server Memory. So you could have a connection that reads a lot of data and uses buffer pool. It doesn’t count of Plan Cache and Bpool.Default and InternalCPU: Amount of CPU is for per scheduler. NOTE:::: If there is no contention you would not see throttling. RG kicks in when there is a need.
The internal pool represents the resources consumed by the SQL Server itself. This pool always contains only the internal group, and the pool is not alterable in any way. Resource consumption by the internal pool is not restricted. Any workloads in the pool are considered critical for server function, and Resource Governor allows the internal pool to pressure other pools even if it means the violation of limits set for the other pools.
In some cases, Resource Governor will act differently than how it is set up. Let’s look at a few of these cases.
No resource contention. Although you have set up some limitation to the resources for a particular pool, you might find cases when the limits are not taken into account. Consider a scenario where you have set up a pool with a CPU cap of 25%. If at the time of executing a task in that pool there are no other active or workable SPIDS in other pools, this cap will not be taken into account.
Importance. Let’s say you have two tasks: Task A with importance of HIGH, and Task B with importance of LOW. These settings do not mean that Task A will execute first, and then Task B will be executed. Importance is nothing but a numeric weight given to a request. What the importance settings actually do is to tell the scheduler to give 3 out of 4 units of work to Task A and the other one part to Task B. Both tasks can execute simultaneously.
Waiting or pre-emptive state. If a query is waiting for other resources such as I/O, another query that has a cap set might use all available resources even though the first task is still active. That is because Resource Governor does not recognize a task that is in a WAITING for resource mode.
Off-limit requests. There are quite a few requests that are off limits to Resource Governor. Extended stored procedures, for example, are usually off limits, including Database Mail, linked server queries, and COM/OLE automation.