sql server 内存

Memory Manager metrics, the memory pressure can be indicated via the 内存管理器指标,可以通过Buffer Manager metrics, as the buffer is the component that uses most of the SQL Server memory 缓冲区管理器指标指示内存压力,因为缓冲区是使用大多数SQL Server内存的组件

There is a range of other memory metrics that are not as indicative, and therefore are not commonly used. In this article, we’ll present some of them

其他内存度量标准的范围也不是指示性的,因此并不常用。 在本文中,我们将介绍其中一些

分页文件使用率 (Paging File % Usage)

Paging File % Usage indicates the amount of the paging file used by the operating system

分页文件使用率百分比表示操作系统使用的分页文件的数量

Paging is a process that occurs on systems with insufficient. To provide enough memory for the running processes, it temporarily stores some of the memory pages into the paging file on disk. Next time a process needs this page, it will not be read from RAM, but from the page file on disk

分页是在系统不足的情况下发生的过程。 为了为正在运行的进程提供足够的内存,它将某些内存页面临时存储到磁盘上的页面文件中。 下次进程需要此页面时,将不会从RAM中读取它,而是从磁盘上的页面文件中读取它

When there’s no memory pressure on the system, every process has enough memory, pages are written into memory and flushed after the process is completed, freeing up the page for the forthcoming process

当系统没有内存压力时,每个进程都有足够的内存,页面将被写入内存并在进程完成后刷新,从而为即将到来的进程释放页面

A hard page fault is when the page is not in memory, but has to be loaded from a paging file on disk. This affects performance, as writing and reading a page from disk is several times slower than writing and reading from memory

硬页面错误是指该页面不在内存中,而必须从磁盘上的页面文件中加载。 这会影响性能,因为从磁盘写入和读取页面比从内存写入和读取要慢几倍

A soft page fault is when a page is still in memory, but on another address, or is being used by another program. Soft page faults don’t affect performance

软页面错误是指页面仍在内存中,但在另一个地址上,或正在被另一个程序使用。 软页面错误不会影响性能

A useful information related to the paging file usage is the size of the operating system paging file and how much paging file space is available. You can obtain this information from the dm_os_sys_memory view

与分页文件使用相关的有用信息是操作系统分页文件的大小以及可用的分页文件空间。 您可以从dm_os_sys_memory视图获取此信息。


SELECT total_page_file_kb, available_page_file_kb,
system_memory_state_desc
FROM sys.dm_os_sys_memory 

Frequent paging and using a large percentage of the paging file requires reducing system workload or adding more memory

频繁的分页和使用大量的分页文件需要减少系统工作量或增加内存

The threshold you should not reach depends on the size of the paging file, but shouldn’t be more than 70%. As a rule of thumb, you can set the paging file to be 50% of total RAM

您不应达到的阈值取决于页面文件的大小,但不应超过70%。 根据经验,您可以将页面文件设置为总RAM的50%

“100 percent usage of a page file does not indicate a performance problem as long as the system commit limit is not reached by the system commit charge, and if a significant amount of memory is not waiting to be written to a page file.”[1]

“只要系统提交费用未达到系统提交限制,并且没有大量内存等待写入页面文件,页面文件的100%使用率并不表示性能问题。 ” [1]

连接内存(KB) (Connection Memory (KB))

The Connection Memory (KB) metric “specifies the total amount of dynamic memory the server is using for maintaining connections” [2]

连接内存(KB)指标“指定服务器用于维护连接的动态内存总量” [2]

This is the amount of memory used for storing connection context as well as network send and receive buffers

这是用于存储连接上下文以及网络发送和接收缓冲区的内存量

As this is one of the Memory Manager counters, you can obtain its value using a query such as

由于这是内存管理器计数器之一,因此您可以使用查询来获取其值,例如


SELECT object_name, counter_name, cntr_value
FROM sys.dm_os_performance_counters
WHERE [counter_name] = 'Connection Memory (KB)'

This is where another metric comes in useful – User connections which shows the number of users currently connected to SQL Server

这是另一个有用的度量标准-用户连接,显示当前连接到SQL Server的用户数


SELECT object_name, counter_name, cntr_value
FROM sys.dm_os_performance_counters
WHERE [counter_name] = 'User Connections'

If the number of user connections is much higher than expected, the memory used per connection varies significantly, or these values are constantly increasing, the situation should be investigated and excessive connections killed. Besides being a performance issue, this can be an indication of a security problem

如果用户连接数比预期的高得多,每个连接使用的内存变化很大,或者这些值一直在增加,则应调查这种情况并终止过多的连接。 除了性能问题之外,这还可以指示安全问题。

检查点页面数/秒 (Checkpoint Pages/sec)

Checkpoint Pages/sec shows the number of pages that are moved from buffer to disk per second during a checkpoint process

