合 Oracle数据库配置大页
简介
有关大页和透明大页的介绍:https://www.xmmup.com/linux-biaozhundayehetoumingdaye.html
在Linux中配置hugepage可以提高oracle的性能,减少oracle sga的页交换,类似于aix中的lagepage。
当你主机的物理内存为64G,设SGA>=32G时,建议开启大页。
要查看是否存在大页表的问题,可以使用如下的命令来检查页表的大小:
1 2 | [root@lhrdb ~]# cat /proc/meminfo | grep PageTables PageTables: 1932200 kB |
如果发现页表的大小不是几十兆,而是达到了1GB以上,就说明数据库存在此问题。基于共享内存的多进程架构的程序都会存在此问题。
Oracle 官方是推荐我们使用 Huge pages 的,它拥有以下的好处:
Larger Page Size and Less # of Pages: Default page size is 4K whereas the HugeTLB size is 2048K. That meansthe system would need to handle 512 times less pages.
Reduced Page Table Walking:Since a HugePage covers greater contiguous virtual address range than a regularsized page, a probability of getting a TLB hit per TLB entry with HugePages arehigher than with regular pages. This reduces the number of times page tablesare walked to obtain physical address from a virtual address.
Less Overhead for MemoryOperations: On virtual memory systems (any modern OS) each memory operation isactually two abstract memory operations. With HugePages, since there are lessnumber of pages to work on, the possible bottleneck on page table access isclearly avoided.
Less Memory Usage: From theOracle Database perspective, with HugePages, the Linux kernel will use lessmemory to create pagetables to maintain virtual to physical mappings for SGAaddress range, in comparison to regular size pages. This makes more memory tobe available for process-private computations or PGA usage.
No Swapping: We must avoidswapping to happen on Linux OS at all Document 1295478.1. HugePages are notswappable (whereas regular pages are). Therefore there is no page replacementmechanism overhead. HugePages are universally regarded as pinned.
No 'kswapd' Operations: kswapdwill get very busy if there is a very large area to be paged (i.e. 13 millionpage table entries for 50GB memory) and will use an incredible amount of CPUresource. When HugePages are used, kswapd is not involved in managing them. Seealso Document 361670.1
Huge pages 和 Oracle 11g新 特性 AMM ( Automatic Memory Management )是相互冲突的,但是 ASMM ( Automatic Shared Memory Management )仍然可以继续使用。
Oracle 官方推荐我们使用 标准大页(Huge pages ),但是却建议我们关闭 透明大页(Transparent Huge pages) ,因为透明大页存在一些问题:
- 在 RAC 环境下 透明大页( TransparentHugePages )会导致异常节点重启,和性能问题;
在单机环境中,透明大页( TransparentHugePages ) 也会导致一些异常的性能问题;
如何关闭透明大页请参考:https://www.xmmup.com/linux-biaozhundayehetoumingdaye.html
如何配置开启大页
参考:HugePages on Oracle Linux 64-bit (Doc ID 361468.1)