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

sql server 内存

SQL Server performance basics article, we explained why performance monitoring was important and what you should consider before you start monitoring SQL Server performance SQL Server性能基础文章,我们解释了为什么性能监视如此重要以及在开始监视SQL Server性能之前应考虑的事项

Different environments and applications require different metrics to be measured. The first task is to determine what parameters to track. The second task is to find out what values indicate normal and bad performance, and what the baselines are

不同的环境和应用程序需要测量不同的指标。 第一项任务是确定要跟踪的参数。 第二项任务是找出哪些值指示正常和不良性能,以及哪些基准是

Once you determine your performance goals, selecting the metrics and baseline values is easier. For most performance goals, monitoring memory, CPU usage, disk activity, and network traffic is common

确定绩效目标后,选择指标和基准值就变得容易了。 对于大多数性能目标,通常监视内存,CPU使用率,磁盘活动和网络流量

A general recommendation for smooth SQL Server running is to have a dedicated server for it. Having other applications on the same machine will make SQL Server compete with other applications for memory, processor, and disk resources, and thus downgrade SQL Server performance

为了使SQL Server顺利运行,通常的建议是使用专用的服务器。 在同一台计算机上拥有其他应用程序将使SQL Server与其他应用程序竞争内存,处理器和磁盘资源,从而降低SQL Server性能

SQL Server内存指标 (SQL Server memory metrics)

Memory metrics indicate server health

内存指标指示服务器运行状况

The operating system provides a number of performance counters that are associated with memory. The most important are: Pages/sec, Page Faults/sec, Pages Input/sec, Pages Output/sec, Page Reads/sec, Page Writes/sec, Available Memory, Non-pageable memory pool bytes, Pageable memory pool bytes, and Committed Bytes [1]

操作系统提供了许多与内存关联的性能计数器。 最重要的是: 页/秒,页错误/秒,页输入/秒,页输出/秒,页读取/秒,页写入/秒,可用内存,不可分页的内存池字节,可分页的内存池字节和提交的字节数 [1]

Adding memory can solve some of the performance issues caused by insufficient memory. If some parameters are not properly configured and performance issues properly diagnosed, additional memory will not improve SQL Server performance and you’ll be back to square one

添加内存可以解决由于内存不足而导致的某些性能问题。 如果某些参数配置不正确并且性能问题得到正确诊断,那么额外的内存将无法提高SQL Server的性能,您将回到第一位。

页数/秒 (Pages/sec)

Pages/sec is one of the most important memory metrics. It’s recommended to monitor it whatever performance goals are

页数/秒是最重要的内存指标之一。 无论性能目标是什么,建议对其进行监视

The pages/sec counter “Shows the rate at which pages are read from or written to disk to resolve hard page faults. This counter is a primary indicator of the kinds of faults that cause system-wide delays. It is the sum of Memory\ Pages Input/sec and Memory\ Pages Output/sec. It is counted in numbers of pages, so it can be compared to other counts of pages, such as Memory\ Page Faults/sec, without conversion. It includes pages retrieved to satisfy faults in the file system cache (usually requested by applications) and noncached mapped memory files.” [2]

“ pages / sec counter (页面/秒计数器) “显示从磁盘读取或写入磁盘以解决硬页面错误的速率。 该计数器是导致系统范围延迟的各种故障的主要指示器。 它是“内存\页面输入/秒”和“内存\页面输出/秒”的总和。 它以页数计,因此可以将其与其他页数进行比较,例如“ Memory \ Page Faults / sec”,而无需进行转换。 它包括为满足文件系统缓存(通常由应用程序请求)和未缓存的映射内存文件中的错误而检索的页面。” [2]

Note that this is not the same as Page Faults/sec

请注意,这与“ 页面错误/秒”不同

The average Pages/sec value should be below 50. It’s not possible to reduce the value to zero, as moving pages from memory and to memory always occurs while the operating system is running. The more memory the server has, fewer pages have to be written and read due to page faults

Pages / sec的平均值应小于50。将值减小到零是不可能的,因为在操作系统运行时,总是发生从内存到内存的页面移动。 服务器具有更多的内存,由于页面错误,必须写入和读取的页面更少

A high value of Pages/sec indicates intensive memory activity – many pages are written from disk to RAM and read from RAM to disk. High Pages/sec values can indicate insufficient RAM memory, overhead and SQL Server performance degradation, but it doesn’t necessarily have to be so. A high Pages/sec value can also be caused by sequential reading of a file mapped in memory. To determine whether this is the case, check the Memory Available Bytes and Paging File % Usage values [4]

页面/秒 ”的高值表示密集的内存活动-许多页面从磁盘写入RAM,并从RAM读取到磁盘。 页/秒的高值可能表示RAM内存不足,开销和SQL Server性能下降,但不一定如此。 页面/秒的高值也可能是由顺序读取内存中映射的文件引起的。 要确定是否是这种情况,请检查“ 内存可用字节数”和“ 分页文件百分比使用率”值 [4]

SQL Server memory metrics - Pages/sec

Occasional peaks are normal and appear when creating SQL Server database and transaction log backups, restoring databases, importing and exporting data, and performing other complex tasks

偶尔出现峰值是正常现象,并在创建SQL Server数据库和事务日志备份,还原数据库,导入和导出数据以及执行其他复杂任务时出现

It’s recommended to have a dedicated server for SQL Server only, as other applications can use memory needed by SQL Server and affect SQL Server performance. A counter that indicates that this is the case is Buffer Hit Cache Ratio. If its value is 99% or higher for more than 24 hours and during this same period the Pages/sec value is higher than 50, other applications use memory needed by SQL Server

建议仅使用专用于SQL Server的服务器,因为其他应用程序可以使用SQL Server所需的内存并影响SQL Server的性能。 指示这种情况的计数器是“ 缓冲区命中缓存比率” 。 如果它的值在24小时内超过99%或更高,并且在同一时期内“ 页数/秒”值高于50,则其他应用程序将使用SQL Server所需的内存

If there are no other applications and Pages/sec is still higher than 50, SQL Server is not taking as much memory as it needs, which means that the memory settings are not configured correctly

如果没有其他应用程序,并且“ 页数/秒”仍然高于50,则SQL Server占用的内存不足,这意味着内存设置未正确配置

  1. In SQL Server Management Studio Object Explorer, right click the SQL Server instance
  2. 在“ SQL Server Management Studio 对象资源管理器”中 ,右键单击“ SQL Server实例”
  3. Properties属性
  4. Memory记忆体
  5. Set the Maximum server memory (in MB) to approximately 80% of available physical memory, in order to leave enough memory for the operating system

    最大服务器内存(以MB为单位)设置为可用物理内存的大约80%,以便为操作系统保留足够的内存

    Setting the Maximum server memory in SSMS

If SQL Server has already been allocated maximum available memory, the solution is adding additional RAM

如果已经为SQL Server分配了最大可用内存,则解决方案将添加其他RAM

页面错误/秒 (Page Faults/sec)

Page faults are one of the most common problems with memory

页面错误是内存中最常见的问题之一

“A page fault occurs when a program requests an address on a page that is not in the current set of memory resident pages” [3]

“当程序在一个页面上请求的地址不在当前的内存驻留页面集中时,就会发生页面错误” [3]

When a page fault is encountered, the program execution stops and is set to the Wait state. The operating system searches for the requested address on the disk. When the page is found, the operating system copies it from the disk into a free RAM page. The operating system allows the program to continue with the execution afterwards

遇到页面错误时,程序执行将停止并设置为“等待”状态。 操作系统在磁盘上搜索请求的地址。 找到该页面后,操作系统会将其从磁盘复制到可用的RAM页面中。 操作系统允许程序随后继续执行

There are two types of page faults – hard and soft page faults. Hard page faults occur when the requested page is not in the physical memory. Soft page faults occur when the requested page is in the memory, but cannot be accessed by the program as it is not on the right address, or is being accessed by another program

页面错误有两种类型-硬页面错误和软页面错误。 当请求的页面不在物理内存中时,将发生硬页面错误。 当请求的页面在内存中时,就会出现软页面错误,但是由于该页面不在正确的地址上,或者正在被另一个程序访问,因此无法被程序访问

Monitoring page faults is important as excessive hard page faults affect application performance. Soft page faults cause no performance issues. The Page faults/sec counter shows both hard and soft page faults, so it can be difficult to determine whether the page faults value indicates performance problems in SQL Server, and should be addressed, or presents a normal state

监视页面错误很重要,因为过多的硬页面错误会影响应用程序性能。 软页面错误不会导致性能问题。 Page Faults / sec计数器同时显示了硬页面错误和软页面错误,因此可能很难确定页面错误值是否指示SQL Server中的性能问题,是否应该解决该页面错误或应将其呈现为正常状态

There is no specific Page faults/sec value that indicates performance problems. Monitoring Page faults/sec should provide enough information to create a baseline that will be used to determine normal server performance. The normal values are 10 to 15, but even 1,000 page faults per second can be normal in specific environments. The value depends on the type and amount of memory, and the speed of disk access. A sustained or increasing value for Page faults/sec can indicate insufficient memory. If this is the case, check the Page reads/sec value, as it also indicates hard page faults. If the latter is also high, it indicates insufficient memory on the machine

没有特定的Page Faults / sec值指示性能问题。 每秒监视页面故障数应提供足够的信息来创建基线,该基线将用于确定正常的服务器性能。 正常值为10到15,但是在特定环境下,每秒甚至有1,000个页面错误也可以是正常的。 该值取决于内存的类型和数量以及磁盘访问的速度。 Page Faults / sec的持续值或增加值可能表示内存不足。 如果是这种情况,请检查“ 页面读取/秒”值,因为它也表示硬页面错误。 如果后者也很高,则表明机器上的内存不足

SQL Server memory metrics- Page Faults/sec

Pages/sec and Page faults/sec are two of several most important memory performance metrics. Their high values don’t necessarily indicate memory problems. Sometimes it’s normal and checking other memory metrics is necessary to determine whether there’s a serious issue with performance. However, these metrics should not be skipped in any SQL Server performance monitoring scenarios

Pages / secPage Faults / sec是几个最重要的内存性能指标中的两个。 它们的高值不一定表示存在内存问题。 有时这很正常,有必要检查其他内存指标以确定性能是否存在严重问题。 但是,在任何SQL Server性能监视方案中都不应跳过这些指标。

翻译自: https://www.sqlshack.com/sql-server-memory-performance-metrics-part-1-memory-pagessec-memory-page-faultssec/

sql server 内存

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值