当前位置:网站首页>SQL server memory management on cloud
SQL server memory management on cloud
2022-06-24 06:12:00 【goslingwang】
Preface : as everyone knows ,cpu, Memory , Disk is one of the three core resources of a service , This chapter will introduce SQL Server Internal memory structure and memory management . Finally, the memory in Tencent cloud SQL Server Reactions in cloud database monitoring indicators , Help users understand SQL Server Cloud database features .
1. SQL Server Database and NUMA
NUMA( Inconsistent memory architecture ) To expand the performance of the motherboard . In more than one CPU Server , To avoid the shared memory bus becoming a bottleneck ,NUMA For each CPU Both have separate memory controllers .SQL Server Our infrastructure is based on NUMA The design of the . If you have known SQL Server Kernel task call part , Then you won't be right node,scheduler, Wait for the name to have a certain understanding . When SQL Server When the instance starts , Will be based on the detected NUMA Create the corresponding node node , Then according to the detected node The number of logical processors in the create the corresponding scheduler.
SELECT * FROM sys.dm_os_nodes;
see SQL Server After starting node Number of nodes .
SELECT * FROM sys.dm_os_scheduler;
see SQL Server After starting scheduler The number of , And the node The relationship between .
2. SQL Server Of memory
1. Memory nodes
Memory nodes are just as mentioned above , and NUMA Corresponding , One SQL Server The instance will have at least one memory node during startup . You can view the memory nodes with the following command .
select * from sys.dm_os_memory_nodes;
2. Memory allocator
All components require memory allocators to access memory nodes to allocate memory , Compare memory consuming components with dedicated memory allocators , You can use the following statement to view the memory member .
select type,memory_node_id,virtual_memory_reserved_kb,virtual_memory_committed_kb from sys.dm_os_memory_clerks order by virtual_memory_reserved_kb desc;
3. cache
A lot of useful data will be cached in memory , For example, execute plan caching , Data caching , stored procedure , View caching, etc . The largest one is the buffer pool , This is where the user data is cached . Use the following SQL You can query the size of the buffer pool used by each database .
select COUNT(*)*8/1024 AS 'Catch Size (MB)',case database_id when 32767 then 'resourceDB' else db_name(database_id) end as 'Dtatbases' from sys.dm_os_buffer_descriptors group by DB_NAME(database_id),database_id order by 'Catch Size (MB)' desc;
3. How to determine SQL Server The cloud instance is out of memory .
Usually :
select counter_name, ltrim(cntr_value*1.0/1024.0) as MB from master.sys.dm_os_performance_counters where counter_name like '%total_server_memory%'
View the actual total size of the current buffer pool .
select counter_name, ltrim(cntr_value*1.0/1024.0) as MB from master.sys.dm_os_performance_counters where counter_name like '%target_server_memory%'
View the desired size of the current buffer pool . It is generally considered that the ideal buffer pool size is consistent with the actual buffer pool size . In case of inconsistency, there are two situations ,1. The pressure of the business is not enough because the data is not cached .2. Not enough physical memory , You can no longer put user data in the buffer pool .
You can also use the following SQL Check in sqlserver How long a page is expected to remain in the buffer pool , The unit is seconds
select counter_name, cntr_value as s from master.sys.dm_os_performance_counters where counter_name like '%page_life_expectancy%'
When memory is tight , Pages in the buffer pool will be swapped out of memory , So the retention time will be shorter . If you keep time in hell 300 Second, you need to pay attention to the memory condition .
SQL Server Cloud instances provide rich monitoring indicators , for example :“ Buffer cache hit rate ”,“ Execution plan cache hit rate ”,“ Memory footprint ”,“ Maximum memory ”. From these indicators, we can judge whether the instance memory is insufficient .
The console provides “ Memory footprint ” The corresponding is Total Server Memory (KB) indicators .
The console provides “ Maximum memory ” The corresponding is Target Server Memory (KB) indicators .
The console provides “ Buffer hit rate ” The corresponding is Buffer cache hit ratio indicators .
The console provides “ Execution plan cache hit rate ” The corresponding is Cache Hit Ratio indicators .
“ Memory footprint “ This indicator , After the instance is started, it runs for a period of time , It will be basically consistent with the maximum memory of the instance purchased on the cloud , Don't worry too much . You can focus on “ Buffer hit rate ” indicators , If the hit rate continues to be lower than 90%, Consider whether you need to increase memory .
边栏推荐
- What is the difference between a white box test and a black box test
- Discussion on NFT Technology
- 5 minutes, online from 0 to 1!
- Confirm the importance of requirements at the initial stage of EDI project
- 10 year old drivers who have been engaged in software testing tell you what type of software is suitable for automation
- Ups and esxi realize automatic shutdown after power failure
- What are the common network protocols
- Neighbor vote: use proximity voting to optimize monocular 3D target detection (ACM mm2021)
- EEG microstate as a continuous phenomenon
- Why migrate dig to wire
猜你喜欢

ServiceStack. Source code analysis of redis (connection and connection pool)

One line of keyboard

Solution to the 39th weekly game of acwing
![[fault announcement] one stored procedure brings down the entire database](/img/7c/e5adda73a077fe4b8f04b59d1e0e1e.jpg)
[fault announcement] one stored procedure brings down the entire database

Technology is a double-edged sword, which needs to be well kept

A cigarette of time to talk with you about how novices transform from functional testing to advanced automated testing

What is the difference between a white box test and a black box test
随机推荐
Smart Logistics: with the advent of aiot era, how to get through the "last mile" of logistics?
Correct way to update Fedora image Yum source to Tencent cloud Yum source
Little transparent apprentice's way to go ashore
Summary of basic notes of C language (III)
Groovy script engine practice in complex and changeable scenarios
Understand the classification and summary of cross chain related technologies
Network Overview
PMP | 8 abilities that excellent project managers focus on training
Easycvr is cascaded to easygbs through gb28181 protocol. Notes on video channel failure
Experience sharing on unified management and construction of virtual machine
Excel data extraction technique: a universal formula for extracting numbers from mixed text
Micro build low code supports Excel to import data source
How to file a personal domain name? What are the benefits of domain name filing?
Sub process call - process arrangement in complex O & M scenarios
Semantic web, semantic web, linked data and knowledge map
How to do reverse domain name resolution? What does reverse domain name resolution mean?
How do individuals register domain names? What are the precautions for individual domain name registration?
Oceanus practice - develop MySQL CDC to es SQL jobs from 0 to 1
The joint network security laboratory of runlian technology and Tencent security was officially unveiled
Material production tool manual