SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


What is using the RAM?


What is using the RAM?

Author
Message
shahgols
shahgols
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4998 Visits: 6102
Hi everyone, I've been investigating RAM bottleneck on one of my servers, and it looks like the buffer pool is only using 23GB out of 51GB for buffer pool, but I am unable to find out what is using the remaining 28GB of RAM. I've run some queries and am attaching the results for your consideration. This server has SQL 2012 Enterprise (SP3) on Windows 2012 Standard. Thanks in advance!



Attachments
2017-12-19_15-28-32.png (28 views, 86.00 KB)
Sue_H
Sue_H
SSC-Dedicated
SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)

Group: General Forum Members
Points: 33472 Visits: 9539
shahgols - Tuesday, December 19, 2017 2:51 PM
Hi everyone, I've been investigating RAM bottleneck on one of my servers, and it looks like the buffer pool is only using 23GB out of 51GB for buffer pool, but I am unable to find out what is using the remaining 28GB of RAM. I've run some queries and am attaching the results for your consideration. This server has SQL 2012 Enterprise (SP3) on Windows 2012 Standard. Thanks in advance!


When you query sys.dm_os_memory_clerks, look at the other memory clerk types - the ones that are not MEMORYCLERK_SQLBUFFERPOOL.
I don't know of a list of all of the different types - usually just search on the types.
You can find some additional queries for troubleshooting memory issues in this post:
Troubleshooting SQL Server Memory

Sue



subramaniam.chandrasekar
subramaniam.chandrasekar
SSChasing Mays
SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)

Group: General Forum Members
Points: 606 Visits: 235
shahgols - Tuesday, December 19, 2017 2:51 PM
Hi everyone, I've been investigating RAM bottleneck on one of my servers, and it looks like the buffer pool is only using 23GB out of 51GB for buffer pool, but I am unable to find out what is using the remaining 28GB of RAM. I've run some queries and am attaching the results for your consideration. This server has SQL 2012 Enterprise (SP3) on Windows 2012 Standard. Thanks in advance!

Hi,
Okay, Can you try these DMVs against your database / data warehouse ?
sys.dm_exec_connections
sys.dm_exec_sessions
sys.dm_exec_requests
sys.dm_exec_sql_text
sys.sysprocesses
OR you can even use SP_WHO, SP_WHO2
these could give an idea where are the bottlenecks in your database / against your RAM.
If the all above does not resolve the issues, You can check for the existing blockings in RAM and try to clean the procache.

shahgols
shahgols
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4998 Visits: 6102
Hi Sue, I have done a SUM on pages_kb in dm_os_memory_clerks, which adds up the space taken by all clerk types. The total is 22GB. SQL Server is using 51GB, and PLE is 51, so that's why I am wondering where the rest of the RAM has gone.

Hi Subramanian, do you have any scripts, there is a lot of information in those tables and I am not sure what I am looking for.



Sue_H
Sue_H
SSC-Dedicated
SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)

Group: General Forum Members
Points: 33472 Visits: 9539
shahgols - Thursday, December 21, 2017 8:59 AM
Hi Sue, I have done a SUM on pages_kb in dm_os_memory_clerks, which adds up the space taken by all clerk types. The total is 22GB. SQL Server is using 51GB, and PLE is 51, so that's why I am wondering where the rest of the RAM has gone.

Hi Subramanian, do you have any scripts, there is a lot of information in those tables and I am not sure what I am looking for.


There are over 20 different queries in the link I provided that will walk you through your memory usage - it would likely be good to read the article and work through the scripts. They are all memory specific - the link is:
Troubleshooting SQL Server Memory

In addition to the memory clerks, his advise is to also use the following - refer to the article for more information:
select * from sys.dm_os_memory_objects
select * from sys.dm_os_memory_pools
select * from sys.dm_os_memory_nodes
select * from sys.dm_os_memory_cache_entries
select * from sys.dm_os_memory_cache_hash_tables

Sue



subramaniam.chandrasekar
subramaniam.chandrasekar
SSChasing Mays
SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)SSChasing Mays (606 reputation)

Group: General Forum Members
Points: 606 Visits: 235
shahgols - Thursday, December 21, 2017 8:59 AM
Hi Sue, I have done a SUM on pages_kb in dm_os_memory_clerks, which adds up the space taken by all clerk types. The total is 22GB. SQL Server is using 51GB, and PLE is 51, so that's why I am wondering where the rest of the RAM has gone.

Hi Subramanian, do you have any scripts, there is a lot of information in those tables and I am not sure what I am looking for.

Please use this query against db or data warehouse ,

select r.session_id,
r.cpu_time,
p.physical_io,
p.physical_io,
t.text,
substring(t.text, r.statement_start_offset/2 + 1, case when r.statement_end_offset = -1 then len(t.text) else (r.statement_end_offset - r.statement_start_offset)/2 end) as text_running,
p.blocked,
db_name(p.dbid) as dbname,
r.status,
r.command,
r.start_time,
r.wait_type,
p.waitresource,
p.status,
p.open_tran,
p.loginame,
p.hostname,
p.program_name,
r.percent_complete,
r.wait_type,
r.last_wait_type,
p.waittime
from sys.dm_exec_requests r
cross apply sys.dm_exec_sql_text(r.sql_handle) t
inner join sys.sysprocesses p on p.spid = r.session_id
where
r.wait_type IN ('PAGEIOLATCH_SH' , 'PAGEIOLATCH_EX')
ORDER BY start_time ASC

