Home Database Mysql Tutorial SQL SERVER的内存会不断增加,问题分析

SQL SERVER的内存会不断增加,问题分析

Jun 07, 2016 pm 05:53 PM
server sql Memory Increase problem analysis

当 SQL Server 数据库引擎在 Microsoftreg; Windows NTreg; 或 Windowsreg; 2000 上运行时,其默认内存管理行为并不是获取特定的内存量,而是在不产生多余换页 I/O 的情况下获取尽可能多的内存。为此,数据库引擎获取尽可能多的可用内存,同时保留足够的可用

当 SQL Server 引擎在 Microsoft® Windows NT® 或 Windows® 2000 上运行时,其默认内存管理行为并不是获取特定的内存量,而是在不产生多余换页 I/O 的情况下获取尽可能多的内存。为此,引擎获取尽可能多的可用内存,同时保留足够的可用内存以防操作系统交换内存。

SQL Server 实例在启动时通常获取 8 到 12 MB 的内存以完成初始化过程。当实例完成初始化后,就不会再获取更多的内存,直到用户连接到该实例并开始产生工作负荷。这时,该实例根据需要不停地获取内存以支持工作负荷。随着更多的用户连接并运行查询,SQL Server 将获取支持需求所需的额外内存。该实例将继续获取内存直到达到自身的内存分配目标,并且直到达到该目标的下限才会释放任何内存。

为了在不产生多余换页 I/O 的情况下获取尽可能多的内存,SQL Server 的每个实例都设置一个内存获取目标,直到计算机的可用物理内存在 4 MB 到 10 MB 的范围内。之所以选择该范围是因为测试表明 Windows NT 和 Windows 2000 都有最小内存交换,直到内存分配等于可用物理内存减去 4 MB。工作负荷处理任务重的 SQL Server 实例保留的可用物理内存为范围的较低端 (4 MB);工作负荷处理任务轻的实例保留的可用物理内存为范围的较高端 (10 MB)。

SQL Server 实例的目标随工作负荷的改变而变化。当更多的用户连接并产生更多的工作时,该实例倾向于获取更多的内存以使可用的内存保持在 4 MB 的限制以下。当工作负荷减轻时,该实例将其目标调整为 10 MB 的可用空间,并释放内存给操作系统。将可用空间量保持在 10 MB 与 4 MB 之间可防止 Windows NT 或 Windows 2000 过多执行换页操作,同时使 SQL Server 得以获得尽可能最大的高速缓冲存储器而不至引起额外的交换。

实例的目标内存设置与数据库缓冲池的页相对于可用池大小的需求有关。在任何即时点,缓冲区页的总需求取决于满足所有当前执行的查询所需的数据页数。如果相对于高速缓冲存储器内的页数,数据页的需求很大,则当前在缓冲区内的每一页很可能在相对较短的时间内由新页替换。这可由"缓冲区管理器"对象的"页生命期"性能计数器来度量。对于相对较小的缓冲区有较高需求的情况将生成短生命期,而纯粹的影响就是使 I/O 增加,因为在页可由多个逻辑读取引用之前往往要被重写。为减轻这个问题,数据库引擎可以获取更多的内存以增加高速缓冲存储器的大小。当页生命期长时,数据库引擎将可用内存定位于目标的高端 (10 MB);而当页生命期短时,数据库引擎定位于目标范围的低端 (4 MB)。

随着其它应用程序在运行 SQL Server 实例的计算机上启动,它们消耗内存致使可用物理内存量降到 SQL Server 的目标以下。SQL Server 实例于是从其地址空间释放足够内存,以使可用内存量回到 SQL Server 的目标。如果有其它应用程序停止运行而使可用内存增多,SQL Server 实例将增加其内存分配大小。SQL Server 可以每秒释放并获取几 MB 字节的内存,这使它得以根据内存分配变化作出快速调整。

你可以通过设置允许sql server可以使用的最大内存来做限制:

最小和最大内存的影响
min server memory 和 max server memory 配置选项建立由 SQL Server 数据库引擎使用的内存量的上限和下限。数据库引擎并不立即获取 min server memory 中指定的内存量。数据库引擎启动时只使用初始化所需的内存。随着数据库引擎工作负荷的增加,它将继续获取支持工作负荷所需的内存。数据库引擎直到到达 min server memory 中指定的内存量才会释放任何所需的内存。一旦到达 min server memory,数据库引擎将使用标准算法(使操作系统的可用内存保持在 4 MB 到 10 MB 之间)获取和释放所需内存。唯一的区别是数据库引擎从不将内存分配降到 min server memory 所指定的水平下,也从不获取超过max server memory 所指定水平的内存。

数据库引擎获取的内存量完全取决于放置在实例上的工作负荷。不处理很多请求的 SQL Server 实例可能永远达不到 min server memory。

如果为 min server memory 和 max server memory 指定相同的值,则一旦分配给数据库引擎的内存达到该值,数据库引擎将停止动态释放和获取内存。

如果在运行 SQL Server 实例的计算机上频繁启动或停止其它应用程序,启动这些应用程序所需的时间可能会因 SQL Server 实例分配和释放内存而延长。另外,如果 SQL Server 是几个在一台计算机上运行的服务器应用程序中的一个,系统管理员可能需要控制分配给 SQL Server 的内存量。在这些情况下,可以使用 min server memory 和 max server memory 选项控制 SQL Server 可以使用的内存量。


