How to provide large memory support for Windows)

Source: Internet
Author: User
Tags server error log

"Talking about some knowledge of Virtual Memory" refers to some of your understanding of virtual memory in the operating system, which mentions the concept of "/3 GB switch. It involves how Windows uses large memory. Here we will discuss in detail.

2 ^ 32 = 4,294,967,296 bytes
4,294,967,296/(1,024x1,024) = 4,096 MB = 4 GB

From the above formula, we can conclude that all 32-bit applications have 4 GB process address space (32-bit addresses can map up to 4 GB memory ). In Microsoft Windows, an application can access a 2 GB process address space, which is called a user-mode virtual address space. All threads owned by the application share the virtual address space in the same user mode. The remaining 2 GB is reserved for the operating system (also known as the kernel mode address space ).
Typically, when the physical memory is no greater than 4 GB, processes running in Windows can access a maximum of 2 GB of memory address space, some of which are physical memory, others are virtual memory (4 GB physical memory is used completely without virtual memory ). At this point, the more programs run, the more processes, the closer the occupied memory address space is to the maximum of 2 GB. In this case, the paging process increases significantly and has a negative impact on performance. To avoid this situation, you need to provide more physical memory to the program, which will reduce the need for swap page file memory, the/3 GB parameter or/PAE parameter and awe parameter are usually used (both are used, but I do not recommend them ).
The address space allocated to applications by the system and the physical memory that the CPU can access are not a concept. The address space is limited to 4 GB, but the CPU can access the physical memory larger than 4 GB, the address space is not associated with the allocation of physical memory. Awe uses function calls to negotiate with the system to map an address space to a certain segment of physical memory (using a third-level pointer to add a first-level pointer. With the exponential power of 2, the amount of memory that can be accessed is increased. In addition to the physical memory accessed by the application according to the common method, the extra physical memory obtained increases some overhead, however, the page exchange with physical memory and hard disk still improves the efficiency.

1./3 GB parameters.
To support 3 GB user mode process space, you must add the/3 GB parameter to the boot. ini file and restart the computer to make the/3 GB parameter take effect. After this parameter is set, the user application thread can address 3 GB of process address space, while retaining 1 GB of process address space for the operating system. The idea is to make the application program need more memory in the physical memory, rather than in the virtual memory of the page, but this causes the kernel mode address space to be compressed, the non-paged pool mentioned above will be reduced from 128 M to M, so many operating system operations will also be limited.
You can use the/3 GB parameter to provide up to 1 GB of address space for applications. Therefore, we recommend that you do not use the/PAE parameter instead of the/3 GB parameter to occupy the address space in kernel mode.

[Boot loader]
Timeout = 30
Default = multi (0) disk (0) RDISK (0) Partition (2)/Windows
[Operating systems]
Multi (0) disk (0) RDISK (0) Partition (2)/Windows = "Windows Server 2003, enterprise"/fastdetect/3 GB

2./PAE parameters and awe.
Physical address extension (PAE) supports more than 4 GB physical memory, and PAE allows a maximum of 64 GB physical memory to be used as a regular 4 kb page. After you add the/PAE parameter to the boot. ini file and restart the computer, the system supports more than 4 GB of physical memory.
Address Window Extensions (AWE) are a group of extensions of Windows memory management functions, it enables the application to use more than 2-3 GB memory that can be used through standard 32-bit addressing. Awe allows applications to obtain physical memory and dynamically map non-Paging memory views to 32-bit address space. Although the 32-bit address space is limited to 4 GB, the non-Paging memory can be much larger than 4 GB. This allows applications that require a large amount of memory (such as large database systems) to use much larger memory than the 32-bit address space. AWe can only be applied to 32-bit operating systems.

[Boot loader]
Timeout = 30
Default = multi (0) disk (0) RDISK (0) Partition (2)/Windows
[Operating systems]
Multi (0) disk (0) RDISK (0) Partition (2)/Windows = "Windows Server 2003, enterprise"/fastdetect/PAE

Note: If the available physical memory on the computer exceeds 16 GB, the operating system requires 2 GB of virtual address space for the system to use. Therefore, only 2 GB of user mode virtual address space is supported. To enable the operating system to use more than 16 GB memory, ensure that the/3 GB parameter is not in the boot. ini file. If this parameter exists, the operating system cannot use more than 16 GB of physical memory.
The following example shows how to configure awe.
1. SQL Server 2000, enable awe and configure Max server memory to 12 GB:

-- Displays advanced options. Some Hidden options cannot be viewed or changed by default.
Sp_configure 'show advanced options', 1
-- Update the configuration of the system stored procedure change and use the current configured value.
Reconfigure
Go
-- Enable awe
Sp_configure 'awe enabled', 1
Reconfigure
Go
-- Configure the maximum service memory to 12 GB
Sp_configure 'max Server Memory ', 12288
Reconfigure
Go

2. SQL Server 2005, enable awe, configure min server memory to 4 GB, and configure Max server memory to 12 GB:
Enable awe:

Sp_configure 'show advanced options', 1
Reconfigure
Go
Sp_configure 'awe enabled', 1
Reconfigure
Go

After you restart SQL Server, the following message is displayed in the SQL Server Error Log:

Address windowing extensions Enabled

Memory Configuration:

Sp_configure 'min Server Memory ', 4096
Reconfigure
Go
Sp_configure 'max Server Memory ', 12288
Reconfigure
Go

The preceding settings are described as follows:
(1) After SQL Server 2005 enables awe, the SQL Server service needs to be restarted, while SQL Server 2000 does not require a restart.
(2) SQL Server 2005 supports dynamic allocation of AWE ing memory. The memory settings allow the buffer pool to dynamically manage the awe ing memory between 4 GB and 12 GB, this dynamic awe is not applicable in SQL Server 2000.
(3) min Server Memory ensures the minimum memory available in the buffer pool of the SQL server instance. SQL Server does not allocate the memory size specified by Min server memory at startup. However, unless the value of Min server memory is reduced, when the memory usage reaches this value due to client load, SQL Server cannot release the memory from the allocated buffer pool.
SQL Server does not necessarily allocate the memory size specified by Min server memory. If the load on the server never needs to allocate the memory size specified by Min server memory, SQL Server runs with less memory.
(4) Max Server Memory avoids the use of more memory than the specified memory in the SQL Server Buffer Pool, so that the remaining available memory can be used to quickly start other applications. SQL Server does not allocate the memory size specified by Max server memory at startup. The memory usage increases as the SQL server needs to reach the value specified by Max server memory. Unless you increase the value of Max server memory, SQL Server cannot exceed the memory usage.
(5) SQL Server 2005 locks the memory page before enabling awe to maximize the data throughput of network applications.
(6) Lock the Memory Page
Determine which accounts can use processes to keep data in the physical memory, thus preventing the system from paging data to the virtual memory of the disk. In SQL Server 2005, the "Lock Memory Page" option is set to off by default. You need to assign this permission to the account that is running SQL Server.
How to enable the "Lock Pages In Memory" option
1) Click "run" on the "Start" menu ". In the open box, type gpedit. MSC.
The "Group Policy" dialog box is displayed.
2) on the "Group Policy" console, expand "Computer Configuration", and then expand "Windows Settings ".
3). Expand "Security Settings" and then "local policies ".
4) Select the "user rights assignment" folder.
The details pane displays the policy.
5) in this pane, double-click "Lock Pages In Memory ".
6) in the "Local Security Policy Settings" dialog box, click the "add" button.
7) in the "select user or group" dialog box, add an account that has the permission to run sqlservr.exe.
(7) Maximize network application data throughput
If the "maximize file sharing data throughput" option is selected in "network connection", the operating system caches the application's I/O page in the file system cache, this gives priority to applications that perform buffer input/output (I/O) operations. This option may limit the memory that can be used for normal SQL server operations.
Check the current operating system settings:
1) In "Control Panel", double-click "network connection", and then double-click "Local Connection ".
2) on the General tab, click Properties, select file and printer sharing for Microsoft network, and then click Properties ".
3) Select "maximize network application data throughput", click "OK", and then close other dialog boxes.
For a long time, the above is actually how the Windows system supports more than 4 GB of physical memory. Here we refer to SQL Server 2005 books online and 283037 and 274750 kb.

I have read an article about virtual memory from my 51cto friend xintao800 and have some opinions on it.

Source http://beacon.blog.51cto.com/442731/133762

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.