How is MSSQL using memory?

  • Memory is one the most important factor affecting MSSQL performance.
  • As an administrator, you should be monitoring the memory regularly. When Microsoft SQL Server runs out of memory, it will use virtual memory: ie: disk paging, which will grind MSSQL to a halt.
  • You can keep track of the memory with dbcc memorystatus.

Applies to:

  • Microsoft SQL Server 2005
  • Microsoft SQL Server 2008

Memorystatus

  1. DBCC MEMORYSTATUS
Memory Manager                  KB 
------------------------------ --------------------
VM Reserved                    538308
VM Committed                   129888
AWE Allocated                  0
Reserved Memory                1024
Reserved Memory In Use         0

(5 row(s) affected)

Memory node Id = 0              KB 
------------------------------ --------------------
VM Reserved                    534148
VM Committed                   125880
AWE Allocated                  0
MultiPage Allocator            7688
SinglePage Allocator           21808

(5 row(s) affected)

MEMORYCLERK_SQLGENERAL (Total)                                    KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            952
 MultiPage Allocator                                             1544

(7 row(s) affected)

MEMORYCLERK_SQLBUFFERPOOL (Total)                                 KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     523596
 VM Committed                                                    116008
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            0
 MultiPage Allocator                                             128

(7 row(s) affected)

MEMORYCLERK_SQLOPTIMIZER (Total)                                  KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            128
 MultiPage Allocator                                             72

(7 row(s) affected)

MEMORYCLERK_SQLUTILITIES (Total)                                  KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     120
 VM Committed                                                    120
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            128
 MultiPage Allocator                                             0

(7 row(s) affected)

MEMORYCLERK_SQLSTORENG (Total)                                    KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     832
 VM Committed                                                    832
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            608
 MultiPage Allocator                                             72

(7 row(s) affected)

MEMORYCLERK_SQLCONNECTIONPOOL (Total)                             KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            192
 MultiPage Allocator                                             0

(7 row(s) affected)

MEMORYCLERK_SQLCLR (Total)                                        KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

MEMORYCLERK_SQLSERVICEBROKER (Total)                              KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            64
 MultiPage Allocator                                             192

(7 row(s) affected)

MEMORYCLERK_SQLHTTP (Total)                                       KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

MEMORYCLERK_SNI (Total)                                           KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             16

(7 row(s) affected)

MEMORYCLERK_FULLTEXT (Total)                                      KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            16
 MultiPage Allocator                                             0

(7 row(s) affected)

MEMORYCLERK_SQLXP (Total)                                         KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            16
 MultiPage Allocator                                             0

(7 row(s) affected)

MEMORYCLERK_HOST (Total)                                          KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            16
 MultiPage Allocator                                             0

(7 row(s) affected)

MEMORYCLERK_SOSNODE (Total)                                       KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            1136
 MultiPage Allocator                                             5424

(7 row(s) affected)

MEMORYCLERK_SQLSERVICEBROKERTRANSPORT (Total)                     KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            24
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_OBJCP (Total)                                          KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            216
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_SQLCP (Total)                                          KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            9672
 MultiPage Allocator                                             48

(7 row(s) affected)

CACHESTORE_PHDR (Total)                                           KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            4176
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_XPROC (Total)                                          KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            40
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_TEMPTABLES (Total)                                     KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            16
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_NOTIF (Total)                                          KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            16
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_VIEWDEFINITIONS (Total)                                KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            16
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_XMLDBTYPE (Total)                                      KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_XMLDBELEMENT (Total)                                   KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_XMLDBATTRIBUTE (Total)                                 KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_STACKFRAMES (Total)                                    KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            0
 MultiPage Allocator                                             8

(7 row(s) affected)

CACHESTORE_BROKERTBLACS (Total)                                   KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            224
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_BROKERKEK (Total)                                      KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_BROKERDSH (Total)                                      KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_BROKERUSERCERTLOOKUP (Total)                           KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_BROKERRSB (Total)                                      KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_BROKERREADONLY (Total)                                 KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            72
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_BROKERTO (Total)                                       KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_EVENTS (Total)                                         KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            16
 MultiPage Allocator                                             0

(7 row(s) affected)

CACHESTORE_SYSTEMROWSET (Total)                                   KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            864
 MultiPage Allocator                                             0

(7 row(s) affected)

USERSTORE_SCHEMAMGR (Total)                                       KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            552
 MultiPage Allocator                                             0

(7 row(s) affected)

USERSTORE_DBMETADATA (Total)                                      KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            1544
 MultiPage Allocator                                             0

(7 row(s) affected)

USERSTORE_TOKENPERM (Total)                                       KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            40
 MultiPage Allocator                                             0

(7 row(s) affected)

USERSTORE_OBJPERM (Total)                                         KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            176
 MultiPage Allocator                                             0

