第四章SQLServer2008
本文为本系列最后一章,监控内存使用。监控服务器的内存是非常重要的事情,有很多情况会引起内存消耗。所以要经常性地做检查。 本文将使用可靠性和性能监视器来获取内存相关的统计。 准备工作: 在开始之前,先来了解一下将要用到的计数器: ? Memory: Avail
本文为本系列最后一章,监控内存使用。监控服务器的内存是非常重要的事情,有很多情况会引起内存消耗。所以要经常性地做检查。
本文将使用可靠性和性能监视器来获取内存相关的统计。
准备工作:
在开始之前,先来了解一下将要用到的计数器:
? Memory: Available Mbytes:提供系统上可用内存的数量。
? Memory: Pages/sec:显示有多少页被用于读或写入硬盘,这些基于硬页面错误。
? Paging File:%Usage:显示挂起的总数的百分比。
? SQL Server: Buffer Manager: Buffer cache hit ratio:返回SQLServer从缓存但不是从硬盘返回的数据的百分比。
? SQL Server: Buffer Manager: Page life expectancy:显示数据驻留在内存的平均秒数
? SQL Server: Buffer Manager: Memory Grants Pending:等待内存工作区授予的进程数。
步骤:
1、 打开可靠性和性能监视器,在【运行】中输入perfmon.exe
2、 选择性能监视器。
3、 去除所有已存在的计数器。
4、 添加新计数器。
5、 选择所要监视的服务器。
6、 选择下面的计数器:
Memory: Available Mbytes
Memory: Pages/sec
Paging File:%Usage
SQL Server: Buffer Manager: Buffer cache hit
SQL Server: Buffer Manager: Page life expectancy
SQL Server: Memory Manager: Memory Grants Pending
7、 然后点击确定。
上面这些步骤已经在前一章说明了。这里就不累赘了。
分析:
在本文中,再次使用了可靠性和性能监视器这个工具。为了获取内存相关的性能计数器,需要在图形化界面中观察这些计数器。
首先先检查Memory: Available Mbytes,这个值意味着系统的可用内存。如果发现这个值经常很低,可能表示服务器内存不足,在生产数据库中,这个值可以使用GB为单位。
然后检查Memory: Pages/sec ,以为这因为硬页面错误导致的从磁盘读或写页面。这个值如果长期高于20,意味着内存不足使得应用程序使用虚拟内存,从而导致挂起。
接着是Memory: pages/sec ,同时也要检查Paging File:%Usage去预估内存挂起。如果这个值经常超过20%,可能意味着内存不足。
SQL Server: Buffer Manager: Buffer cache hit ratio:意味着数据从缓存中读取的次数,比较合理的值为大于90%。如果该值很低,可能内存不足或者需要检查索引和查询。如果你需要获得大量数据,这一步可能就会占用大量内存然后引起SQLServer从磁盘读数据而不是从内存。检查索引,确保在大表中能尽可能笔描扫描。并尽可能限制查询返回的结果行。
检查SQL Server: Buffer Manager: Page life expectancy,表示数据页驻留在内存的秒数。微软建议最少300秒。如果在一个实例中经常低于300秒,意味着数据保留的时间少于5分钟就被移出内存。
如果SQL Server: Memory Manager: Memory Grants Pending经常建议等待进程,你可能需要增加服务器的内存了。
不管什么原因,如果你发现内存不足和挂起发生得比较频繁,你首先应该检查是否有非SQL Server的其他应用或者服务耗费了比SQL Server更加多的内存。如果你发现这些应用或者服务,尝试移到别的服务器。如果做不到,那么需要增加更多的内存,以供SQLServer使用。
如果服务器仅仅工SQL Server使用且没有上面说的情况,那么要分析你的查询和索引,以确保他们是最优化的。如果已经优化好,还是存在这些问题,那么才需要考虑增加内存。
除了可靠性和性能监视器,还可以使用SQL Server Profiler来监控性能,创建一个用户自定义收集器并存为文件,当你从性能监视器中获取性能数据时,SQL Server Profiler会同步运行。一旦你完成收集,可以把性能数据导入到SQLServer Profiler中供任何时候分析。

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

AI Hentai Generator
Generate AI Hentai for free.

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

