Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Understanding Memory Clerks Expand / Collapse
Author
Message
Posted Wednesday, November 7, 2012 4:20 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 2:08 AM
Points: 1,380, Visits: 2,703
Hello All

When investigating memory using sys.dm_os_memory_clerks, why is it that CACHESTORE_SQLCP is always among the top consumers?

I would imagine that the bulk of SQL's buffer pool gets allocated to the area where data/index pages are brought in from disk for queries.

In any average SQL Server, shouldn't MEMORYCLERK_SQLBUFFERPOOL be on top of the list?

Am I on track here or is my understanding wrong?

Thanks
Post #1381901
Posted Wednesday, November 7, 2012 10:37 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, August 21, 2014 9:06 AM
Points: 163, Visits: 367
CACHESTORE_SQLCP
These are cached SQL statements or batches that aren't in stored procedures, functions and triggers. This includes any dynamic SQL or raw SELECT statements sent to the server

Post #1382082
Posted Wednesday, November 7, 2012 10:56 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 2:08 AM
Points: 1,380, Visits: 2,703
kylesway (11/7/2012)
CACHESTORE_SQLCP
These are cached SQL statements or batches that aren't in stored procedures, functions and triggers. This includes any dynamic SQL or raw SELECT statements sent to the server



What I'm trying to figure out is why it's on the top of the list? Which cache counter type would represent my buffer pool?

Thanks
Post #1382092
Posted Wednesday, November 7, 2012 11:11 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Tuesday, November 19, 2013 8:15 AM
Points: 652, Visits: 1,428
SQLSACT (11/7/2012)
kylesway (11/7/2012)
CACHESTORE_SQLCP
These are cached SQL statements or batches that aren't in stored procedures, functions and triggers. This includes any dynamic SQL or raw SELECT statements sent to the server



What I'm trying to figure out is why it's on the top of the list? Which cache counter type would represent my buffer pool?

Thanks


You've posted this in the SQL Server 2008 forum, but please confirm that you're running SQL Server 2008. I recall that there were some issues in SQL 2005 where ad hoc querys could bloat the plan cache leading to this type of behavior.
Post #1382096
Posted Wednesday, November 7, 2012 11:34 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 2:08 AM
Points: 1,380, Visits: 2,703
George M Parker (11/7/2012)
SQLSACT (11/7/2012)
kylesway (11/7/2012)
CACHESTORE_SQLCP
These are cached SQL statements or batches that aren't in stored procedures, functions and triggers. This includes any dynamic SQL or raw SELECT statements sent to the server



What I'm trying to figure out is why it's on the top of the list? Which cache counter type would represent my buffer pool?

Thanks


You've posted this in the SQL Server 2008 forum, but please confirm that you're running SQL Server 2008. I recall that there were some issues in SQL 2005 where ad hoc querys could bloat the plan cache leading to this type of behavior.


2008 Sp3

Is there a script that would give me the amount of memory allocated to SQL Server, show me how the memory is allocated between the different areas of memory (Plan Cache, Buffer Pool) etc.

Thanks
Post #1382105
Posted Wednesday, November 7, 2012 11:45 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Tuesday, November 19, 2013 8:15 AM
Points: 652, Visits: 1,428
Check out the following: http://www.sqlservercentral.com/Forums/Topic1340744-391-1.aspx

If you order by Virtual_memory_committed_kb, you should see MEMORYCLERK_SQLBUFFERPOOL as the largest consumer of memory.

select * FROM sys.dm_os_memory_clerks
order by Virtual_memory_committed_kb desc

I'm still trying to find a definitive reference that adequately defines sys.dm_os_memory_clerks and what all of the columns mean.
Post #1382110
Posted Wednesday, November 7, 2012 12:10 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 2:08 AM
Points: 1,380, Visits: 2,703
George M Parker (11/7/2012)
Check out the following: http://www.sqlservercentral.com/Forums/Topic1340744-391-1.aspx

If you order by Virtual_memory_committed_kb, you should see MEMORYCLERK_SQLBUFFERPOOL as the largest consumer of memory.

select * FROM sys.dm_os_memory_clerks
order by Virtual_memory_committed_kb desc

I'm still trying to find a definitive reference that adequately defines sys.dm_os_memory_clerks and what all of the columns mean.


Thanks for this

Do you know of a way to check if my an instance is experiecing a plan cache bloat? What I mean is, how can I check what the allocated size of my plan cache is and how much of it has been used.

Thanks
Post #1382119
Posted Wednesday, November 7, 2012 12:14 PM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Tuesday, November 19, 2013 8:15 AM
Points: 652, Visits: 1,428

Thanks for this

Do you know of a way to check if my an instance is experiecing a plan cache bloat? What I mean is, how can I check what the allocated size of my plan cache is and how much of it has been used.

Thanks


Check out the following blog by Kimberly Tripp: http://www.sqlskills.com/blogs/kimberly/post/procedure-cache-and-optimizing-for-adhoc-workloads.aspx.

SELECT objtype AS [CacheType]
, count_big(*) AS [Total Plans]
, sum(cast(size_in_bytes as decimal(18,2)))/1024/1024 AS [Total MBs]
, avg(usecounts) AS [Avg Use Count]
, sum(cast((CASE WHEN usecounts = 1 THEN size_in_bytes ELSE 0 END) as decimal(18,2)))/1024/1024 AS [Total MBs - USE Count 1]
, sum(CASE WHEN usecounts = 1 THEN 1 ELSE 0 END) AS [Total Plans - USE Count 1]
FROM sys.dm_exec_cached_plans
GROUP BY objtype
ORDER BY [Total MBs - USE Count 1] DESC
go


Post #1382124
Posted Wednesday, November 7, 2012 12:17 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 2:08 AM
Points: 1,380, Visits: 2,703
George M Parker (11/7/2012)

Thanks for this

Do you know of a way to check if my an instance is experiecing a plan cache bloat? What I mean is, how can I check what the allocated size of my plan cache is and how much of it has been used.

Thanks


Check out the following blog by Kimberly Tripp: http://www.sqlskills.com/blogs/kimberly/post/procedure-cache-and-optimizing-for-adhoc-workloads.aspx.

SELECT objtype AS [CacheType]
, count_big(*) AS [Total Plans]
, sum(cast(size_in_bytes as decimal(18,2)))/1024/1024 AS [Total MBs]
, avg(usecounts) AS [Avg Use Count]
, sum(cast((CASE WHEN usecounts = 1 THEN size_in_bytes ELSE 0 END) as decimal(18,2)))/1024/1024 AS [Total MBs - USE Count 1]
, sum(CASE WHEN usecounts = 1 THEN 1 ELSE 0 END) AS [Total Plans - USE Count 1]
FROM sys.dm_exec_cached_plans
GROUP BY objtype
ORDER BY [Total MBs - USE Count 1] DESC
go




Thanks

I've used that script before.

I'm trying to find a way to get the total MB's SQL has allocated to the plan cache and how much of it has been used up already

Thanks
Post #1382125
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse