用Windows性能监视器监控SQL Server的常见指标
上边文章中提到Win的性能监视器是监控数据库性能必备的工具,接下来我就给大家介绍一些常见的监控指标,其实无非就是磁盘,cpu,
上边文章中提到Win的性能监视器是监控数据库性能必备的工具,接下来我就给大家介绍一些常见的监控指标,其实无非就是磁盘,cpu,内存等硬件的运行指标还有数据库自身的像锁啊、用户连接数啊、还有就是根据自身业务决定的需要注意的参数指标。
1.SQL Server Buffer: Buffer Cache Hit Ratio
这是一个很重要查看内存是否不足的参数。SQL Server Buffer中的计数器Buffer Cache Hit Ratio用来指出SQL Server从缓存中而不是磁盘中获得数据的频率。SQL Server会将某些查询过的数据缓存在内存中用于以后再次查询使用。当一个查询A进来了以后数据库会编译这个sql看看需要哪些数据,然后执行计划首先去内存中找看是否有这次查询所需要的数据,如果这个同样的sql刚才已经执行过了或者该表的数据已经缓存在内存中,但是却没有在内存中找到数据,那就有可能是因为内存不足引起内存挤压将缓存数据写回硬盘或者释放掉来提供数据库其他请求来使用。一般来说oltp的系统,这个值最起码也应该在90%以上,理想值是99%。如果这个值低于90%,那建议你应该添加内存了。
2.Memory: Pages/sec
这个也是监控内存是否不足的一个比较重要的参数。这个计数器记录的是每秒钟内存和磁盘之间交换的页面数。频繁的交换页面就会消耗更多的io,这会影响到服务器的性能。打个比方,超市有一个货架上边摆满了新进的各种商品a、b、c,当你去超市想买a的时候直接去货架就能拿到a,方便的很,当顾客进超市逛一圈以后跟你说我怎么没有发现旧商品d呢,我就想买这个d,然后工作人员就会去仓库把商品d拿出来摆放到货架上供下次顾客来买。但是货架摆满了怎么办呢,只能将时间长没有人问津的a下架放到仓库然后空出来地方摆放d,但是下次另一个顾客来了又有想要购买a的意向,工作人员就得再次把a拿出来替换掉货架上的d。其实内存就是这个货架,硬盘就是仓库。因为货架太小了,,导致只能频繁的更换货架上的商品来提供正常的运营,想减少反复来回搬运产生的io开销,只能换个更大的货架来满足需求。
如果服务器上只跑的SQL Server,那这个指标的理想范围应该是0-20之间,偶尔超过20的话影响不大,如果这个值频繁的超过20,那说明你的这台服务器可能需要加内存了。
当然这个指标要配合着上一个指标Buffer Cache Hit Ratio来看,如果上一个指标缓冲命中一直在99%或者更高,而这个期间内你的页交换一直在20以上,那意味着不仅仅是内存不足,而且其他的程序占用了系统内存。
3.Memory: Available Bytes
另一个监控内存情况的计数器就是这个。这个值最少最少也得大于5M,因为SQL Server需要始终维持5-10m的自由内存用于分配,当这个值低于5m的时候,那SQL Server可能会因为缺少内存而产生性能瓶颈。
4.Physical Disk: % Disk Time
这个计数器记录的是磁盘的繁忙程度(是整个磁盘阵列或者物理磁盘的繁忙程度)。理论上这个值应该低于55%,如果持续的高于55%,那说明这台服务器上可能有io瓶颈。
如果只是偶尔的出现几次,那不必担心,但是可以对应的找到这个时间点,数据库正在干嘛执行了哪些语句,对应的优化一下。
5.Physical Disk: Avg. Disk Queue Length
这是一个比较重要的查看磁盘io情况的指标。理论上每个物理磁盘的值不应该超过2。当然这个值是需要计算的,比如用4块物理盘做了个raid10,此时在一个监控周期内磁盘队列的均值是10,那每块磁盘的队列值就是10/4=2.5,那么就可以说这个磁盘阵列存在i/o瓶颈了。这个跟之前的disktime指标一样,偶尔出现不必担心,如果长时间出现,那就得着手考虑解决磁盘的io性能问题了。
6.Processor: % Processor Time
这是监控cpu情况的一个指标(类似于disk time)。这个是观察cpu利用率的一个关键参数。如果Processor Time计数器的值持续超过80%,说明cpu存在瓶颈问题。如果只是偶尔出现,那说明可能是这个时间点有个特别消耗cpu的查询,可以在下一次这个时间点来临的时候尝试抓一下sql并且优化它。如果在某一个时间点以后cpu一直飙高,常见的情况就是:1.突然间的高并发2.索引重整3.突然一个经常使用的数据量特别大的索引失效了4.死锁5.其他好多好多。先找到问题所在,在处理掉它。
7.System: Processor Queue Length
这个指标类似于disk queue length,也是算单个cpu的。单个cpu不能超过2,比如你是2u的机器,那这个值不应该超过4,如果在一个监控周期内持续性的超过4,那就可能出现cpu瓶颈了。
基本上常用的就是这么多,还有好多可以配合你检测SQL Server性能的计数器,有兴趣的可以自己百度下。
本文永久更新链接地址:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Microsoft SQL Server is a relational database management system launched by Microsoft. It is a comprehensive database platform that uses integrated business intelligence (BI) tools to provide enterprise-level data management. It is easy to use, has good scalability, and has a high degree of integration with related software. High advantages. The SQL Server database engine provides more secure and reliable storage functions for relational data and structured data, allowing users to build and manage highly available and high-performance data applications for business.