The Xiaomi Mi 15 series is expected to be officially released in October, and its full series codenames have been exposed in the foreign media MiCode code base. Among them, the flagship Xiaomi Mi 15 Ultra is codenamed "Xuanyuan" (meaning "Xuanyuan"). This name comes from the Yellow Emperor in Chinese mythology, which symbolizes nobility. Xiaomi 15 is codenamed "Dada", while Xiaomi 15Pro is named "Haotian" (meaning "Haotian"). The internal code name of Xiaomi Mi 15S Pro is "dijun", which alludes to Emperor Jun, the creator god of "The Classic of Mountains and Seas". Xiaomi 15Ultra series covers

Since the Huawei Mate60 series went on sale last year, I personally have been using the Mate60Pro as my main phone. In nearly a year, Huawei Mate60Pro has undergone multiple OTA upgrades, and the overall experience has been significantly improved, giving people a feeling of being constantly new. For example, recently, the Huawei Mate60 series has once again received a major upgrade in imaging capabilities. The first is the new AI elimination function, which can intelligently eliminate passers-by and debris and automatically fill in the blank areas; secondly, the color accuracy and telephoto clarity of the main camera have been significantly upgraded. Considering that it is the back-to-school season, Huawei Mate60 series has also launched an autumn promotion: you can enjoy a discount of up to 800 yuan when purchasing the phone, and the starting price is as low as 4,999 yuan. Commonly used and often new products with great value

iPhone15 and iPhone15Pro were officially released today. However, as high-end models, the Pro series not only has a higher price, but also has many exclusive features. Consumers must recognize the differences before buying, so as not to discover some problems after buying iPhone15. The function is only available in the Pro series. Although the monitors are equipped with the same display panel, the ProMotion automatic adaptive update frequency technology and the always-on display function are still exclusive to the Pro series. The rest of the iPhone 15 and iPhone 15 Pro series are the same in terms of resolution, contrast, peak brightness, etc. Action button The action button is currently an exclusive design for the iPhone 15 Pro series, allowing users to personalize it.

Many users who want to buy memory modules want to know what series of memory modules the GALAX Hall of Fame brand has. In fact, this brand currently has three series, namely HOFEXTREME limited edition, HOFEXTREME, and HOFPRORGB. What are the series of Hall of Fame memory: A: HOFEXTREME limited edition, HOFEXTREME, HOFPRORGB. These three memory modules all have relatively good performance. Among them, the HOFEXTREME limited edition has the best performance. Compared with the previous two models, the HOFPRORGB is slightly weaker but the performance is also very good. Hall of Fame memory expansion introduction: 1. Using Samsung B-die particles, which is the king of memory particles and has a long service life.

Apple will launch four new iPhone models at 1 a.m. on September 13, namely iPhone 15, 15 Plus, 15 Pro and 15 Pro Max. The high-end iPhone 15 Pro and Pro Max will use a new design, and the side material will be changed from stainless steel to titanium. The colors of the Pro series include gray, black, dark blue, white and other options. The screens of iPhone 15 Pro and Pro Max will be slightly larger this year than last year’s 14 Pro and 14 Pro Max. This change is due to Apple's adoption of a new process technology called LIPO (low injection pressure overmolding), which reduces the thickness of the screen frame by about one-third. High-end models will switch to titanium with a matte texture

Input N, which is equal to the maximum number of series to be printed Input:N=5Output:0¼½¾1AlgorithmSTARTStep1->declarestartvariablesasintnum,den,i,nStep2->inputnumberinnStep3->LoopForfromito0andi<nandi++ OuterIfi%2=0  

From ancient vinyl records, album tapes and CDs that were popular in the millennium, to today's streaming media platforms on mobile devices, with the development of the times, the carriers for listening to music are also constantly changing. With the support of advanced technology, people's pursuit of immersive experience continues to advance, and many novel technical means have been developed as a result. Among them, the new generation of TWS headsets represented by the Samsung Galaxy Buds 3 series have found new breakthroughs on the AI track. High-fidelity sound quality HiFi pleasant listening experience As a new product focusing on sound quality experience, there are two new products in the Samsung Galaxy Buds3 series: 1. Equipped with 24bit/96kHz codec technology, which can bring studio-like high quality when connected to a Galaxy smartphone

New questions in the Apple 15 series! Warm reminder: Question 1: For new customers without ID, when registering a new ID, when entering the address bar and it crashes, just enter symbols or numbers. Question 2: iPhone 15 cannot transfer old ones. For new device data, first activate and update to 17.0.2, then restore - erase all content and settings. You can transfer data normally. Question 3: All Android and Huawei series charger data cables should not be used to charge the Apple 15 series. The number of pins in the typc port is different, so don’t plug it in!
