search
HomeDatabaseMysql Tutorial优化SQLServer数据库服务器内存配置的策略(2)_MySQL

优化SQLServer数据库服务器内存配置的策略(2)_MySQL

Jun 01, 2016 pm 01:51 PM
optimizationMemory configurationdialogueVirtual Memory

bitsCN.com

     序的名称,单击“停止”按钮,这时出现确认操作对话框;

④选择“是”确认操作,然后关闭对话框完成设置。

3?优化虚拟内存

在对Windows NT虚拟内存进行设置时需要合理确定各个驱动器分页文件的“起始大小”和“最大值”两个参数,它们用于指定分页文件的起始空间和最大空间。下面对这两个参数作一些解释:

起始大小:指初始创建该分页文件时的文件大小,单位为MB,根据缺省设置,这个值被设置为系统中的物理内存的大小。

最大值:指出该分页文件的最大尺寸,单位为MB。

(1)分页文件的设置原则:

①分页文件起始大小应保留缺省设置,一般情况下请不要改动;

②分页文件理想的最大尺寸为系统物理内存尺寸的2.5倍至4倍。需要说明的是:如果系统工作时不需要大量内存,请选择靠近下限的值,即用系统物理内存的2.5倍作为这个尺寸的起始值;如果系统工作时需要大量内存,请选择靠近上限的值。

(2)Windows NT虚拟内存设置步骤:

①从“控制面板”中双击“系统”图标;

②在“系统特性”对话框中单击“性能”标签;

③在虚拟内存对话框中单击“更改”按钮,这时出现“虚拟内存”对话框,上端的驱动器框逐一列出了 Windows NT所有页面文件的大小;

④在驱动器列表中,选择需要设置分页文件的驱动器盘符,在“驱动器页面文件大小”对话框中列出了 “起始大小”和“最大值”两个参数栏,填入按照上面的原则确定的数值;

⑤单击“设置”确认以上操作,然后依次单击“确定”按钮退出各个对话框,完成设置。

(3)Win95/98虚拟内存设置。

Win95/98虚拟内存设置方法、步骤和原则与Windows NT 4.0的设置大致相同,请参照上面Windows NT的设置。

4?注意事项

(1)合理确定分页文件的最大值,根据系统需求随时进行调整,使用过多虚拟内存将导致整个系统处理性能的下降。设置虚拟内存最大值的目的是使用户不必在WindowsNT的交换文件上消耗过多的磁盘空间,通常情况下如果超过了系统需要的最佳值后,生成交换文件的磁盘空间就被浪费了。

(2)尽可能设立专用硬盘配置内存交换区,或将交换空间放到主硬盘的另一个分区,同时应将主硬盘的交换文件大小降至16MB,这样主硬盘(分区)仅用来放置操作系统和应用程序,就可以减少交换次数,防止频繁交换耗费大量 CPU时间。

(3)虚拟内存技术的确改善了Windows NT系统的性能,但也受到机器硬盘空间大小、硬盘速度、处理器 (CPU)速度的影响,从理想角度出发,要提高计算机的性能就必须减少交换操作的次数,但是没有一个WindowsNT计算机不发生交换,这就要求计算机要有足够的物理内存,以保持最少的交换操作。
  
 

三、优化Microsoft SQL Server数据库内存配置

内存是影响Microsoft SQL Server系统性能的一个重要因素,SQL Server数据库安装时将为具有32MB物理内存的机器缺省配置16MB可用内存,16MB物理内存的机器缺省配置4MB可用内存。应在Microsoft SQL Server数据库安装后进行内存选项(Memory)设置,最大配置值为2GB。

为了确定SQL Server系统最适宜的内存需求,可以从总的物理内存中减去Windows NT4.0需要的内存以及其它一些内存需求后综合确定,理想的情况是给SQL Server分配尽可能多的内存,而不产生页面调度。

1?根据物理内存合理规划SQL Server可用内存

在大多数的生产环境中,服务器配备的物理内存是64MB~128MB,偶尔也有256MB的,只要配置恰当是完全可以满足SQL Server的内存需求的。下表是笔者关于SQL Server内存分配的建议规划,供参考。

物理内存 分配给SQL Server 设置值(单位:2KB)

8MB 4MB 2048

16MB 8MB 4096

32MB 16~18MB 8192~9216

48MB 28~34MB 14336~17408

64MB 40~46MB 20480~23552

128MB 100~108MB 51200~55296

256MB 216~226MB 110592~115712

512MB 464~472MB 237568~241664

以下是SQL Server内存选项(Memory)设置方法

(1)从Microsoft SQL Server程序集中启动SQL Enterprise Manager;

(2)从Server Manager窗口中选择“Server”菜单选项;

(3)在“Server”菜单中选择“Configurations”选项;

(4)在“Server Configuration”对话框中选择”Configuration”标签,Configuration窗口显示配置选项列表;

(5)选中“Memory”项目,在“Current”栏填入新值;

(6)停止并重新启动SQLServer服务,使设置生效。

2?合理扩充虚拟内存、增大SQL Server可用内存

当SQL Server系统确实需要扩大可用内存时,应在磁盘空间充足的情况下扩充供虚拟内存,并相应增大 SQL Server可用内存。具体做法是,系统管理员首先扩充服务器的虚拟内存,然后再参考上表增大SQL Server可用内存,关键是要根据系统的负载情况综合决定是否扩充内存、优化配置。