Checkpoint页数/秒显示在检查点过程中每秒从缓冲区移动到磁盘的页面数

SQL Server tries to provide enough available space in the buffer in order to provide good performance. To free up the space in the buffer, the modified (dirty) pages are periodically moved (flushed) from the buffer to disk, and the page in the buffer is set for overwriting. This process occurs at checkpoints

SQL Server尝试在缓冲区中提供足够的可用空间以提供良好的性能。 为了释放缓冲区中的空间,已修改的(脏)页面会定期从缓冲区移至磁盘(磁盘),然后将缓冲区中的页面设置为覆盖。 此过程发生在检查点

This number of pages moved at a checkpoint is relative and depends on the hardware configuration and server usage. It’s recommended to create a baseline for this metric and compare the current values to it

在检查点移动的页面数量是相对的,并且取决于硬件配置和服务器使用情况。 建议为该指标创建一个基准并与之比较当前值

If more pages are flushed at each checkpoint, it might indicate an I/O problem. This is where besides automatic checkpoints, indirect checkpoints should be used, as they can be issued automatically to reduce the time between 2 automatic checkpoints and reduce the number of flushed dirty pages per second

如果在每个检查点刷新了更多页面,则可能表明I / O问题。 在这里,除了自动检查点之外,还应该使用间接检查点,因为它们可以自动发出以减少两个自动检查点之间的时间并减少每秒刷新的脏页数

服务器内存被盗(KB) (Stolen Server Memory (KB))

Stolen Server Memory (KB) shows the amount of memory used by SQL Server, but not for database pages. It is used for sorting or hashing operations, or “as a generic memory store for allocations to store internal data structures such as locks, transaction context, and connection information” [3]

被盗服务器内存(KB)显示SQL Server使用的内存量,但不显示数据库页面使用的内存量。 它用于排序或散列操作,或“用作分配用于存储内部数据结构(如锁,事务上下文和连接信息)的通用内存存储” [3]。

The Stolen Server Memory (KB) counter was introduced in SQL Server 2012. In earlier versions, there was the Stolen pages counter

SQL Server 2012中引入了被盗服务器内存(KB)计数器。在早期版本中,存在被盗页面计数器


SELECT object_name, counter_name, cntr_value
FROM sys.dm_os_performance_counters
WHERE [counter_name] = 'Stolen Server Memory (KB)'

There’s no specific threshold value, so it’s recommended to monitor this counter for a while and set a baseline. Note that the value should be close to the Batch Requests/sec value and low compared to the Total Server Memory counter. A high amount of stolen memory indicates memory pressure

没有特定的阈值,因此建议监视此计数器一段时间并设置基准。 请注意,该值应接近“批处理请求数/秒”值,并且与“ 总服务器内存”计数器相比较低。 大量的内存被盗表明内存压力

锁块,已分配锁块,锁内存(KB)和锁所有者块 (Lock Blocks, Lock Blocks Allocated, Lock Memory (KB), and Lock Owner Blocks)

A lock block is a locked source, such as a table, page, or row

锁定块是锁定的源,例如表,页面或行

Locking is a normal process on SQL Server. When a process uses a resource (e.g. page), the resource is locked. If another process tries to use the same resource, it will have to wait until the resource is released, which affects performance

锁定是SQL Server上的正常过程。 当进程使用资源(例如页面)时,该资源将被锁定。 如果另一个进程尝试使用相同的资源,则必须等待直到释放该资源,这会影响性能。

Locks occur when a process holds a resource longer than it should before releasing it, e.g. due to inefficient queries, or an error occurs so that the resource is not released automatically

当进程持有资源的时间长于释放资源之前的时间(例如,由于查询效率低下)或发生错误,因此不会自动释放资源时,就会发生锁定

Lock Blocks shows the number of lock blocks in use on the server (refreshed periodically). A lock block represents an individual locked resource, such as a table, page, or row

锁定块显示服务器上正在使用的锁定块的数量(定期刷新)。 锁定块代表单个锁定的资源,例如表,页面或行

Lock Blocks Allocated shows the number of lock blocks allocated to support locks. The more locks occur, the more will be allocated

分配的锁定块显示分配给支持锁定的锁定块的数量。 发生的锁越多,分配的锁就越多

Lock Memory (KB) shows the total amount of memory the server is using for locks

锁定内存(KB)显示服务器用于锁定的内存总量

Lock Owner Blocks shows the number of lock owner blocks currently in use on the server. A lock owner block is a thread that is the owner of a lock

锁拥有者块显示了服务器上当前正在使用的锁拥有者块的数量。 锁所有者块是作为锁所有者的线程


SELECT object_name, counter_name, cntr_value
FROM sys.dm_os_performance_counters
WHERE [counter_name] in ('Lock Blocks', 'Lock Blocks Allocated', 'Lock Memory (KB)', 'Lock Owner Blocks')