SQLServer or MySQL? The latest research reveals the best database selection. In recent years, with the rapid development of the Internet and big data, database selection has become an important issue faced by enterprises and developers. Among many databases, SQL Server and MySQL, as the two most common and widely used relational databases, are highly controversial. So, between SQLServer and MySQL, which one should you choose? The latest research sheds light on this problem for us. First, let

Introduction to how to use PDO to connect to a Microsoft SQL Server database: PDO (PHPDataObjects) is a unified interface for accessing databases provided by PHP. It provides many advantages, such as implementing an abstraction layer of the database and making it easy to switch between different database types without modifying a large amount of code. This article will introduce how to use PDO to connect to a Microsoft SQL Server database and provide some related code examples. step

With the popularity of the Internet, website and application development has become the main business of many companies and individuals. PHP and SQLServer database are two very important tools. PHP is a server-side scripting language that can be used to develop dynamic websites; SQL Server is a relational database management system developed by Microsoft and has a wide range of application scenarios. In this article, we will discuss the development of PHP and SQL Server, as well as their advantages, disadvantages and application methods. First, let's

SQL Server vs. MySQL: Which database is more suitable for high availability architecture? In today's data-driven world, high availability is one of the necessities for building reliable and stable systems. As the core component of data storage and management, the database's high availability is crucial to the business operation of the enterprise. Among the many databases, SQLServer and MySQL are common choices. So in terms of high availability architecture, which database is more suitable? This article will compare the two and give some suggestions.

In web development, the combination of PHP and MySQL is very common. However, in some cases, we need to connect to other types of databases, such as SQL Server. In this article, we will cover five different ways to connect to SQL Server using PHP.

SQLServer and MySQL are currently two very popular relational database management systems (RDBMS). They are both powerful tools for storing and managing large-scale data. However, they have some differences in handling large-scale data. This article will compare SQL Server and MySQL, focusing on their suitability for large-scale data processing. First, let us understand the basic characteristics of SQLServer and MySQL. SQLServer is developed by Microsoft

With the continuous development of the Internet, database selection has become increasingly important. Among the many databases, SQLServer and MySQL are two high-profile options. SQLServer is a relational database management system developed by Microsoft, while MySQL is an open source relational database management system. So how to choose the best database solution between SQLServer and MySQL? First, we can compare these two databases in terms of performance. SQLServer is processing
