windows和linnux 平臺如何啟用 Large page?
Oracle database在10gR1之後開始支援Large page。我們知道作業系統預設的頁面大小為4k。如果記憶體空間比較大,則需要進行頻繁的頁分配和管理定址動作,管理這些記憶體的消耗就比較大。啟用大頁後,HugePage會使用2M大小的頁面,能減少CPU和記憶體管理方面的開銷,進而提升效能。建議OS記憶體超過16G時,啟用huagepage。
注意:大頁只對SGA元件起作用,對PGA、UGA無效。如果啟用大頁,無需設定pre_page_sga,lock_sga(因為使用hugePage管理的記憶體不能被Swap)。如果使用了HugePage,11g/12c新特性AMM(Automatic Memory Management)就不能使用了,但是ASMM(Automatic Shared Memory Management)可以繼續使用。
如何在Windows上啟用大頁
A.找到下面的選項
10g:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1
ORA_LPENABLE=1 對所有例項啟用大頁
Starting ORACLE instance (normal)
Large page enabled : 1
Large page size : 2097152
Large page request size : 33554432
如何在Linux上啟用大頁
1.Edit the memlock setting in the /etc/security/limits.conf file. The memlock setting is specified in KB and set slightly lesser than the installed RAM. For example, if you have 64GB RAM installed, add the following entries to increase the max locked memory limit:
* soft memlock 60397977
* hard memlock 60397977
2.Login as the oracle user again and run the ulimit -l command to verify the new memlock setting:
$ ulimit -l
60397977
3.Run the following command to display the value of Hugepagesize variable:
$ grep Hugepagesize /proc/meminfo
4.Complete the following procedure to create a script that computes recommended values for hugepages configuration for the current shared memory segments:
a.Create a text file named hugepages_settings.sh
b.Add the following content in the file:
#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
#
# Note: This script does calculation for all shared memory
# segments available when the script is run, no matter it
# is an Oracle RDBMS shared memory segment or not.
# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`
# Start from 1 pages to be on the safe side and guarantee 1 free HugePage
NUM_PG=1
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk {'print $5'} | grep "[0-9][0-9]*"`
do
MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if [ $MIN_PG -gt 0 ]; then
NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
fi
done
# Finish with results
case $KERN in
'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
'2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
*) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac
# End
c.Run the following command to change the permission of the file:
$ chmod +x hugepages_settings.sh
5.Run the hugepages_settings.sh script to compute the values for hugepages configuration:
$ ./hugepages_settings.sh
6.Set the following kernel parameter:
# sysctl -w vm.nr_hugepages=value_displayed_in_step_5
7.To make the value of the parameter available for every time you restart the computer, edit the /etc/sysctl.conf file and add the following entry:
vm.nr_hugepages=value_displayed_in_step_5
8.Restart the server.
$ grep Huge /proc/meminfo
Reference
注意:大頁只對SGA元件起作用,對PGA、UGA無效。如果啟用大頁,無需設定pre_page_sga,lock_sga(因為使用hugePage管理的記憶體不能被Swap)。如果使用了HugePage,11g/12c新特性AMM(Automatic Memory Management)就不能使用了,但是ASMM(Automatic Shared Memory Management)可以繼續使用。
如何在Windows上啟用大頁
A.找到下面的選項
10g:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1
11g:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb11g_home1
ORA_LPENABLE=1 對所有例項啟用大頁
ORA_<ORACLE_SID>_LPENABLE=1 只對特定的例項啟用大頁
Starting ORACLE instance (normal)
Large page enabled : 1
Large page size : 2097152
Large page request size : 33554432
如何在Linux上啟用大頁
1.Edit the memlock setting in the /etc/security/limits.conf file. The memlock setting is specified in KB and set slightly lesser than the installed RAM. For example, if you have 64GB RAM installed, add the following entries to increase the max locked memory limit:
* soft memlock 60397977
* hard memlock 60397977
2.Login as the oracle user again and run the ulimit -l command to verify the new memlock setting:
$ ulimit -l
60397977
3.Run the following command to display the value of Hugepagesize variable:
$ grep Hugepagesize /proc/meminfo
4.Complete the following procedure to create a script that computes recommended values for hugepages configuration for the current shared memory segments:
a.Create a text file named hugepages_settings.sh
b.Add the following content in the file:
#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
#
# Note: This script does calculation for all shared memory
# segments available when the script is run, no matter it
# is an Oracle RDBMS shared memory segment or not.
# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`
# Start from 1 pages to be on the safe side and guarantee 1 free HugePage
NUM_PG=1
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk {'print $5'} | grep "[0-9][0-9]*"`
do
MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if [ $MIN_PG -gt 0 ]; then
NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
fi
done
# Finish with results
case $KERN in
'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
'2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
*) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac
# End
c.Run the following command to change the permission of the file:
$ chmod +x hugepages_settings.sh
5.Run the hugepages_settings.sh script to compute the values for hugepages configuration:
$ ./hugepages_settings.sh
6.Set the following kernel parameter:
# sysctl -w vm.nr_hugepages=value_displayed_in_step_5
7.To make the value of the parameter available for every time you restart the computer, edit the /etc/sysctl.conf file and add the following entry:
vm.nr_hugepages=value_displayed_in_step_5
8.Restart the server.
$ grep Huge /proc/meminfo
Reference
摘自:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25462274/viewspace-2131684/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 如何在 SAP BTP 平臺上啟用 HANA Cloud 服務Cloud
- 【轉】Windows平臺執行Masscan和NmapWindows
- YLazy Web Page Test , 網頁效能測試平臺Web網頁
- Electron構建跨平臺應用Mac/Windows/LinuxMacWindowsLinux
- kms啟用WindowsWindows
- 啟用windows officeWindows
- Windows平臺如何修改監聽的服務名稱?Windows
- golang在windows平臺使用zmqGolangWindowsMQ
- 程式設計和數值計算平臺:MATLAB R2023a Mac啟用版程式設計MatlabMac
- windows如何開機自動啟動某些應用?Windows
- 啟用windows10Windows
- win10如何啟用或關閉windows功能_win10啟用或關閉windows功能的方法Win10Windows
- page-break-before和page-break-after屬性有什麼應用場景?
- JetBrains CLion 2024.2 (macOS, Linux, Windows) - C 和 C++ 跨平臺 IDEAIMacLinuxWindowsC++IDE
- 在windows平臺上如何做到git多ssh-key相容WindowsGit
- windows10商店在哪裡_windows10的應用商店如何開啟Windows
- 執行緒同步(windows平臺):事件執行緒Windows事件
- JetBrains DataGrip 2024.2 (macOS, Linux, Windows) - 資料庫和 SQL 跨平臺 IDEAIMacLinuxWindows資料庫SQLIDE
- 如何做跨平臺業務流程自動化(Windows,Moible,Web)WindowsWeb
- 鴻蒙專案實戰(五):修改專案啟用頁Page鴻蒙
- 跨平臺.NET IDE整合開發:JetBrains Rider for mac啟用版IDEAIMac
- Rider for mac(跨平臺.NET IDE整合開發)2023.2.3啟用版IDEMac
- Page Ability 之間的跳轉概念和應用分享
- Linux 中如何啟用和禁用網路卡?Linux
- 執行緒同步(windows平臺):互斥物件執行緒Windows物件
- windows平臺,eclipse安裝maven外掛WindowsEclipseMaven
- Windows平臺RTMP多例項推送探討Windows
- WINDOWS平臺上擴充套件SGA (zt)Windows套件
- Windows搭建SourceTree、Git程式碼管理平臺WindowsGit
- Windows平臺下MySQL常用操作與命令WindowsMySql
- MATLAB R2023a for Mac(程式設計和數值計算平臺) v9.14.0.2337262啟用版MatlabMac程式設計
- Windows下x86和x64平臺的Inline Hook介紹WindowsinlineHook
- 開源物聯網平臺和智慧家居平臺
- BitMart啟用平臺幣新玩法,首批點亮10餘交易對
- 微信平臺應用
- UEFI雙啟動Windows和LinuxWindowsLinux
- 執行緒同步(windows平臺):訊號量執行緒Windows
- 執行緒同步(windows平臺):臨界區執行緒Windows
- Windows平臺上使用noinstall方式部署MySQL 8.0WindowsMySql