I've been asked if one of our SQL Server instances has sufficient memory. This is a SQL Server 2008 R2 Standard Edition running on a x64 machine with 40 CPUs and 64 GB of RAM.
The total size of all the databases running under this instance is slightly more than 300 GB.
The instance has been configured with 4096 MB for the Minimum Server Memory and 24000 MB for the Maximum Server Memory.
So far, I've managed to gather the below information:
Physical memory in use:
SELECT physical_memory_in_use_kb,
process_physical_memory_low,
process_virtual_memory_low
FROM sys.dm_os_process_memory
physical_memory_in_use_kb process_physical_memory_low process_virtual_memory_low
------------------------- --------------------------- --------------------------
25657180 0 0
Performance Counters:
SELECT counter_name , cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name IN ('Total Server Memory (KB)',
'Target Server Memory (KB)', 'Granted Workspace Memory (KB)',
'Maximum Workspace Memory (KB)',
'Memory Grants Outstanding', 'Memory Grants Pending')
counter_name cntr_value
----------------------------------- --------------------
Granted Workspace Memory (KB) 1024
Maximum Workspace Memory (KB) 17714520
Memory Grants Outstanding 1
Memory Grants Pending 0
Target Server Memory (KB) 24576000
Total Server Memory (KB) 24576000
Buffer Pool:
select count(*) AS Buffered_Page_Count
,count_big(*) * 8192 / (1024 * 1024) as Buffer_Pool_MB
from sys.dm_os_buffer_descriptors
Buffered_Page_Count Buffer_Pool_MB
------------------- --------------------
2499693 19528
Buffer Pool Size Graph:
BPHR:
PLE:
Plan Cache Size:
Page Reads Per Second
Page Writes Per Second
My questions are:
What are the other things that I should be looking at?
If the above is sufficient, do I have to recommend adding more memory (maybe make it 50 GB) because PLE shows a degradation over time (while Total IO Wait Time shows going up)?
Target Server Memory is equal to the maximum memory set. Is it an indication that the instance can utilise more memory if it is configured with?
So, how do I know if my SQL Server needs more memory?
or maybe it doesn't
Best Answer
First few remarks
Why is your max memory only at
24000MB
when you have64GB
of phyisical memory? Are there other instances / services / ... running on it?If the answer to this is no, then you could set max memory to about
56GB = 57344 MB
.As a side note, sql server 2008 R2 is out of extended support. It would be best to be looking towards migrating to a newer version.
Which objects are consuming buffer pool memory
Since your PLE has always been pretty low and has gotten even lower over time, you could look into what exactly is using this BP memory at different points during the day.
First of all look into which databases consume the most:
Afterwards you can dig deeper on a database level to see which objects are in memory and how many pages these objects hold in memory.
If the more granular query reports less, you would have to remove
and bd.page_type in ('data_page', 'index_page')
to include LOB data pages.Next steps
You should put this information together with queries running on your system, you might be able to optimize certain queries / add indexes so less data is needed in memory.
If you want to go even further,
ROW / PAGE
compression could be looked at if you have the CPU power to do so.Compressed data remains compressed in memory.
Also note that if you are on sql server 2008 R2 standard edition, you could only go to
64GB
of max memory. Starting from sql server 2014 this goes up to128GB
of max memory. This is also another reason to migrate.Solely based on PLE, which is not the only factor to look at, I would say that your pages get flushed too frequently out of memory. Either optimize your queries or increase your memory.
Source
It has allocated all possible memory to the buffer pool as allowed by max memory, it will not go over this amount for buffer pool allocations.
Again, looking at what objects are in memory and if the queries responsible for it can be optimized would be a good start.
Additionally I would increase either max memory if you have the room to do so (if you in fact have 64GB of memory on the machine) or increase the memory on the machine.
Again remember that there is a limit of
64GB
of max memory for sql server 2008 R2 standard edition and that this is increased to128GB
starting from sql server 2014 standard edition.There is no limit on enterprise edition.