Home
%3CLINGO-SUB%20id%3D%22lingo-sub-315418%22%20slang%3D%22en-US%22%3EThe%20SQL%20Server%20Working%20Set%20Message%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-315418%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20May%2031%2C%202007%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EWork%26nbsp%3Bcontinues%20around%20the%20working%20set%20issues.%26nbsp%3B%20You%20can%20find%20the%20latest%20and%20greatest%20Information%3A%20%3CA%20href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fkb%2F918483%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20http%3A%2F%2Fsupport.microsoft.com%2Fkb%2F918483%3C%2FA%3E%3C%2FP%3E%0A%20%20%3CP%3E%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%20%3CBR%20%2F%3E%20I%20spent%20several%20days%20last%20week%20investigating%20reported%20case%20trends%20and%20I%20will%20attempt%20to%20summarize%20the%20findings%20for%20you.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EThe%20following%20message%20was%20added%20to%20SQL%20Server%202005%20SP2%20to%20indicate%20that%20the%20working%20set%20(RAM%20resident%20portion%20of%20SQL%20Server)%20was%20paged%20out.%26nbsp%3B%26nbsp%3B%20This%20is%20a%20common%20indication%20of%20performance%20problems%20due%20to%20the%20paging.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EA%20significant%20part%20of%20sql%20server%20process%20memory%20has%20been%20paged%20out.%20This%20may%20result%20in%20a%20performance%20degradation.%20Duration%3A%200%20seconds.%20Working%20set%20(KB)%3A%2024484%2C%20committed%20(KB)%3A%2048036%2C%20memory%20utilization%3A%2050%25%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EThere%20are%20several%20ways%20trimming%20can%20occur.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E1.%20%3CB%3ESignaled%20Trim%20%3C%2FB%3E%20%E2%80%93%20The%20low%20physical%20memory%20indicator%20event%20is%20set%20by%20the%20operating%20system%20(ref%3A%20%3CA%20href%3D%22http%3A%2F%2Fmsdn2.microsoft.com%2Fen-us%2Flibrary%2Faa366799.aspx%22%20mce_href%3D%22http%3A%2F%2Fmsdn2.microsoft.com%2Fen-us%2Flibrary%2Faa366799.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20QueryMemoryResourceNotification%20%3C%2FA%3E%20)%20when%20physical%20memory%20becomes%20low.%20%26nbsp%3BThe%20SQL%20Server%20Resource%20Monitor%2C%20Lazy%20Writer%20and%20other%20processing%20decommit%20portions%20of%20the%20BPool%20memory.%26nbsp%3B%20This%20returns%20physical%20memory%20to%20the%20system%20and%20in%20turn%20lowers%20the%20Working%20Set%20of%20the%20SQL%20Server.%26nbsp%3B%26nbsp%3B%20When%20the%20event%20is%20signaled%20the%20sys.dm_os_ring_buffer%2C%20RING_BUFFER_RESOURCE_MONITOR%20records%20are%20logged.%26nbsp%3B%26nbsp%3B%20%26nbsp%3BThis%20is%20the%20normal%20working%20behavior%20of%20the%20SQL%20Server%20as%20it%20attempts%20to%20remain%20RAM%20resident.%26nbsp%3B%26nbsp%3B%20This%20activity%20does%20not%20trigger%20the%20error%20log%20message.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E2.%20%3CB%3ESelf%20Trim%20%3C%2FB%3E%20%E2%80%93%20The%20operating%20system%20is%20handling%20a%20page%20fault%20for%20a%20newly%20allocated%20page%20and%20determines%20physical%20memory%20is%20low%20so%20the%20current%20working%20set%20should%20be%20trimmed%20(exchange%20a%20new%20page%20in%20RAM%20and%20move%20an%20older%20page%20to%20the%20page%20file).%26nbsp%3B%26nbsp%3B%20For%20example%2C%20if%20SQL%20Server%20is%20allocating%20a%20page%20for%20a%20stack%2C%20linked%20server%2C%20or%20other%20allocation%20and%20physical%20memory%20is%20in%20a%20low%20state%20the%20operating%20system%20may%20directly%20trim%20the%20working%20set%20of%20the%20SQL%20Server.%26nbsp%3B%26nbsp%3B%26nbsp%3B%20On%20current%20operating%20system%20builds%20(Windows%202003%20SP2%2C%20Windows%20XP%20SP2%2C%20%E2%80%A6)%20the%20amount%20to%20trim%20can%20be%20~1%2F4%20the%20current%20working%20set%20size.%26nbsp%3B%26nbsp%3B%26nbsp%3B%20On%20a%2064GB%20system%20the%20SQL%20Server%20working%20set%20could%20page%20out%2016GB%20in%20less%20than%20a%20second.%26nbsp%3B%26nbsp%3B%20Such%20a%20large%20trim%20does%20not%20occur%20on%20Windows%20Vista%20and%20we%20are%20looking%20at%20fixes%20for%20Windows%202003%20and%20XP%20to%20avoid%20such%20dramatic%20trimming%20behavior.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E3.%20%3CB%3EHard%20Trim%20%3C%2FB%3E%20%E2%80%93%20When%20the%20system%20gets%20into%20very%20low%20memory%20conditions%20a%20hard%20trim%20can%20occur.%26nbsp%3B%26nbsp%3B%20This%20activity%20can%20page%20out%20the%20entire%20working%20set%20for%20SQL%20Server%20and%20other%20processes%20on%20the%20box.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CBR%20%2F%3E%20The%20signaled%20trim%20allows%20SQL%20Server%20to%20properly%20remove%20the%20oldest%20references%20from%20the%20BPool%20(LRU)%20and%20maintain%20optimal%20performance%20for%20the%20overall%20server%20load.%20The%20Self%20Trim%20and%20Hard%20Trim%20activities%20can%20trigger%20the%20SQL%20Server%20error%20log%20message%20indicating%20that%20a%20significant%20portion%20of%20the%20SQL%20Server%20memory%20has%20been%20placed%20in%20the%20page%20file%20and%20generally%20leads%20to%20performance%20problems.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EThere%20have%20been%20various%20blogs%20written%20about%20backing%20off%20the%20SQL%20Server%20max%20server%20memory%20setting%20or%20using%20locked%20pages.%26nbsp%3B%26nbsp%3B%26nbsp%3B%20In%20testing%20I%20found%20that%20%3CI%3E%20it%20was%20better%20to%20understand%20the%20root%20cause%20%3C%2FI%3E%20of%20the%20trimming%20issue%20than%20simply%20setting%20the%20options.%26nbsp%3B%26nbsp%3B%20For%20example%2C%20locked%20pages%20are%20only%20maintained%20for%20the%20BPool%20allocations.%26nbsp%3B%26nbsp%3B%20Thread%20stacks%2C%20linked%20server%2C%20XPROC%20and%20other%20non-BPool%20activity%20is%20still%20subject%20to%20trimming.%26nbsp%3B%26nbsp%3B%20A%20Hard%20Trim%20can%20page%20out%20stacks%20and%20other%20critical%20structures.%26nbsp%3B%26nbsp%3B%20The%20SQL%20Server%20working%20set%20trim%20will%20only%20be%20a%20few%20100MB%20but%20all%20the%20critical%20performance%20structures%20have%20to%20be%20paged.%26nbsp%3B%26nbsp%3B%20At%20the%20same%20time%20the%20Hard%20Trim%20usually%20trims%20the%20working%20set%20of%20all%20other%20processes%20on%20the%20system%20so%20overall%20performance%20is%20affected.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CB%3E%20Basic%20Troublshooting%20%3C%2FB%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EI%20know%20of%20several%20bugs%20that%20can%20cause%20the%20behavior%20so%20here%20is%20the%20best%20set%20of%20troubleshooting%20steps%20at%20this%20time.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E1.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Make%20sure%20no%20other%20process%20are%20quickly%20eating%20up%20the%20memory.%26nbsp%3B%26nbsp%3B%20A%20key%20to%20this%20is%20watching%20the%20Memory%3A_Total%20Working%20Set%20Performance%20Counter.%26nbsp%3B%26nbsp%3B%20If%20you%20start%20an%20application%20that%20quickly%20uses%20memory%20all%20working%20sets%20can%20be%20trimmed%20quickly%20but%20the%20overall%20_Total%20remains%20steady.%26nbsp%3B%26nbsp%3B%20If%20the%20_Total%20drops%20significantly%20it%20is%20a%20good%20indication%20that%20it%20is%20not%20a%20single%20application%20quickly%20eating%20up%20memory%20but%20something%20like%20%3CI%3E%20MiEmptyWorkingSet%20%3C%2FI%3E%20or%20%3CI%3E%20MmAllocateContigiousMemory%20%3C%2FI%3E%20has%20taken%20place%20and%20the%20operating%20system%20has%20decided%20to%20engage%20in%20a%20hard%20trim.%26nbsp%3B%26nbsp%3B%20Our%20platforms%20support%20team%20can%20assist%20you%20in%20determining%20why%20the%20hard%20trim%20is%20being%20triggered.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E2.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Make%20sure%20the%20SQL%20Server%20process%20ID%20remains%20constant%20across%20the%20problem%20time.%26nbsp%3B%26nbsp%3B%20I%20found%20that%20if%20you%20stop%20the%20SQL%20Server%20service%20and%20restart%20it%20some%20of%20the%20SQL%20counters%20remain%20constant%20and%20can%20be%20misleading.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E3.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Make%20sure%20your%20system%20has%20the%20latest%20drivers.%26nbsp%3B%26nbsp%3B%20We%20have%20specifically%20encountered%20several%20drivers%20on%20X64%20that%20trigger%20hard%20trim%20behavior.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E4.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Make%20sure%20the%20OS%20Terminal%20Service%20bug%20is%20not%20causing%20the%20problem.%20%3CA%20href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B905865%22%20mce_href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B905865%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B905865%20%3C%2FA%3E%20When%20an%20admin%26nbsp%3B%20TS%E2%80%99s%20into%20the%20server%20console%2C%20and%20later%20logs%20off%2C%20winlogon%20process%20might%20initiate%20trimming%20the%20processes%20running%20in%20Session%200.%20%26nbsp%3B%26nbsp%3BThe%20post%20Windows%202003%20Sp1%20hot%20fix%20resolves%20this%20issue.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EOn%20the%20server%20you%20can%20match%20this%20to%20a%20winstations%2C%20SECURITY%2C%20event%20log%20entry%20for%20the%20System%20%E2%80%93%20Event%20ID%20682%20%E2%80%93%20Example%20of%20one%20shown%20below.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3ESession%20reconnected%20to%20winstation%3A%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EUser%20Name%3A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20USERNAME%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EDomain%3A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MYDOMAIN%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3ELogon%20ID%3A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20(0x0%2C0x12A8229)%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3ESession%20Name%3A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20RDP-Tcp%233%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EClient%20Name%3A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MYCLIENT%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EClient%20Address%3A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20615.513.165.351%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E5.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Capture%20a%20full%20set%20of%20performance%20counters%20as%20well%20as%20the%20sys.dm_os_ring_buffers%20from%20SQL%20Server.%26nbsp%3B%26nbsp%3B%20For%20example%20when%20an%20application%20on%20the%20computer%20starts%20using%20memory%20quickly%20the%20ring%20buffer%20entries%20clearly%20show%20the%20low%20physical%20memory%20indicator.%26nbsp%3B%26nbsp%3B%20When%20a%20self%20or%20hard%20trim%20occurs%20the%20low%20physical%20memory%20indicator%20is%20not%20set%20or%20only%20set%20for%20a%20short%20period%20and%20when%20compared%20to%20the%20performance%20counters%20the%20behavior%20pattern%20is%20clarified.%26nbsp%3B%20The%20self%20and%20hard%20trim%20can%20require%20Microsoft%20Platforms%20support%20to%20help%20determine%20root%20cause.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E6.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Apply%20the%20OS%20fix.%20%3CA%20href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B920739%22%20mce_href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B920739%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B920739%20%3C%2FA%3E%20The%20dirty%20page%20threshold%20is%20set%20at%20half%20the%20amount%20of%20physical%20memory.%20This%20has%20caused%20severe%20problems%20on%20systems%20with%20large%20amount%20of%20memory%2C%20when%20applications%20that%20use%20Buffered%20I%2FO%2C%20leading%20to%20trimming%2C%20and%20large%20amount%20of%20data%20being%20flushed%20to%20disk%20when%20the%20threshold%20value%20is%20hit.%26nbsp%3B%20The%20registry%20key%20must%20be%20set%20as%20recommended%20by%20the%20article%20along%20with%20the%20hot%20fix.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E7.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Apply%20the%20OS%20fix.%20%3CA%20href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B931308%22%20mce_href%3D%22http%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B931308%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fsupport.microsoft.com%2Fdefault.aspx%3Fscid%3Dkb%3BEN-US%3B931308%20%3C%2FA%3E%20You%20may%20experience%20increased%20paging%20to%20the%20hard%20disk%20when%20you%20run%20a%20program%20on%20a%20Windows%20Server%202003-based%20computer%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E8.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Apply%20SQL%20Server%202005%20SP2.%26nbsp%3B%20SP2%20has%20a%20few%20changes%20allowing%20it%20to%20react%20to%20the%20%E2%80%98Low%20Physical%20memory%E2%80%99%20faster%20as%20well%20as%20increased%20sys.dm_os_ring_buffer%20information.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CI%3E%20Bob%20Dorr%20%E2%80%93%20SQL%20Server%20Senior%20Escalation%20Engineer%20%3C%2FI%3E%20%3CI%3E%20%3C%2FI%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-315418%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20May%2031%2C%202007%20Work%26nbsp%3Bcontinues%20around%20the%20working%20set%20issues.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-315418%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Ememory%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESQL%20OS%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
First published on MSDN on May 31, 2007

