AWE

AWE -What is It and How to use it?

32-bit Operating systems provide 4Gb of addressable space to applications. This includes memory for the user application and also for the system.

When running Oracle on 32-Bit Windows, we can have total memory limited to 1.7 Gb only. If you allocate memory more then 1.7 GB or if it increases during course of database operation, then you are likely to encounter errors such as ORA – 4030, ORA – 12500 or ORA – 27102.

There are few solutions to overcome this problem. I am going to discuss them in this post. Feel free to post any Questions/doubts you have.

1)Using /3GB switch

To increase the virtual addressable space for processes and applications, you need to use /3GB switch. The /3GB switch allows for providing memory upto 3GB for processes (In actual it is nearly 2.7 GB for Oracle) by reducing memory available to OS to 1 GB.
To implement it, you need to modify the boot.ini as follows and restart the server

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINNT="????" /3GB

Note: -“????” in the above example can be the programmatic name of any of the following operating system versions:

– Windows XP Professional

– Windows Server 2003

– Windows Server 2003, Enterprise Edition

– Windows Server 2003, Datacenter Edition

– Windows 2000 Advanced Server

– Windows 2000 Datacenter Server

– Windows NT Server 4.0, Enterprise Edition

2)Using /PAE switch

Physical Address Extention (PAE) allows applications to have virtual addressable space beyond 4GB. PAE maps up to 64 GB of physical memory into a 32-bit (4 GB) virtual address space using either 4-KB or 2-MB pages.

This can be enabled using /PAE switch in boot.ini as follows

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINNT="????" <strong>/PAE</strong>
<span style="font-family: Arial;">
</span>

Note: -“????” in the above example can be the programmatic name of any of the following operating system versions:

– Windows 2000 Datacenter Server

– Windows 2000 Advanced Server

– Windows 2003 Data Center Edition (32-Bit)

– Windows 2003 Enterprise Edition (32-Bit)

PAE is also known by name Address Windowing Extensions (AWE). This basically allows Oracle to have larger buffer cache. In addition to addition to boot.ini, you need to make some changes at database level also

1) Add parameter USE_INDIRECT_DATA_BUFFERS=TRUE to spfile/pfile

2) Remove DB_CACHE_SIZE parameter from pfile/spfile and replace it with DB_BLOCK_BUFFERS. To calculate it you need to use following DB_CACHE_SIZE/DB_BLOCK_SIZE

How PAE/AWE works?

PAE allows the system to expand the number of bits that can be used to address physical memory from 32 bits to 36 bits. Out of 1.7GB allocated to Oracle, 1 GB is allocated to a “WINDOW” which is used to map the buffer cache and allows for bigger SGA. This acts like a “Swap Area” where all the blocks are mapped into this window and then provided to the application.It is advisable to use /3GB switch along with /PAE switch so that addressable space is around 2.7GB.

To do it, change boot.ini to as follows

<span style="font-size: 12pt; font-family: Arial;"> </span><span style="font-size: 12pt; font-family: Arial;">multi(0)disk(0)rdisk(0)partition(2)\WINNT="????" <strong>/3GB /PAE</strong></span>

Note: – Using both /3GB and /PAE will limit memory addressability to 16 GB. In case you wish to address memory beyond 16GB, you will be required to unset /3GB switch.

AWE Window is specified by parameter AWE_WINDOW_SIZE. The size of this window is defined by a registry setting in the HOME key for Oracle (HKLM\Software\Oracle\Homex) called AWE_WINDOW_SIZE. Default value for AWE_WINDOW_SIZE is 1 GB and no entry in registry will mean that it is running at default value. Value for this parameter has to be specified in Bytes in registry.

Metalink Note:225349.1 and Oracle Docs mentions that you need to use AWE_WINDOW_MEMORY whereas Microsoft site mentions using AWE_WINDOW_SIZE in registry.

This 3GB space will be used by following components:

– The Value for AWE_WINDOW_SIZE- SGA (excluding Buffer Cache)- Overhead for Oracle.exe and DLL’s -Stack space for all threads (Defaults to 1MB/thread, unless orastack is used)- PGA and UGA memory for all user sessions

To understand it, lets take an example. Suppose we need to set memory for a new system using /3GB and /PAE

Out of 2.7GB of addressable space, 1 GB will be used for AW_WINDOW_SIZE. We are left with 1.7 GB which has to be used for SGA shared_pool_size + large_pool_size + java_pool_size + log_buffers +steams_pool_size)

**Please Note that you can not use ASMM i.e SGA_TARGET when using AWE.

AWE_WINDOW_SIZE can be decreased from 1GB to a lower value. This has to be calculated and set judiciously as a lower value can increase mapping/unmapping activity and can also lead to CPU Spinning. Please refer below note for details on calculating minimum AWE_WINDOW_SIZE parameter

Note:225349.1 – Implementing Address Windowing Extensions (AWE) or VLM on Windows Platforms

Other ways of reducing Memory usage

1) Use MTS (Shared Server Configuration) as this will reduce the number of processes and ultimately reducing memory usage.

2) Reduce value for *area_size parameter’s (if using Manual PGA management)

3) You can also use orastack to reduce the memory usage per thread (which defaults to 1 MB)

cmd>orastack oracle.exe 700000

cmd>orastack tnslsnr.exe 700000

cmd>orastack svrmgrl.exe 700000

cmd>orastack sqlplus.exe 700000

This sets the value to 700KB beyond which it is risky to decrease the value.

Issues with AWE

1) To use AWE  we need to use DB_BLOCK_BUFFERS parameter. As we cannot have DB_BLOCK_BUFFERS and DB_CACHE_SIZE parameter being used simultaneouly , we need to unset DB_CACHE_SIZE parameter. This will  mean that you cannot use Automatic Shared Memory Management (ASMM) with AWE i.e You have to unset SGA_TARGET parameter. Similarly you cannot use MEMORY_TARGET (11g ) parameter with AWE. Failure to do so will lead to

ORA-00825: cannot set DB_BLOCK_BUFFERS if SGA_TARGET or MEMORY_TARGET is set

Cause: SGA_TARGET or MEMORY_TARGET set with DB_BLOCK_BUFFERS set.

Action: Do not set SGA_TARGET, MEMORY_TARGET or use new cache parameters, and do not use DB_BLOCK_BUFFERS which is an old cache parameter.

2) Setting Low value for AWE_WINDOW_SIZE can lead to CPU spin issues.

3) Applications doing large amount of I/O will see Performance impact due to Paging.

4) Due to use of AWE, additional Overhead is introduced.

5) Memory beyond 4GB can only be used for Buffer Cache. So In case you are facing Shared pool memory issues or want large number of connections, then AWE cannot help.

Further Readings

Note 225349.1 – Implementing Address Windowing Extensions (AWE) or VLM on Windows Platforms
Note 46053.1 – Windows NT Memory Architecture Overview

http://www.microsoft.com/whdc/system/platform/server/PAE/PAEmem.mspx

http://www.microsoft.com/whdc/system/platform/server/PAE/pae_os.mspx

http://download.oracle.com/docs/cd/B19306_01/win.102/b14304/architec.htm#i1005826