SQL Server TempDB Contention & Allocation Page Bottlenecks in Higher-Ed ERP Systems

Diagnose PAGELATCH_EX and PAGELATCH_SH contention on PFS and GAM/SGAM pages in SQL Server hosting higher-ed systems like Ellucian CRM Recruit, Colleague, and PeopleSoft.

⚡ BLUF (Bottom Line Up Front) Summary

⚠️ Advisory Scope & Terms

High-concurrency batch runs, registration spikes, and temporary table creation in higher-ed ERPs cause extreme PAGELATCH_EX and PAGELATCH_SH wait events on TempDB allocation pages (PFS and GAM). Resolving this bottleneck requires configuring multiple equal-sized TempDB datafiles, enabling Trace Flags 1117/1118 (or using SQL Server 2016+ defaults), and leveraging Memory-Optimized TempDB Metadata.

Environment & Prerequisites

ComponentVersion / Specification
Database EngineMicrosoft SQL Server 2019 / 2022
ERP PlatformsEllucian CRM Recruit / Colleague / PeopleSoft
OS PlatformWindows Server 2022 / Red Hat Enterprise Linux 8

nterprise Higher Education systems—such as Ellucian CRM Recruit (Dynamics 365), Ellucian Colleague, and PeopleSoft running on Microsoft SQL Server—frequently experience severe database stalls during high-concurrency events. Events like student admissions surges, registration opening, financial aid disbursement runs, and end-of-term grading generate massive bursts of temporary object creation. When hundreds of concurrent user sessions execute complex queries involving #temp tables, table variables (@table), or large sort/hash spill operations, SQL Server’s central TempDB system database becomes a critical performance bottleneck.

The primary root cause of this performance degradation is latch contention on allocation tracking pages: Page Free Space (PFS), Global Allocation Map (GAM), and Shared Global Allocation Map (SGAM). When hundreds of worker threads simultaneously attempt to allocate or deallocate 8-page extents within a single TempDB datafile, threads stall while waiting to acquire exclusive access to allocation page latches, manifesting as severe PAGELATCH_EX and PAGELATCH_SH wait events.


Architecture & Process Flow

Understanding how TempDB page allocation operates across storage datafiles illustrates why default single-file installations fail under enterprise ERP workloads:

Phase 1
ERP Query Requests Temp Table
Phase 2
Thread Latches PFS Page (2:1:1)
Phase 3
PAGELATCH_EX Contention Spike
Phase 4
Proportional Fill & Multi-File Spread

🔍 Diagnostic Checklist & Error Symptoms

When TempDB allocation bottlenecks hit your SQL Server database instance, application users report high response latencies or connection timeouts. Database administrators can confirm TempDB latch contention using the following T-SQL diagnostic queries.

Step 1: Detect PAGELATCH Contention via Waiting Tasks

Query sys.dm_os_waiting_tasks to identify active sessions waiting on TempDB (database_id = 2) allocation pages:

-- Query to identify active TempDB latch contention and resource page numbers
SELECT 
    wt.session_id,
    wt.wait_type,
    wt.wait_duration_ms,
    wt.blocking_session_id,
    wt.resource_description,
    er.command,
    er.sql_handle
FROM sys.dm_os_waiting_tasks wt
JOIN sys.dm_exec_requests er ON wt.session_id = er.session_id
WHERE wt.wait_type LIKE 'PAGELATCH_%'
  AND wt.resource_description LIKE '2:%'; -- Database ID 2 is always TempDB

💡 Tip: A resource_description formatted as 2:1:1 indicates database 2 (TempDB), file 1, page 1 (the PFS page). Page 2:1:2 indicates the GAM page, and 2:1:3 indicates the SGAM page.

Step 2: Analyze Wait Statistics Aggregates

Verify if PAGELATCH_EX or PAGELATCH_SH dominates total system wait time:

-- Aggregated wait statistics for PAGELATCH wait types
SELECT 
    wait_type,
    waiting_tasks_count,
    wait_time_ms,
    max_wait_time_ms,
    signal_wait_time_ms
FROM sys.dm_os_wait_stats
WHERE wait_type IN ('PAGELATCH_EX', 'PAGELATCH_SH', 'PAGELATCH_UP')
ORDER BY wait_time_ms DESC;

Step-by-Step Resolution Runbook

Resolving TempDB allocation page bottlenecks requires a structured tuning procedure. Every step below must be executed according to best practices to eliminate latch contention.