3?使用tempinRAM

SQL Server使用tempdb临时数据库作为一些查询连接操作时排序或创建临时表的工作空间。将tempdb创建在RAM中可以使系统操作性能有较大提高,而且因为tempdb在每次重启动服务器时都重建,这样即使有非正常的关闭也是较为安全的,例如停电故障。要将tempdb创建在RAM中,可以使用sp_configure进行设置,具体用法请参阅有关资料。

由于tempdbinRAM使用的内存是由系统从内存体单独分配的,与SQL Server的内存选项设置的可用内存池是分开的,使用tempdbin RAM将减少整个系统的可用内存,应根据SQL Server和服务器运行情况进行配置,否则就可能适得其反,影响系统性能。另外,适当增加tempdb数据库空间,即使不使用tempdbin RAM,也可以提高数据库的运行速度。

4?注意事项

(1)建议在生产环境中SQL Server不要设置小于32MB内存,而且数据库服务器上尽量不要运行其它应用程序;

(2)扩充供虚拟内存、增大SQL Server可用内存,应考虑物理内存使用状况和磁盘空间许可情况;

(3)在可能的情况下,要为系统留有部分额外的内存,这样在服务器上打开一个服务或添加一个进程且不改变SQL Server内存配置时,不致于使NT服务器的运行速度受到影响(变得很慢),一般认为最小为2MB最大为20MB。

四、巧用内存配置,解决统计服务器问题

一单位的统计服务器投入使用后,运行速度较慢,经排查原因,发现SQLServer中的内存选项(Memory)仅为安装缺省值――16MB(而服务器有128MB的物理内存),在将内存值调整为100MB时却误将其改成了 1000MB,使得SQL Server服务不能启动,统计数据库打不开,也就不能再次进入SQL Enterprise Manager修改内存设置了。由于近期未备份业务数据,不到万不得已不能重装SQLServer数据库,就试图用命令行参数命令来重新启动SQL Server服务,但均不能奏效,陷入了困境。我们经过仔细分析提出:既然SQL Server可用内存设置值远远大于物理内存,造成SQLServer服务不能启动,何不扩充虚拟内存呢?经设法将机器虚拟内存扩充至1000MB并重新启动,SQL Server数据库成功启动,问题迎刃而解。

五、结束语

目前,大多数单位投入使用的Microsoft SQL Server数据库服务器的物理内存一般都在64MB以上,如农业银行省、市分行的统计服务器配备128MB物理内存,只要按照上面提出的方法合理规划、优化NT和SQL Server的内存配置,使设置尽可能达到最优,应用系统就一定能够充分发挥设计功能、满足业务需求。  

bitsCN.com
Statement
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
When should you use a composite index versus multiple single-column indexes?When should you use a composite index versus multiple single-column indexes?Apr 11, 2025 am 12:06 AM

In database optimization, indexing strategies should be selected according to query requirements: 1. When the query involves multiple columns and the order of conditions is fixed, use composite indexes; 2. When the query involves multiple columns but the order of conditions is not fixed, use multiple single-column indexes. Composite indexes are suitable for optimizing multi-column queries, while single-column indexes are suitable for single-column queries.

How to identify and optimize slow queries in MySQL? (slow query log, performance_schema)How to identify and optimize slow queries in MySQL? (slow query log, performance_schema)Apr 10, 2025 am 09:36 AM

To optimize MySQL slow query, slowquerylog and performance_schema need to be used: 1. Enable slowquerylog and set thresholds to record slow query; 2. Use performance_schema to analyze query execution details, find out performance bottlenecks and optimize.

MySQL and SQL: Essential Skills for DevelopersMySQL and SQL: Essential Skills for DevelopersApr 10, 2025 am 09:30 AM

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

Describe MySQL asynchronous master-slave replication process.Describe MySQL asynchronous master-slave replication process.Apr 10, 2025 am 09:30 AM

MySQL asynchronous master-slave replication enables data synchronization through binlog, improving read performance and high availability. 1) The master server record changes to binlog; 2) The slave server reads binlog through I/O threads; 3) The server SQL thread applies binlog to synchronize data.

MySQL: Simple Concepts for Easy LearningMySQL: Simple Concepts for Easy LearningApr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL: A User-Friendly Introduction to DatabasesMySQL: A User-Friendly Introduction to DatabasesApr 10, 2025 am 09:27 AM

The installation and basic operations of MySQL include: 1. Download and install MySQL, set the root user password; 2. Use SQL commands to create databases and tables, such as CREATEDATABASE and CREATETABLE; 3. Execute CRUD operations, use INSERT, SELECT, UPDATE, DELETE commands; 4. Create indexes and stored procedures to optimize performance and implement complex logic. With these steps, you can build and manage MySQL databases from scratch.

How does the InnoDB Buffer Pool work and why is it crucial for performance?How does the InnoDB Buffer Pool work and why is it crucial for performance?Apr 09, 2025 am 12:12 AM

InnoDBBufferPool improves the performance of MySQL databases by loading data and index pages into memory. 1) The data page is loaded into the BufferPool to reduce disk I/O. 2) Dirty pages are marked and refreshed to disk regularly. 3) LRU algorithm management data page elimination. 4) The read-out mechanism loads the possible data pages in advance.

MySQL: The Ease of Data Management for BeginnersMySQL: The Ease of Data Management for BeginnersApr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

See all articles

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

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software