shahgols
shahgols
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4998 Visits: 6102
Hi Sue, thanks for the response. I had actually been to that very page and been through all the scripts. I am still unable to find an answer.



Eric M Russell
Eric M Russell
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: General Forum Members
Points: 62692 Visits: 12784
I assuming here that you're talking about the 'page buffer cache'. This cache contains recently read pages,which are periodically cycled out using an algorithm based on frequency of usage. The cache pages aren't tied the query or process that read them, but each page can be identified by object type and object name.

The following query will provide detailed information about page buffer cache allocation.


-- Object level allocation for each database:
IF OBJECT_ID('tempdb..#BufferCacheAllocation') IS NOT NULL
DROP TABLE #BufferCacheAllocation;
GO
CREATE TABLE #BufferCacheAllocation
(
Database_Name VARCHAR(200) NOT NULL,
Object_Name VARCHAR(200) NULL,
Page_Type VARCHAR(30) NULL,
Index_Name VARCHAR(200) NULL,
Index_Type VARCHAR(30) NULL,
Data_Compression_Desc VARCHAR(20) NULL,
Row_Count BIGINT NULL,
BufferAllocated_MB BIGINT NULL,
BufferWaste_MB BIGINT NULL
);
exec sp_MsForEachDB
'
USE ?;
INSERT INTO #BufferCacheAllocation
(
Database_Name,
Object_Name,
Page_Type,
Index_Name,
Index_Type,
Data_Compression_Desc,
Row_Count,
BufferAllocated_MB,
BufferWaste_MB
)
SELECT
db_name(database_id) Database_Name,
obj.[name] Object_Name,
bd.page_type as Page_Type,
i.[name] Index_Name,
i.[type_desc] Index_Type,
obj.Data_Compression_Desc,
sum(row_count) as Row_Count,
(count_big(*) * 8192) / (1024 * 1024) as BufferAllocated_MB,
sum(free_space_in_bytes) / (1024 * 1024) as BufferWaste_MB
FROM sys.dm_os_buffer_descriptors AS bd
LEFT JOIN
(
SELECT object_name(object_id) AS name
,index_id ,allocation_unit_id
, object_id
, data_compression_desc
FROM sys.allocation_units AS au
INNER JOIN sys.partitions AS p
ON au.container_id = p.hobt_id
AND (au.type = 1 OR au.type = 3)
UNION ALL
SELECT object_name(object_id) AS name
,index_id ,allocation_unit_id
, object_id
, data_compression_desc
FROM sys.allocation_units AS au
INNER JOIN sys.partitions AS p
ON au.container_id = p.hobt_id
AND au.type = 2
) AS obj
ON bd.allocation_unit_id = obj.allocation_unit_id
LEFT JOIN sys.indexes i on i.object_id = obj.object_id AND i.index_id = obj.index_id
WHERE database_id = db_id()
GROUP BY database_id, obj.name, obj.index_id , i.[name], i.[type_desc], obj.Data_Compression_Desc, bd.page_type;
';

SELECT SUM(BufferAllocated_MB) AS BufferAllocated_MB, SUM(BufferWaste_MB) AS BufferWaste_MB
FROM #BufferCacheAllocation;

SELECT Database_Name, SUM(BufferAllocated_MB) AS BufferAllocated_MB, SUM(BufferWaste_MB) AS BufferWaste_MB
FROM #BufferCacheAllocation
GROUP BY Database_Name
ORDER BY SUM(BufferAllocated_MB) DESC;

SELECT Page_Type, Index_Type, Data_Compression_Desc
, SUM(BufferAllocated_MB) AS Allocated_MB, SUM(BufferWaste_MB) AS BufferWaste_MB
FROM #BufferCacheAllocation
GROUP BY Page_Type, Index_Type, Data_Compression_Desc
ORDER BY SUM(BufferAllocated_MB) DESC;

SELECT * FROM #BufferCacheAllocation ORDER BY BufferAllocated_MB DESC;



"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."
Ed Wagner
Ed Wagner
SSC Guru
SSC Guru (157K reputation)SSC Guru (157K reputation)SSC Guru (157K reputation)SSC Guru (157K reputation)SSC Guru (157K reputation)SSC Guru (157K reputation)SSC Guru (157K reputation)SSC Guru (157K reputation)

Group: General Forum Members
Points: 157739 Visits: 11663
Have you considered the space consumed by the plan cache?


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
shahgols
shahgols
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4998 Visits: 6102
Hi Eric, I am referring to the buffer pool, where data/index pages are kept. I ran your query and have attached the result. As you can see, only a portion of the 51GB RAM is being used, even though SQL Server says that it is using 51GB. The PLE is at 160, so there is quite bit of RAM contention. I have attached the output of your query for your review.

Hi Ed, yes, I have a query that shows the breakdown of all memory by type, and the plan cache uses 4-5GB. Total usage by all types is not even close to 51GB, there is usually a 20-30GB gap.



Attachments
2017-12-22_9-36-55.png (11 views, 17.00 KB)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search