Work continues around the working set issues.  You can find the latest and greatest Information: http://support.microsoft.com/kb/918483

===========================================================
I spent several days last week investigating reported case trends and I will attempt to summarize the findings for you.

The following message was added to SQL Server 2005 SP2 to indicate that the working set (RAM resident portion of SQL Server) was paged out.   This is a common indication of performance problems due to the paging.

A significant part of sql server process memory has been paged out. This may result in a performance degradation. Duration: 0 seconds. Working set (KB): 24484, committed (KB): 48036, memory utilization: 50%

There are several ways trimming can occur.

1. Signaled Trim – The low physical memory indicator event is set by the operating system (ref: QueryMemoryResourceNotification ) when physical memory becomes low.  The SQL Server Resource Monitor, Lazy Writer and other processing decommit portions of the BPool memory.  This returns physical memory to the system and in turn lowers the Working Set of the SQL Server.   When the event is signaled the sys.dm_os_ring_buffer, RING_BUFFER_RESOURCE_MONITOR records are logged.    This is the normal working behavior of the SQL Server as it attempts to remain RAM resident.   This activity does not trigger the error log message.

2. Self Trim – The operating system is handling a page fault for a newly allocated page and determines physical memory is low so the current working set should be trimmed (exchange a new page in RAM and move an older page to the page file).   For example, if SQL Server is allocating a page for a stack, linked server, or other allocation and physical memory is in a low state the operating system may directly trim the working set of the SQL Server.    On current operating system builds (Windows 2003 SP2, Windows XP SP2, …) the amount to trim can be ~1/4 the current working set size.    On a 64GB system the SQL Server working set could page out 16GB in less than a second.   Such a large trim does not occur on Windows Vista and we are looking at fixes for Windows 2003 and XP to avoid such dramatic trimming behavior.