Step 0: Pre-Flight Safety Checks & Rollback Preparation

Before modifying system configurations or adding datafiles, document current database file locations and file growth parameters:

-- Capture baseline configuration for TempDB datafiles
SELECT 
    file_id,
    name,
    physical_name,
    (size * 8) / 1024 AS size_mb,
    is_percent_growth,
    growth AS growth_pages
FROM tempdb.sys.database_files;

Step 1: Configure Multiple Equal-Sized TempDB Datafiles

The most effective fix for PFS/GAM page contention is splitting TempDB into multiple datafiles of identical initial size and autogrowth settings. This enables SQL Server’s proportional fill algorithm and round-robin allocation to distribute allocation page latches evenly across files.

  • Rule of Thumb: Configure 1 datafile per logical CPU core up to 8 datafiles. If cores exceed 8, start with 8 datafiles and add in blocks of 4 only if contention persists.

Execute the following T-SQL to add equal-sized datafiles:

-- Step 1: Modify existing primary file size and autogrowth
ALTER DATABASE [tempdb] 
MODIFY FILE ( NAME = N'tempdev', SIZE = 8192MB , FILEGROWTH = 1024MB );
GO

-- Step 2: Add additional equal-sized files (Example for 4-file setup)
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev2', FILENAME = N'T:\TempDB\tempdev2.ndf' , SIZE = 8192MB , FILEGROWTH = 1024MB );
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev3', FILENAME = N'T:\TempDB\tempdev3.ndf' , SIZE = 8192MB , FILEGROWTH = 1024MB );
ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev4', FILENAME = N'T:\TempDB\tempdev4.ndf' , SIZE = 8192MB , FILEGROWTH = 1024MB );
GO

🚨 Warning: All TempDB datafiles MUST have identical initial sizes and autogrowth increments. If one file grows larger than others, proportional fill will route all new allocations to that single file, re-introducing latch contention!


Step 2: Enforce Trace Flags 1117 & 1118 (SQL Server 2014 and Earlier)

On legacy SQL Server versions (2014 and prior), enable Trace Flags 1117 (grow all files in a filegroup simultaneously) and 1118 (force uniform extent allocations, bypassing mixed extents and SGAM pages).

  • SQL Server 2016+: Trace Flags 1117 and 1118 are enabled by default for TempDB and cannot be disabled.
  • SQL Server 2014 and older: Enable trace flags globally via SQL Server Configuration Manager startup parameters -T1117 and -T1118, or execute:
-- Enable trace flags globally (requires sysadmin)
DBCC TRACEON (1117, 1118, -1);
GO

Step 3: Enable Memory-Optimized TempDB Metadata (SQL Server 2019+)

In SQL Server 2019 and 2022, system table metadata contention for temporary tables (contention on catalog tables like sysobjvalues and sysschobjs) can be completely eliminated by converting TempDB metadata management into In-Memory OLTP memory-optimized tables.

Enable Memory-Optimized TempDB Metadata via sp_configure:

-- Enable Memory-Optimized TempDB Metadata (Requires SQL Server Restart)
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
GO

EXEC sp_configure 'tempdb metadata memory-optimized', 1;
RECONFIGURE;
GO

🚨 Warning: Enabling Memory-Optimized TempDB Metadata requires an instance restart. Test thoroughly in non-production environments as certain features (such as COLUMNSTORE indexes on #temp tables) have specific limitations when this feature is active.


📚 Official Documentation & Technical References


Need assistance optimizing your SQL Server database instance or resolving TempDB allocation bottlenecks for enterprise ERP applications? Contact our Infrastructure Specialists or explore our Enterprise Health Audits.

⚠️INFORMATIONAL & TECHNICAL ADVISORY DISCLAIMER

The diagnostic methodologies, commands, and runbooks provided on DBPros.Net are published for informational and educational purposes only. They do not constitute customized professional consulting advice. Operating engineers and DBAs are solely responsible for securing pre-flight backups (RMAN, VM snapshots, LVM clones), validating changes in non-production staging environments, and adhering to organizational change-control policies. All content, scripts, and runbooks are provided "AS IS" without warranty of any kind, and DBPros.Net assumes no liability for system downtime, database corruption, data loss, or operational disruption. For complete advisory limitations and legal terms, view our full Terms of Service & Advisory Disclaimer.