(DBA-403-M) DBA-403 SQLOS Memory Manager Changes in SQL Server 2012
(DBA-403-M) DBA-403 SQLOS Memory Manager Changes in SQL Server 2012
What Happens?
A contiguous region of memory addresses Every process has its own which provides isolation Up to 4GB on 32 bit and 8TB on 64 bit, can become fragmented A region has to be reserved and then committed before using
Conventional: Normal physical page size (8KB), page-able, dynamic Locked Pages: Normal physical page size, non-page-able, dynamic Large Pages: Large physical page size (>=2MB), non-page-able, static Page size is 8KB, and allocated through Single Page Allocation/Allocator Contiguous allocation of >8KB is called Multi-Page Allocation
Processor Architectures
Symmetric Multi Processing (SMP)
Memory
CPU 0
CPU 1
CPU 2
CPU 3
CPU 4
CPU 5
CPU 6
CPU 7
CPU 0
CPU 2
CPU 4
CPU 6
CPU 1
Local Memory Access
CPU 3
Memory
CPU 5
Memory
CPU 7
What it is not?
Storage Engine
SQLOS API
Buffer Pool
External Components
Hosting API
SQLOS
Scheduling XEvents Memory Manager
Synchronization
I/O
Complex queries and plans that allocate more than 8KB of memory have poor scalability & performance
Does not support different memory models (locked, large pages) No caching for larger allocations greater than 64KB
Memory Objects
CLR
Buffer Pool
Memory Objects
CLR
Single-page Allocator
Memory Manager
VAS Allocator
Buffer Pool
Multi-page Allocator
VAS Allocator
Memory Manager
-g MemToReserve
-g MemToReserve
Memory Objects
CLR
Buffer Pool
Memory Objects
CLR
Single-page Allocator
Memory Manager
VAS Allocator
Buffer Pool
Multi-page Allocator
VAS Allocator
Memory Manager
-g MemToReserve
-g MemToReserve
Top Level Block: Blocks of VAS allocated directly from fragments. All top level blocks have the same size and partitioned by NUMA Workspace: A set of top level blocks. The allocations from a workspace will have similar lifetime..
Workspace 1
Workspace 2
4MB
128KB 512KB
8KB
16KB
32KB
64KB
4MB
128KB 512KB
Workspace hierarchy Tuned for typical SQL Server workloads Allows fast allocation of memory needed for SQL Server workloads
8KB
16KB
32KB
64KB
OS
CLR, MPA, DWA, TS
max server memory
OS
DWA, TS
Demo
Sizing SQL Server memory usage in SQL Server 2008 and SQL Server 2012
sys.dm_os_sys_info SQL Server 2012 physical_memory_kb virtual_memory_kb committed_kb committed_target_kb visible_target_kb SQL Server 2008 R2 physical_memory_in_bytes virtual_memory_in_bytes bpool_committed bpool_commit_target bpool_visible
Demo
Troubleshooting Memory Errors in SQL Server 2008 R2 and SQL Server 2012
Improved performance & scalability of complex queries and operations making greater than 8KB allocations
Improved CPU and NUMA locality for memory accesses
Advantage of a single Memory Manager that services all size page allocations requests
Consistent out-of-memory handling & management across different internal components
Locked Pages for stability should not be necessary on deployments using Windows Server 2008 and beyond
LPs: 8 Memory: 32GB LP = Logical Processor: Computing engine in the OS, application and driver view
LPs: 2
Mem: 12GB
LPs: 2
Mem: 4GB
References
Locked pages KB918483 CPU affinity Books Online Topic AWE deprecation announce in SQL 2008 R2 Performance Troubleshooting whitepaper SQL Consolidation prescriptive guidance
Thank you
for attending this session and the 2012 PASS Summit in Seattle
[Session Code]