Written by: Chris Szabo, Senior Software Engineer
I came across some interesting information that took me a lot of digging to find. I thought I would share in case anyone runs into a similar situation. This applies specifically to SQL Server 2005 Enterprise edition. The results are slightly different in 2008.
In a 64 bit environment, Microsoft’s documentation on SQL Server indicates that enabling the use of AWE memory allocation is not necessary, and will in fact be ignored by SQL Server. When AWE is disabled, if you look at the SQL Server process in task manager, you will see that the working set allocates as much memory as possible, or whatever the configured values are.
While administering a client’s environment the other day, I found that the process was consuming approximately 180 MB of memory. This was on a server that had 6 GB of memory available. When I saw this, the first thing I did was execute the following command:
DBCC MEMORYSTATUS
Here is part of the result set:
Memory Manager KB
------------------------------ --------------------
VM Reserved 8519776
VM Committed 114064
AWE Allocated 6397784
Reserved Memory 1024
Reserved Memory In Use 0
Notice that a great deal of memory is allocated using AWE, something that is contrary to the documentation that Microsoft provides. After some further digging I found out why.
In a 64 bit environment, it is recommended that the Lock Pages in Memory user right is assigned to the SQL Server service account. This user right allows SQL Server to allocated memory and refuse to give it back to the operating system when requested. SQL Server can choose to release the memory, but granting this user right allows SQL Server to control what happens, not the operating system. As a result of this, the operating system cannot page out SQL Server’s buffer pool when it thinks it’s necessary.
What you won’t find easily in any documentation is that this user right actually compels SQL Server to use AWE for memory allocation, which is consistent with the results above. This was apparently confusing to someone because if you execute the same command in a 64 bit environment using SQL Server 2008, you’ll get the following results:
Memory Manager KB
---------------------------------------- -----------
VM Reserved 10583068
VM Committed 76928
Locked Pages Allocated 65536
Reserved Memory 1024
Reserved Memory In Use 0
The point of all this is that AWE memory allocation in a 64 bit environment is still used by SQL Server. It is not just a setting used in 32 bit environments to allocate more than 2GB of memory to SQL Server. It’s actually how pages are locked in SQL Server after being allocated.