3. Hard Trim – When the system gets into very low memory conditions a hard trim can occur.   This activity can page out the entire working set for SQL Server and other processes on the box.


The signaled trim allows SQL Server to properly remove the oldest references from the BPool (LRU) and maintain optimal performance for the overall server load. The Self Trim and Hard Trim activities can trigger the SQL Server error log message indicating that a significant portion of the SQL Server memory has been placed in the page file and generally leads to performance problems.

There have been various blogs written about backing off the SQL Server max server memory setting or using locked pages.    In testing I found that it was better to understand the root cause of the trimming issue than simply setting the options.   For example, locked pages are only maintained for the BPool allocations.   Thread stacks, linked server, XPROC and other non-BPool activity is still subject to trimming.   A Hard Trim can page out stacks and other critical structures.   The SQL Server working set trim will only be a few 100MB but all the critical performance structures have to be paged.   At the same time the Hard Trim usually trims the working set of all other processes on the system so overall performance is affected.

Basic Troublshooting

I know of several bugs that can cause the behavior so here is the best set of troubleshooting steps at this time.

1.       Make sure no other process are quickly eating up the memory.   A key to this is watching the Memory:_Total Working Set Performance Counter.   If you start an application that quickly uses memory all working sets can be trimmed quickly but the overall _Total remains steady.   If the _Total drops significantly it is a good indication that it is not a single application quickly eating up memory but something like MiEmptyWorkingSet or MmAllocateContigiousMemory has taken place and the operating system has decided to engage in a hard trim.   Our platforms support team can assist you in determining why the hard trim is being triggered.

