Balmukund Lakhani Technical Lead – SQL Support Team .
-
Upload
isabella-lucas -
Category
Documents
-
view
217 -
download
5
Transcript of Balmukund Lakhani Technical Lead – SQL Support Team .
Managing and Optimizing Resources for SQL ServerBalmukund LakhaniTechnical Lead – SQL Support Teamhttp://blogs.msdn.com/SQLServerFAQhttp://blogs.msdn.com/BLakhani
About me
Currently Technical Lead – SQL Support Team.Owner http://blogs.msdn.com/SQLServerFAQActive Participant in MSDN Forum for SQL.
In pastSr. Support Engineer - MicrosoftPremier Field Engineer – MicrosoftSupport Engineer - MicrosoftERP Consultant – Ramco SystemsSr. Systems Analyst – Ramco SystemsSQL Developer / DBA – Ramco Systems
Why Resource Governor?
There have been asks for “limits” Control Run-away queries.Give control to DBA.
SQL Server
SQL 2005 Resource Management
Single resource poolDatabase engine doesn’t differentiate workloadsBest effort resource sharing
Backup
Admin Tasks
Executive Reports
OLTP Activity
Ad-hoc Reports
Workloads
Resources
Memory, CPU, Threads
Resources
Concepts…
Classifier Function• Classify connection to workload
group
Workload Group• Aggregate similar session
requests
Resource Pool• Manage server’s physical
resources
Resource Governor – Workloads
Ability to differentiate workloads
e.g. app_name, loginPer-request limits
Max memory %Max CPU timeGrant timeoutMax Requests
Resource monitoring
SQL Server
Memory, CPU, Threads
Resources
Admin Workload
OLTPWorkload
ReportWorkload
Backup
Admin Tasks
OLTP Activity
Ad-hocReports
ExecutiveReports
Resource Governor – Importance
A workload can have an importance label
LowMediumHigh
Gives resource allocation preference to workloads based on importance
SQL Server
Memory, CPU, Threads
Resources
Admin Workload
OLTPWorkload
ReportWorkload
Backup
Admin Tasks
OLTP Activity
Ad-hocReports
ExecutiveReports
High
Resource Governor – Pools
Resource pool: A virtual subset of physical database engine resourcesProvides controls to specify
Min Memory %Max Memory %Min CPU %Max CPU %Max DOP
Resource monitoringUp to 20 resource pools
SQL Server
Min Memory 10%Max Memory 20%
Max CPU 20%
Admin Workload
OLTPWorkload
ReportWorkload
Backup
Admin Tasks
OLTP Activity
Ad-hocReports
ExecutiveReports
High
Max CPU 90%
Admin Pool Application Pool
Putting it all together
Workloads are mapped to Resource Pools (n : 1)Online changes of groups/poolsSQL Server 2005 = default group + default poolMain Benefit
Prevent run-away queries
SQL Server
Min Memory 10%Max Memory 20%
Max CPU 20%
Admin Workload
OLTPWorkload
ReportWorkload
Backup
Admin Tasks
OLTP Activity
Ad-hocReports
ExecutiveReports
High
Max CPU 90%
Admin Pool Application Pool
Classifier Function Code
host_name ()app_name ()suser_name ()suser_sname ()is_srvrolemember ()is_member ()original_db_name ()loginpropertyconnectionproperty
UDF rules apply:No data modificationNo DCLNo transactionsNo stored proceduresNo XPs with rowsetNo EXECNo linked servers
Oops!!! that didn’t go well…
Why didn’t SQL Server put a limit on the CPU that the query was using?
If there are no other cars on the road, why should the governor slow down the solo driver?
Why don’t we try that again, but this time we will add one more session
Monitoring Resource Governor
Metadata CVs:sys.resource_governor_resource_poolssys.resource_governor_workload_groupssys.resource_governor_configuration
Running value DMVs:sys.dm_resource_governor_resource_poolssys.dm_resource_governor_workload_groups
Consolidation
Problem:My users won’t let me put Payroll and GL on the same server.
3rd party packages have unknown, uncontrollable queries.
Solution:Configure RG by application or database to minimise interference.
Offer enhanced performance for key business cycles, such as pay-day or end-of-quarter.
Ad-hoc Reporting
Problem:
Excel and Access users use production databases for workgroup applications.
Particularly for reporting, we can’t control their impact on transaction processing .
Solution:
Create workload groups by application, such as ‘%excel%’ and ‘%access%’
Assign those workload groups to a low-priority resource pool.
Use workload connection limits to restrict concurrent usage.
Limitations
Database Engine only – no SSAS, SSRS, SSISMany components are not subject to RG, for example sp_OA, linked server queries, XPs, database mailLimit of 18 user-defined resource pools (20 total)Cannot constrain internal pools / groupsNo throttling of I/O yet.Enterprise Edition only!
What Else Can You Do?
This is just a quick start to the resource governor, we can do much more with this.Classifiers based on other criteria
Time of dayApplication connecting to certain DB
Using the DMVs to determine issues and modify workload groups or resource pools on the flyMuch more!
More Resources…
Books Onlinewww.SQLCommunity.comhttp://blogs.msdn.com/b/psssqlhttp://blogs.technet.com/b/sqlos
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.