Sei sulla pagina 1di 2

AsmanyotherDMVsrelatedtomemorysys.dm_os_memory_cache_countersisalsoanindependentone.

Thisgiveyouarowforeachcache.Itgivesyoutheinformationlikememoryallocated(pages_kb)andmemory
used(pages_in_use_kb).Thisalsohelpsyouseeanymemorypressurerelatedtoaparticularcache.
Cachescancompeteformemoryandcanleadtoflushingothercaches.ThisisinternalMemorypressureand
ishandledbySQLOSinternally.Youmayseecertainperformancedegradationwhenthisoccurs.SQLServer
hashardlimitonallcachesandsoftlimitonindividualcache.Eachcachewillgrowasrequiredusingstepping
algorithm.Thehardlimitchangesfromversiontoversionandmemoryavailable.Thesoftlimitislimitedto
62.5%ofallcache.Thismeansanycachecangrowmaxupto62.5%ofthetotalcachelimit(hardlimit).

(Imagecurtsey:GoogleIdeacurtsey:BobWard)
TounderstandhowcriticalthisissuecanbethereisabugonSQL2012RTM.WhenyousetAlwaysONona
hightransactionprocessingmachinethecompletememorygetsfilledupandeventuallyyouSQLinstance
crashes.Youwillseemessageslikebelowinyourerrorlog.
Failedallocatepages:FAIL_PAGE_ALLOCATION8
Error:701,Severity:17,State:107.
Thereisinsufficientsystemmemoryinresourcepooldefaulttorunthisquery.
Totroubleshootaboveissueyoucancheckwhichcacheistakingupmorememoryusing
sys.dm_os_memory_cache_counters.InthiscaseyouwouldobserveMEMORYCLERK_SQLLOGPOOL
takingupmorememoryfromsys.dm_os_memory_clerks.Thisclerkisusedinternallyfortransactionlog
activity.ThisissueisfixedinCU5forRTMandCU2forSP1(Ref:KB2769594)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

/*****SQLServer2005through2008R2*****/
SELECTname,

type,

SUM(single_pages_kb+multi_pages_kb)ASSize,

SUM(single_pages_in_use_kb+multi_pages_in_use_kb

SUM(entries_count)ASEntries,

SUM(entries_in_use_count)ASUsed_Entries
FROMsys.dm_os_memory_cache_counters
GROUPBYname,type
ORDERBY4DESC

/*****SQLServer2012orlaterversions*****/
SELECTname,

type,

SUM(pages_kb)ASSize,

SUM(pages_in_use_kb)ASUsed_Size,

SUM(entries_count)ASEntries,

SUM(entries_in_use_count)ASUsed_Entries
FROMsys.dm_os_memory_cache_counters
GROUPBYname,type

21 ORDERBY4DESC

Sys.dm_os_memory_cache_counterscanbeusedasbelow.Thereissmallchangeinthecolumnsfrom2008
R2to2012.AsIhavealreadymentionedinmypreviousblogsinthisseries,thememoryarchitectureis
changedin2012.Thebelowqueriescanberunbasedontherespectiveversion.
OnethingtoobserveistheUSERSTORE_xxxxtypeobjectsusedspacewillnotbetrackedby
sys.dm_os_memory_cache_counters.

Potrebbero piacerti anche