Monday, February 6, 2017

SQL Server Memory Usage doesn't tally



EDIT Sorry forgot details, I'm running SQL Server 2008 R2 16GB of RAM



My min/max memory allocation is set to 13 GB. Running perfmon - SQL Server:Memory Manager. Target Server Memory and Total Server Memory confirms this. The ram counter in Task Manager is at 15 GB (assuming 2GB is used for other applications)



What I don't understand is why the process sqlservr.exe is only showing 82KB usage in task manager? Further to that, all of memory consumed by the processes running on my server from Task Manager doesn't add up to 15 GB either.



So what gives



Answer



115982 is a very similar question



Is this a 64bit server - do you have the lock pages in memory local policy enabled?




the most likely reason is that this SQL Server 64bit instance is using “locked pages” as I’ve described in an earlier question. Notice the name on the Task Manager column is called Memory (Private Working Set). Remember we also said that if SQL Server 64bit instances use “locked pages” this memory would not be part of the working set (because remember AWE APIs are used on 64bit to “lock” pages and that memory is not part of the working set). So since the locked pages are not part of the working set, they won’t appear in this column in Task Manager. On the Task Manager for Windows Server 2003, this column is called “Mem Usage” but it also reflects the working set of the process.




Here is an article that explains it in depth




You can also view the counters in SQL



SELECT
object_name
,Counter_name
,cntr_value
,ROUND(( cntr_value * 8192.0 ) / 1048576, 0) AS cntr_value_MB
FROM
sys.dm_os_performance_counters

WHERE
object_Name LIKE '%Buffer Manager%'
AND RTRIM(counter_name) IN ( 'Free pages', 'Total pages',
'Database pages' )
UNION SELECT
object_name
,Counter_name
,cntr_value
,ROUND(( cntr_value / 1024 ), 0) AS cntr_value_MB
FROM

sys.dm_os_performance_counters
WHERE
counter_name IN ( 'Target Server Memory (KB)',
'Total Server Memory (KB)' )

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...