10.3 Server Settings and Resource Governor
Key Takeaways
- Key server-level settings: MAXDOP (8 for OLTP), cost threshold for parallelism (raise for OLTP), min/max server memory, fill factor, and optimize for ad hoc workloads.
- Azure SQL Database does not expose sp_configure; MAXDOP is per-database via ALTER DATABASE SCOPED CONFIGURATION; SQL MI exposes only a few server options.
- Resource Governor has three components: resource pools, workload groups, and a classifier function (a scalar UDF) called on every new session.
- Resource Governor is full on SQL Server on VMs, limited/preview on SQL MI, and not available on Azure SQL Database; use elastic pools for DB isolation there instead.
- Use Resource Governor for multi-tenant isolation (guaranteed minimums, capped maximums) and runaway-query protection via request_max_memory_grant_percent.
Why Server Settings and Resource Governor Matter
On-prem SQL Server and SQL Server on Azure VMs expose a wide set of server-level configuration options that affect performance: parallelism, memory, threading, and disk layout. Resource Governor layers a workload-isolation mechanism on top, so a single instance can serve competing workloads without one starving the others. DP-300 tests the well-known server settings and the Resource Governor architecture, plus the important platform caveat: most server-level tuning and Resource Governor are not available on Azure SQL Database, and only limited on SQL Managed Instance.
Server-Level Performance Settings
Key options in sp_configure and their DP-300-relevant behavior:
| Option | Effect | Notes |
|---|---|---|
| max degree of parallelism (MAXDOP) | Caps parallelism per query | Default 0 (use all CPUs); best practice 8 for OLTP, 0 for reporting |
| cost threshold for parallelism | Minimum query cost before parallelism is considered | Default 5; raise for OLTP to stop tiny queries going parallel |
| max worker threads | Caps the thread pool | Default 0 (auto); rarely changed |
| affinity | Binds schedulers to CPUs | Rarely used on Azure VMs |
| min/max server memory | Bounds the buffer pool | Set max memory to leave room for OS; leave a few GB for non-buffer use |
| fill factor (%) | Leaves free space in index leaf pages | Default 0 (full); 80–90 for high-churn insert tables |
| optimize for ad hoc workloads | Caches only a small plan stub for one-shot ad hoc batches | Reduces plan-cache bloat from non-parameterized queries |
| remote admin connections | Allows DAC from remote | Useful for troubleshooting locked instances |
Best-practice MAXDOP guidance from Microsoft: for servers with a single NUMA node and 8 or more logical cores, set MAXDOP to 8; for OLTP-only servers, lower values are often appropriate. On Azure VMs, also respect vCore boundaries — do not set MAXDOP higher than the vCore count. A frequent scenario pattern: OLTP queries going parallel unnecessarily — raise cost threshold for parallelism first (the cheaper fix), and only then consider lowering MAXDOP.
Azure SQL DB / MI Server Config Differences
On Azure SQL Database, you cannot run sp_configure for these server-level settings. The platform controls them. MAXDOP is configurable per database via ALTER DATABASE SCOPED CONFIGURATION SET MAXDOP = ..., not via sp_configure. Server-level memory, worker threads, and affinity are not exposed. On SQL Managed Instance, server-level configuration is also mostly managed; you control MAXDOP through the instance properties (Azure Resource Manager) and via DSC, and a few sp_configure options are read-only. The general exam principle: on PaaS offerings, prefer database-scoped configuration and automatic tuning to server-level tuning.
On which platforms can you use Resource Governor to isolate workloads by CPU and memory? Select the most accurate statement.
Resource Governor Architecture
Resource Governor has three components:
- Resource pools — define the resource budget. Each pool has
MIN_CPU_PERCENT,MAX_CPU_PERCENT,CAP_CPU_PERCENT,MIN_MEMORY_PERCENT,MAX_MEMORY_PERCENT, and (on SQL Server 2019+ on VMs)MIN_IOPS_PER_VOLUME/MAX_IOPS_PER_VOLUME. There are two built-in pools:internal(system tasks, cannot be constrained) anddefault(user sessions without a classifier match). - Workload groups — logical groupings of sessions within a pool. A group can set
request_max_memory_grant_percent(caps memory per request, preventing a single query from consuming the pool),max_dop, and importance. Built-in groups:internalanddefault. - Classifier function — a scalar UDF in
masterthat Resource Governor calls for every new session. It returns the name of the workload group the session belongs to, based onSUSER_NAME(),APP_NAME(),HOST_NAME(), or connection properties.
The typical flow: create a pool for each workload class (for example, rp_Reporting, rp_TenantA), create a workload group inside each pool, write a classifier UDF that maps incoming sessions to the right group, and register the function with ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = dbo.ClassifierFn).
Enabling and Configuring Resource Governor
Resource Governor is off by default. Enable with ALTER RESOURCE GOVERNOR RECONFIGURE. Changes to pools, groups, and the classifier function require a RECONFIGURE to take effect. To turn it off (and route all sessions to the default pool), ALTER RESOURCE GOVERNOR DISABLE. The classifier function runs on every login, so it must be fast and deterministic — a slow or non-deterministic classifier adds connection latency for every session.
MIN, MAX, and CAP_CPU_PERCENT
The three CPU settings differ in subtle ways the exam tests:
- MIN_CPU_PERCENT — guaranteed minimum CPU share when there is contention. The sum of all pools' minimums cannot exceed 100.
- MAX_CPU_PERCENT — the maximum share the pool can use when there is contention. With no contention, a pool can exceed its MAX (up to 100).
- CAP_CPU_PERCENT — a hard ceiling that applies even when there is no contention. Use CAP when you must guarantee a pool never exceeds a specific CPU share regardless of system load.
Memory works similarly with MIN_MEMORY_PERCENT and MAX_MEMORY_PERCENT, but there is no CAP equivalent for memory.
When to Use Resource Governor
The two canonical use cases:
- Tenant isolation — multi-tenant SaaS on a single SQL Server instance: each tenant's workload lands in its own pool with guaranteed minimums and capped maximums, so a busy tenant cannot starve the others.
- Runaway query protection — ad hoc or reporting workloads that occasionally produce a giant query: the workload group's
request_max_memory_grant_percentcaps the grant, andMAX_CPU_PERCENTlimits the CPU share, protecting OLTP from being squeezed out.
Platform Limitations
Resource Governor is not available on Azure SQL Database; isolation there is done through elastic pool per-database min/max and service-tier sizing. On SQL Managed Instance, support is limited — CPU governance is available, but the classifier function has restrictions (no SQL CLR) and IO governance is not exposed. For full, production-grade workload isolation, the exam answer is SQL Server on Azure VMs.
In Resource Governor, how is an incoming session assigned to a workload group?