何设置固定的内存量(企业管理器)
设置固定的内存量

展开一个服务器组。

右击一个服务器,再单击"属性"。

单击"内存"选项卡。

单击"使用固定的内存大小 (MB)",然后将固定内存滑块放在适当的位置。

说明  如果使用默认设置,则 Microsoft® SQL Server™ 将动态配置内存。

这是由sql server的内存管理机制决定的

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Large memory optimization, what should I do if the computer upgrades to 16g/32g memory speed and there is no change? Large memory optimization, what should I do if the computer upgrades to 16g/32g memory speed and there is no change? Jun 18, 2024 pm 06:51 PM

For mechanical hard drives or SATA solid-state drives, you will feel the increase in software running speed. If it is an NVME hard drive, you may not feel it. 1. Import the registry into the desktop and create a new text document, copy and paste the following content, save it as 1.reg, then right-click to merge and restart the computer. WindowsRegistryEditorVersion5.00[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\MemoryManagement]"DisablePagingExecutive"=d

How to check memory usage on Xiaomi Mi 14Pro? How to check memory usage on Xiaomi Mi 14Pro? Mar 18, 2024 pm 02:19 PM

Recently, Xiaomi released a powerful high-end smartphone Xiaomi 14Pro, which not only has a stylish design, but also has internal and external black technology. The phone has top performance and excellent multitasking capabilities, allowing users to enjoy a fast and smooth mobile phone experience. However, performance will also be affected by memory. Many users want to know how to check the memory usage of Xiaomi 14Pro, so let’s take a look. How to check memory usage on Xiaomi Mi 14Pro? Introduction to how to check the memory usage of Xiaomi 14Pro. Open the [Application Management] button in [Settings] of Xiaomi 14Pro phone. To view the list of all installed apps, browse the list and find the app you want to view, click on it to enter the app details page. In the application details page

What is the difference between HQL and SQL in Hibernate framework? What is the difference between HQL and SQL in Hibernate framework? Apr 17, 2024 pm 02:57 PM

HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

Usage of division operation in Oracle SQL Usage of division operation in Oracle SQL Mar 10, 2024 pm 03:06 PM

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

Comparison and differences of SQL syntax between Oracle and DB2 Comparison and differences of SQL syntax between Oracle and DB2 Mar 11, 2024 pm 12:09 PM

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

Is there a big difference between 8g and 16g memory in computers? (Choose 8g or 16g of computer memory) Is there a big difference between 8g and 16g memory in computers? (Choose 8g or 16g of computer memory) Mar 13, 2024 pm 06:10 PM

When novice users buy a computer, they will be curious about the difference between 8g and 16g computer memory? Should I choose 8g or 16g? In response to this problem, today the editor will explain it to you in detail. Is there a big difference between 8g and 16g of computer memory? 1. For ordinary families or ordinary work, 8G running memory can meet the requirements, so there is not much difference between 8g and 16g during use. 2. When used by game enthusiasts, currently large-scale games basically start at 6g, and 8g is the minimum standard. Currently, when the screen is 2k, higher resolution will not bring higher frame rate performance, so there is no big difference between 8g and 16g. 3. For audio and video editing users, there will be obvious differences between 8g and 16g.

Samsung announced the completion of 16-layer hybrid bonding stacking process technology verification, which is expected to be widely used in HBM4 memory Samsung announced the completion of 16-layer hybrid bonding stacking process technology verification, which is expected to be widely used in HBM4 memory Apr 07, 2024 pm 09:19 PM

According to the report, Samsung Electronics executive Dae Woo Kim said that at the 2024 Korean Microelectronics and Packaging Society Annual Meeting, Samsung Electronics will complete the verification of the 16-layer hybrid bonding HBM memory technology. It is reported that this technology has passed technical verification. The report also stated that this technical verification will lay the foundation for the development of the memory market in the next few years. DaeWooKim said that Samsung Electronics has successfully manufactured a 16-layer stacked HBM3 memory based on hybrid bonding technology. The memory sample works normally. In the future, the 16-layer stacked hybrid bonding technology will be used for mass production of HBM4 memory. ▲Image source TheElec, same as below. Compared with the existing bonding process, hybrid bonding does not need to add bumps between DRAM memory layers, but directly connects the upper and lower layers copper to copper.

Micron: HBM memory consumes 3 times the wafer volume, and production capacity is basically booked for next year Micron: HBM memory consumes 3 times the wafer volume, and production capacity is basically booked for next year Mar 22, 2024 pm 08:16 PM

This site reported on March 21 that Micron held a conference call after releasing its quarterly financial report. At the conference, Micron CEO Sanjay Mehrotra said that compared to traditional memory, HBM consumes significantly more wafers. Micron said that when producing the same capacity at the same node, the current most advanced HBM3E memory consumes three times more wafers than standard DDR5, and it is expected that as performance improves and packaging complexity intensifies, in the future HBM4 This ratio will further increase. Referring to previous reports on this site, this high ratio is partly due to HBM’s low yield rate. HBM memory is stacked with multi-layer DRAM memory TSV connections. A problem with one layer means that the entire

See all articles