(7 row(s) affected)

USERSTORE_SXC (Total)                                             KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            8
 MultiPage Allocator                                             0

(7 row(s) affected)

OBJECTSTORE_LBSS (Total)                                          KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            48
 MultiPage Allocator                                             0

(7 row(s) affected)

OBJECTSTORE_SNI_PACKET (Total)                                    KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            120
 MultiPage Allocator                                             48

(7 row(s) affected)

OBJECTSTORE_SERVICE_BROKER (Total)                                KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     0
 VM Committed                                                    0
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            256
 MultiPage Allocator                                             0

(7 row(s) affected)

OBJECTSTORE_LOCK_MANAGER (Total)                                  KB 
---------------------------------------------------------------- --------------------
 VM Reserved                                                     1024
 VM Committed                                                    1024
 AWE Allocated                                                   0
 SM Reserved                                                     0
 SM Commited                                                     0
 SinglePage Allocator                                            328
 MultiPage Allocator                                             0

(7 row(s) affected)

Buffer Distribution            Buffers
------------------------------ -----------
Stolen                         419
Free                           53
Cached                         2307
Database (clean)               11449
Database (dirty)               108
I/O                            0
Latched                        0

(7 row(s) affected)

Buffer Counts                  Buffers
------------------------------ --------------------
Committed                      14336
Target                         24244
Hashed                         11557
Stolen Potential               58849
External Reservation           0
Min Free                       32
Visible                        24244
Available Paging File          83403

(8 row(s) affected)

Procedure Cache                Value
------------------------------ -----------
TotalProcs                     208
TotalPages                     1769
InUsePages                     28

(3 row(s) affected)


Global Memory Objects          Buffers
------------------------------ --------------------
Resource                       138
Locks                          44
XDES                           8
SETLS                          1
SE Dataset Allocators          2
SubpDesc Allocators            1
SE SchemaManager               68
SQLCache                       39
Replication                    2
ServerGlobal                   25
XP Global                      2
SortTables                     2

(12 row(s) affected)


Query Memory Objects           Value
------------------------------ -----------
Grants                         0
Waiting                        0
Available (Buffers)            7865
Maximum (Buffers)              7865
Limit                          17286
Next Request                   0
Waiting For                    0
Cost                           0
Timeout                        0
Wait Time                      0
Last Target                    18195

(11 row(s) affected)

Small Query Memory Objects     Value
------------------------------ -----------
Grants                         0
Waiting                        0
Available (Buffers)            906
Maximum (Buffers)              906
Limit                          906

(5 row(s) affected)

Optimization Queue             Value
------------------------------ --------------------
Overall Memory                 159031296
Target Memory                  134381568
Last Notification              1
Timeout                        6
Early Termination Factor       5

(5 row(s) affected)

Small Gateway                  Value
------------------------------ --------------------
Configured Units               4
Available Units                4
Acquires                       0
Waiters                        0
Threshold Factor               250000
Threshold                      250000

(6 row(s) affected)

Medium Gateway                 Value
------------------------------ --------------------
Configured Units               1
Available Units                1
Acquires                       0
Waiters                        0
Threshold Factor               12

(5 row(s) affected)

Big Gateway                    Value
------------------------------ --------------------
Configured Units               1
Available Units                1
Acquires                       0
Waiters                        0
Threshold Factor               8

(5 row(s) affected)

MEMORYBROKER_FOR_CACHE           Value
-------------------------------- --------------------
Allocations                      2306
Rate                             0
Target Allocations               18297
Future Allocations               0
Last Notification                1

(5 row(s) affected)

MEMORYBROKER_FOR_STEAL           Value
-------------------------------- --------------------
Allocations                      413
Rate                             0
Target Allocations               16404
Future Allocations               0
Last Notification                1

(5 row(s) affected)

MEMORYBROKER_FOR_RESERVE         Value
-------------------------------- --------------------
Allocations                      0
Rate                             0
Target Allocations               19413
Future Allocations               4321
Last Notification                1

(5 row(s) affected)

DBCC execution completed. If DBCC printed error messages, contact your system administrator.
  • Memory Manager: shows overall memory consumption by SQL Server
  • Memory node Id: usage for each memory node: summary of memory usage
  • MEMORYCLERK_SQLGENERAL: aggregate for each memory node: aggregate memory
  • Buffer distribution: the distribution of 8-kilobyte (KB) buffers in the buffer pool
  • Buffer Counts: Buffer pool details from sys.dm_os_buffer_descriptors
  • Procedure cache: Size and type
  • Global memory objects: size of the global memory objects
  • Query memory objects: snapshot of the query memory usage: the workspace memory
  • Optimization Queue: summary of the users who are trying to optimize queries at the same time
  • MEMORYBROKER_FOR_CACHE: control cached memory, stolen memory, and reserved memory