Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SQL Server Memory Pressure

1,055 views

Published on

SQL Server Internal and External Memory Pressure within the Plan Cache Stores.

Published in: Technology
  • Be the first to comment

SQL Server Memory Pressure

  1. 1. SQL SERVER MEMORY PRESSURE By Hamid J. Fard Microsoft Certified Master: SQL Server 2008 Microsoft Certified Solutions Master: Charter-Data Platform CIW Database Design Specialist Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.
  2. 2. Agenda • SQL Server Internal Architecture (Overview) • SQL Server Plan Cache Internals • SQL Server Plan Cache Size Management • SQL Server Local Memory Pressure • SQL Server Global Memory Pressure • SQL Server Plan Cache Entries Cost Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.
  3. 3. SQL Server InternalArchitecture (Overview) Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved. Plan Cache Buffer Pool Available Memory D Protocol Layer Relational Engine (OLEDB) Storage Engine Data File SNI Query Executor Command Parser Optimizer Buffer Manager Access Methods TDS Language EventQuery Tree Query Plan TDS Log File Transaction Manager Client
  4. 4. SQL Server Plan Cache Internals Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved. Plan Cache Buffer Pool Available Memory CACHESTORE_OBJCP CACHESTORE_SQLCP CACHESTORE_PHDR CACHESTORE_XPPROC CACHESTORE_* Execution ContextExecution Plans SQL MGR Plan Cache Metadata DMVs / DMFs sys.dm_exec_sql_text sys.dm_exec_cached_plans sys.dm_exec_cached_plan_dependent_objects sys.dm_exec_requests sys.dm_exec_query_stats
  5. 5. SQL Server Plan Cache Size Management Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved. SQL Server 2005 RTM and SQL Server 2005 SP1 75% of visible target memory from 0 – 8 GB + 50% of visible target memory from 8 – 64GB + 25% of visible target memory > 64GB SQL Server 2005 SP2 and SQL Server 2008 75% of visible target memory from 0-4GB + 10% of visible target memory from 4Gb-64GB + 5% of visible target memory > 64GB SQL Server 2012 and SQL Server 2014 75% of visible target memory from 0-4GB + 10% of visible target memory from 4Gb-64GB + 5% of visible target memory > 64GB
  6. 6. CACHESTORE_SQLCP 40% Full Normal Memory Pressure 75% Full Local Memory Pressure Occurred SQL Server Local Memory Pressure Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved. Adhoc Query Plan The queries below can be used to determine the number of buckets in the hash tables for the object store and the SQL store, and the number of entries in each of those stores. SELECT type as 'plan cache store', buckets_count FROM sys.dm_os_memory_cache_hash_tables WHERE type IN ('CACHESTORE_OBJCP', 'CACHESTORE_SQLCP'); SELECT type, count(*) total_entries FROM sys.dm_os_memory_cache_entries WHERE type IN ('CACHESTORE_SQLCP', 'CACHESTORE_OBJCP') GROUP BY type;
  7. 7. SQL Server Global Memory Pressure Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved. External Internal When the operating system determines that the SQL Server process needs to reduce its physical memory consumption because of competing needs from other processes on the server. When the memory broker predicts that all cache stores combined will use more than 80 percent of the cache plan pressure limit.
  8. 8. Plan Cache Store (SQLCP) Plan A 1 SQL Server Plan Cache Entries Cost Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved. Use Plan Plan A 2 Plan Cache Store (OBJCP) Plan A IO: 5 Context Switch: 6 Memory: 12 Cost: 5+6+12 = 23 Create Plan
  9. 9. Conclusion • Local Memory Pressure Can IncreaseThe RespondTime Of Query Execution. • Global Memory Pressure Can ReduceThe Overall System Performance And IncreasesThe I/O Operations. • Both Local And Global Memory Pressure Can IncreaseThe Processor Usage. • Plan Cache Stores Are Out Of Buffer Pool Sections, Configure SQL Server Memory To Provide Enough Space For Plan Caches. Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved.
  10. 10. Contact for ExpertAdvice Copyrights © 2016 Fard Solutions Sdn Bhd, All rights reserved. Fard Solutions Sdn Bhd 1-1C, Incubator 1,Technology Park Malaysia, Bukit Jalil, 57000 Kuala Lumpur, Malaysia. Tel: +603-89946788 - +603-79725433 Web: www.Fard-Solutions.com Email: Enquiry@Fard-Solutions.com Contact Us For 30 Minutes Free Consultation.

×