2.       Make sure the SQL Server process ID remains constant across the problem time.   I found that if you stop the SQL Server service and restart it some of the SQL counters remain constant and can be misleading.

3.       Make sure your system has the latest drivers.   We have specifically encountered several drivers on X64 that trigger hard trim behavior.

4.       Make sure the OS Terminal Service bug is not causing the problem. http://support.microsoft.com/default.aspx?scid=kb;EN-US;905865 When an admin  TS’s into the server console, and later logs off, winlogon process might initiate trimming the processes running in Session 0.   The post Windows 2003 Sp1 hot fix resolves this issue.

On the server you can match this to a winstations, SECURITY, event log entry for the System – Event ID 682 – Example of one shown below.

Session reconnected to winstation:

User Name:           USERNAME

Domain:                 MYDOMAIN

Logon ID:               (0x0,0x12A8229)

Session Name:      RDP-Tcp#3

Client Name:         MYCLIENT

Client Address:     615.513.165.351

5.       Capture a full set of performance counters as well as the sys.dm_os_ring_buffers from SQL Server.   For example when an application on the computer starts using memory quickly the ring buffer entries clearly show the low physical memory indicator.   When a self or hard trim occurs the low physical memory indicator is not set or only set for a short period and when compared to the performance counters the behavior pattern is clarified.  The self and hard trim can require Microsoft Platforms support to help determine root cause.

6.       Apply the OS fix. http://support.microsoft.com/default.aspx?scid=kb;EN-US;920739 The dirty page threshold is set at half the amount of physical memory. This has caused severe problems on systems with large amount of memory, when applications that use Buffered I/O, leading to trimming, and large amount of data being flushed to disk when the threshold value is hit.  The registry key must be set as recommended by the article along with the hot fix.

7.       Apply the OS fix. http://support.microsoft.com/default.aspx?scid=kb;EN-US;931308 You may experience increased paging to the hard disk when you run a program on a Windows Server 2003-based computer

8.       Apply SQL Server 2005 SP2.  SP2 has a few changes allowing it to react to the ‘Low Physical memory’ faster as well as increased sys.dm_os_ring_buffer information.

Bob Dorr – SQL Server Senior Escalation Engineer