Installation guide
If the server shows sporadic swap activity or swap activity for a short period time at certain intervals, either add
more swap space or more RAM. If swap usage is already very large ( do not confuse with constant swapping),
then more RAM is recommended.
Large Memory Optimization (Huge Pages)
Physical memory is partitioned into pages which are the basic unit of memory management. When a Linux pro-
cess accesses a virtual address, the CPU must translate it into a physical address. Therefore, for each Linux pro-
cess the kernel maintains a page table which is used by the CPU to translate virtual addresses into physical ad-
dresses. But before the CPU can do the translation it has to perform several physical memory reads to retrieve
page table information. To speed up this translation process for future references to the same virtual address, the
CPU saves information for recently accessed virtual addresses in its Translation Lookaside Buffers (TLB)
which is a small but very fast cache in the CPU. The use of this cache makes virtual memory access very fast.
Since TLB misses are expensive, TLB hits can be improved by mapping large contiguous physical memory re-
gions by a small number of pagesso fewer TLB entries are required to cover larger virtual address ranges. The
default page size for x86 CPUs is 4KB. Modern CPUs support larger pages: 2MB, 4MB and even 1GB. In
Linux these pages are called “huge pages”. They can significantly reduce the page table size and memory man-
agement overhead. The memory savings and performance gains may be very significant for Oracle database
servers with a large Shared Global Area (SGA), an area of memory shared by Oracle processes. The size of the
SGA has a significant impact to Oracle's performance since it contains database buffer cache and more.
For example, a database server configured with the default 4KB memory pages and a 32GB SGA is using
12MB of kernel memory per Oracle process for page tables (32GB/4KB * 12 bit per Page Table Entry (PTE) =
12MB). If this server has 1000 sessions, they consume approximately 12GB of RAM just for page tables. It is
important to note that every connected session (ps -ef | grep oracle | wc -l , minus about 8 core
processes) results in a full pagemap of the SGA. Needless to say, the TLB cache in this case is completely
overwhelmed and the database performance suffers.
The same server configured with 2MB huge pages is using only 24KB per process (32GB/2MB * 12 bit per
PTE = 24KB) or approximately 24MB for 1000 sessions. Now one PTE entry in TLB covers 2MB instead of
4KB. The TLB miss rate is significantly decreased because touching address A, A+4KB, A+8KB, ... up to
A+2MB no longer cause expensive TLB misses.
Better performance is also achieved because huge pages are “pinned” in RAM, meaning they cannot be
swapped out and the kernel does not spent cycles having to “think” about swapping them out.
Huge Pages in RHEL5
The Huge Pages feature in Red Hat Enterprise Linux 5 allows the dynamic allocation of large memory pages
without a reboot. However, if memory gets too fragmented in Red Hat Enterprise Linux 5, allocation of physi-
cally contiguous memory pages can fail and a reboot may become necessary.
The advantages of Huge Pages are:
Increased performance through increased TLB hits
Pages are locked in memory rather than swapped which guarantees that shared memory, such as SGA,
remains in RAM
14 | www.redhat.com