hugepages優化記憶體原理與優點

lovehewenyu發表於2014-12-18
hugepages優化記憶體原理與優點


hugepages 優化=>SGA ,PGA不優化


一、hugepages優化原理:
1.1 減少了PTE的使用,進而增加了LTB的命中率
PTE=>page the entry
LTB=>Translation Lookaside Buffer


1.2 大頁與普通的區別
hugepage size from 2m to 256m
normal size 4k


1.3 官方介紹:hugepages
http://docs.oracle.com/cd/E11882_01/install.112/e41961/memry.htm#CWLIN383


What HugePages Provides


HugePages is a feature integrated into the Linux kernel with release 2.6. It is a method to have larger pages where it is useful for working with very large memory. It can be useful for both 32-bit and 64-bit configurations. HugePage sizes vary from 2MB to 256MB, depending on the kernel version and the hardware architecture. For Oracle Databases, using HugePages reduces the operating system maintenance of page states, and increases TLB (Translation Lookaside Buffer) hit ratio.


Without HugePages, the operating system keeps each 4 KB of memory as a page, and when it is allocated to the SGA, then the lifecycle of that page (dirty, free, mapped to a process, and so on) must be kept up to date by the operating system kernel.


With HugePages, the operating system page table (virtual memory to physical memory mapping) is smaller, since each page table entry is pointing to pages from 2 MB to 256 MB. Also, the kernel has fewer pages whose lifecyle must be monitored.


For example, if you use HugePages with 64-bit hardware, and you want to map 256 MB of memory, you may need one page table entry (PTE). If you do not use HugePages, and you want to map 256 MB of memory, then you must have 256 MB * 1024 KB/4 KB = 65536 PTEs.




二、hugepages使用的優點
http://docs.oracle.com/cd/E11882_01/server.112/e10839/appi_vlm.htm#UNXAR395


The following are the advantages of using HugePages:


Increased performance through increased TLB hits.


Pages are locked in memory and are never swapped out which guarantees that shared memory like SGA remains in RAM.


Contiguous pages are preallocated and cannot be used for anything else but for System V shared memory (for example, SGA)


Less bookkeeping work for the kernel for that part of virtual memory due to larger page sizes

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26442936/viewspace-1372443/,如需轉載,請註明出處,否則將追究法律責任。

相關文章