SQL Server 如何确定内存瓶颈

本文涉及的产品
云数据库 RDS SQL Server,独享型 2核4GB
简介: Detect Memory Bottleneck in SQL Server By : Kasim Wirama, MCDBA   This article, I would like to give information about memory bottleneck at SQL Server.

Detect Memory Bottleneck in SQL Server

By : Kasim Wirama, MCDBA

 

This article, I would like to give information about memory bottleneck at SQL Server. The easiest way to know whether your SQL Server undergoes memory bottleneck is by looking at Task Manager, tab Performance, Physical Memory section. Compare the Total and Available value, as long as Available is over 100 MB, it is still okay. If Available value is under 10 MB, your database server box is definitely under physical memory pressure. Besides physical memory pressure, there is virtual memory pressure. Let’s take a look for these kinds of pressure and see what solutions addressed to the corresponding problems.

 

You can get information about physical memory pressure by looking at these performance monitor counters: Memory:Available bytes, SQL Server:Buffer Manager: Buffer Cache Hit Ratio, Page Life Expectancy, Checkpoint Pages/sec, and Lazywrites/sec. You have your system performing well if value of first two counters are high and last two counters are low.

 

You can check how many memories allocated for buffer pool by issuing DBCC MEMORYSTATUS query in SSMS. Compare value between Committed and Target, if Target value is low, it indicates external physical memory pressure. You need to find out whether other application that causes external memory pressure, besides SQL Server, by looking at maximum memory consumed in Process tab of Task Manager window. If other application causes external memory pressure, it is advisable that the application is separated from database server box, or you add more memory. You need to check internal memory pressure by looking at percentage of stolen page to total committed page from DBCC MEMORYSTATUS. Percentage value is greater than 75% or 80% indicating internal physical memory pressure.  Interesting thing about internal memory pressure is that you need to find out what components causing so many stolen memory page by querying this DMV below :

 

SELECT type, SUM(single_pages_kb) FROM sys.dm_os_memory_clerks
GROUP BY type
ORDER BY SUM(single_pages_kb) DESC

 

From query above, single page allocation takes memory from SQL Server buffer pool, whereas multipage allocation allocates memory outside buffer pool. Multipage allocator possibly causes internal memory pressure. You can get information about memory allocated to multipage page allocation by querying DMV below :

 

SELECT type, SUM(multi_pages_kb) FROM sys.dm_os_memory_clerks
WHERE multi_pages_kb != 0
GROUP BY type
ORDER BY SUM(multi_pages_kb) DESC

 

To detect virtual memory pressure, you can look at performance counter name here : Paging File: %Usage and Memory:Commit Limit.

Some solutions addressed to virtual memory pressure. They are:

  1. 1.       Increase size of page file
  2. 2.       Use /3GB options
  3. 3.       Switch to 64 bit machine that have 8 TB memory address space.
相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情: https://www.aliyun.com/product/rds/sqlserver
目录
相关文章
|
6天前
|
SQL 人工智能 算法
【SQL server】玩转SQL server数据库:第二章 关系数据库
【SQL server】玩转SQL server数据库:第二章 关系数据库
42 10
|
1月前
|
SQL 数据库 数据安全/隐私保护
Sql Server数据库Sa密码如何修改
Sql Server数据库Sa密码如何修改
|
2月前
|
SQL 算法 数据库
【数据库SQL server】关系数据库标准语言SQL之数据查询
【数据库SQL server】关系数据库标准语言SQL之数据查询
95 0
|
2月前
|
SQL 算法 数据库
【数据库SQL server】关系数据库标准语言SQL之视图
【数据库SQL server】关系数据库标准语言SQL之视图
73 0
|
2月前
|
SQL 人工智能 算法
【数据库SQL server】传统运算符与专门运算符
【数据库SQL server】传统运算符与专门运算符
68 0
|
16天前
|
SQL
启动mysq异常The server quit without updating PID file [FAILED]sql/data/***.pi根本解决方案
启动mysq异常The server quit without updating PID file [FAILED]sql/data/***.pi根本解决方案
15 0
|
6天前
|
SQL 算法 数据库
【SQL server】玩转SQL server数据库:第三章 关系数据库标准语言SQL(二)数据查询
【SQL server】玩转SQL server数据库:第三章 关系数据库标准语言SQL(二)数据查询
60 6
|
6天前
|
SQL 存储 数据挖掘
数据库数据恢复—RAID5上层Sql Server数据库数据恢复案例
服务器数据恢复环境: 一台安装windows server操作系统的服务器。一组由8块硬盘组建的RAID5,划分LUN供这台服务器使用。 在windows服务器内装有SqlServer数据库。存储空间LUN划分了两个逻辑分区。 服务器故障&初检: 由于未知原因,Sql Server数据库文件丢失,丢失数据涉及到3个库,表的数量有3000左右。数据库文件丢失原因还没有查清楚,也不能确定数据存储位置。 数据库文件丢失后服务器仍处于开机状态,所幸没有大量数据写入。 将raid5中所有磁盘编号后取出,经过硬件工程师检测,没有发现明显的硬件故障。以只读方式将所有磁盘进行扇区级的全盘镜像,镜像完成后将所
数据库数据恢复—RAID5上层Sql Server数据库数据恢复案例
|
10天前
|
SQL 安全 Java
SQL server 2017安装教程
SQL server 2017安装教程
14 1
|
24天前
|
SQL 存储 Python
Microsoft SQL Server 编写汉字转拼音函数
Microsoft SQL Server 编写汉字转拼音函数