When SQL Server is set to use dynamic lock allocation, 2500 lock blocks and 5000 lock owner blocks will be initially allocated per node

当SQL Server设置为使用动态锁分配时,最初将为每个节点分配2500个锁块和5000个锁所有者块

The number of Lock Blocks should be lower than less than 1,000. If the value is higher, query tuning and optimization are the first steps to solve this issue

锁块的数量应少于1,000个。 如果该值较高,则查询调优和优化是解决此问题的第一步

The Lock Memory (KB) value should be lower than 24% of the available memory

锁定内存(KB)值应小于可用内存的24%

Besides these, the following metrics can help with SQL Server memory performance indication, but are of no great significance: Free Memory (KB), Optimizer Memory (KB), Reserved Server Memory (KB), SQL Cache Memory (KB), Page lookups/sec, and Readahead pages/sec [1]

除此之外,以下指标还可以帮助指示SQL Server内存性能,但意义不大:可用内存(KB),优化器内存(KB),预留服务器内存(KB),SQL高速缓存内存(KB),页面查找/秒和预读页面/秒[1]

翻译自: https://www.sqlshack.com/sql-server-memory-performance-metrics-part-6-memory-metrics/

sql server 内存

sql server 内存_SQL Server内存性能指标–第6部分–其他内存指标相关推荐

  1. sql server 内存_SQL Server内存性能指标–第1部分–内存页/秒和内存页故障/秒

    sql server 内存 SQL Server performance basics article, we explained why performance monitoring was imp ...

  2. sql server 内存_SQL Server内存性能指标–第5部分–了解惰性写入,空闲列表停顿/秒和待批内存授予

    sql server 内存 SQL Server performance metrics series with the SQL Server memory metrics that should b ...

  3. sql tempdb清理_SQL Server 2019内存优化的TempDB元数据

    sql tempdb清理 In this article, I will walk you through the new feature in SQL Server 2019, memory-opt ...

  4. sql tempdb清理_SQL Server 2019中的内存优化的TempDB元数据

    sql tempdb清理 介绍 (Introduction) In-memory technologies are one of the greatest ways to improve perfor ...

  5. sql server 性能_SQL Server硬件性能调整

    sql server 性能 SQL Server Performance Tuning can be a difficult assignment, especially when working w ...

  6. sql server 跟踪_SQL Server跟踪标志指南; 从-1到840

    sql server 跟踪 SQL Server trace flags are configuration handles that can be used to enable or disable ...

  7. sql tempdb清理_SQL Server TempDB数据库和闩锁争用

    sql tempdb清理 In this article, we will learn latch contention issues that we might experience in the ...

  8. sql数据透视_SQL Server中的数据科学:取消数据透视

    sql数据透视 In this article, in the series, we'll discuss understanding and preparing data by using SQL ...

  9. sql server 别名_SQL Server别名概述

    sql server 别名 This article gives an overview of SQL Server Alias and its usage for connecting with S ...

最新文章

  1. IndexedDB 索引数据库
  2. TypeError: new(): data must be a sequence (got float)
  3. php和python对比-PHP、Python和Javascript的装饰器模式对比
  4. DVSDK/EZSDK软件框架简介
  5. linux snap安装redis-desktop-manager
  6. ViewPager 中添加监听
  7. 腾讯测试王者荣耀网速的软件,腾讯游戏启用账号时长共享功能 开启人脸识别测试有效果吗?以《王者荣耀》为试点...
  8. 基于HTML模板和JSON数据的JavaScript交互
  9. 遥感原理与应用 【I】
  10. App测试查看日志(详细)
  11. 使用 Premiere 制作视频简介
  12. 《重构》笔记---坏代码的味道与处理
  13. 0130更新:完美wine QQ2011正式版(5074)
  14. 接入支付宝支付 错误码4000,排查方法——开发记录
  15. App进行内测麻烦吗?如何进行App内测?
  16. 小程序弹框wx.showModal、wx.showActionSheet、wx.showToast
  17. BDL程序搬迁环境应注意的问题
  18. Oracle 11g RAC 迁移至单机
  19. TypeScript下载安装
  20. 【CTF-misc】真是阳间题!

热门文章

  1. OpenLDAP 2.4.44 安装 + phpLDAPadmin 安装
  2. 常见的四种文本自动分词详解及IK Analyze的代码实现
  3. 20181213-python1119作业郭恩赐
  4. ubuntu HackRF One相关环境搭建
  5. 滚动页面一定距离后固定导航条
  6. 《面向对象程序设计》作业(四)
  7. 菜鸟的MySQL学习笔记(一)
  8. ios 键盘的一些问题
  9. 有没有用逆向算法恢复马赛克的可能性?
  10. 事业编,突然接到换岗通知,作为个人能怎么办?能拒绝换岗吗?拒绝的后果是什么?