Linux配置hugepage
对于内存较大的Oracle数据库server,配置HugePage是非常有必要的,以下是配置Huge的步骤:
我的环境:
OS:CentOS release 6.4 (Final)
Oracle:11.2.0.4 RAC
1. 设置memlock
编辑/etc/security/limits.conf
添加:
* Soft memlock 稍小于RAM值
* hard memlock 稍小于RAM值
Memlock值大于sga没关系的,所以我们能够设置这个值在我们想要的SGA size和物理内存size之间,这个值得单位是kb。
[root@node1 ~]# grep -i memtot /proc/meminfo
MemTotal: 132250576 kB
我们物理内存大小126G,因此我能够设置memlock为100G。
在2个节点设置:
[root@node1 ~]# tail -2 /etc/security/limits.conf
* soft memlock 104857600
* hard memlock 104857600
设置完成后,以Oracle用户登录验证:
node2-> ulimit -l
104857600
2.
禁用AMM特性:
禁用AMM特性须要将memory_max_target, memory_max_target2个參数重置,而不不过设置为0。最好的办法是创建一个pfile,在pfile中将这2个參数删除,再依据这个pfile创建spfile.
主要内存參数设置为:
node1->
node1-> grep target /tmp/init.ora
*.pga_aggregate_target=1572864000
*.sga_target=64424509440
SQL> create spfile from pfile='/tmp/init.ora';
File created.
SQL> startup force
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
Additional information: -134217728
Additional information: 1
SQL>
出现这个报错是由于shmall设置的太小。
Shmall表示共享内存的总大小,单位为pagesize的大小。
依据我的配置,最大能支持8G的SGA:
node1-> getconf PAGE_SIZE
4096
node1-> cat /proc/sys/kernel/shmall
2097152
改动shmall并又一次启动数据库。改动的方法非常easy。编辑/etc/sysctl.conf:
kernel.shmall= 16252928
就可以。
改动完成kernel.shmall,此时能够重新启动数据库。
SQL> startup nomount pfile='/tmp/init.ora';
ORACLE instance started.
Total System Global Area 6.4137E+10 bytes
Fixed Size 2269072 bytes
Variable Size 6979321968 bytes
Database Buffers 5.7043E+10 bytes
Redo Buffers 112762880 bytes
SQL>
SQL>
DB启动后又一次创建spfile:
SQL> create spfile='+OCR/sszgdb/spfilesszgdb.ora' from pfile='/tmp/init.ora';
File created.
SQL>
3.
依据Oracle的脚本计算hugepage大小(计算时要确保Oracle已经启动)。也可自己计算:
Press Enter to proceed...
Recommended setting: vm.nr_hugepages = 30739
node1->
4.
依据脚本的计算值在2个节点编辑/etc/sysctl.conf
增加vm.nr_hugepages = 30739
[root@node2 ~]# grep -i huge /proc/meminfo
AnonHugePages: 602112 kB
HugePages_Total: 30739
HugePages_Free: 30739
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB停止数据库实例
5.
重新启动server,一般重新启动server之后DB也自己主动启动了。
server和DB重新启动后能够通过下面命令验证大页的使用情况:
grep -i Hugepages /proc/meminfo
此时查看Oracle的alert日志,也能够发现:
Starting ORACLE instance (normal)
************************ Large Pages Information *******************
Per process system memlock (soft) limit = UNLIMITED
Total Shared Global Region in Large Pages = 58 GB (96%)
Large Pages used by this instance: 29761 (58 GB)
Large Pages unused system wide = 24 (48 MB)
Large Pages configured system wide = 30739 (60 GB)
Large Page size = 2048 KB
RECOMMENDATION:
Total System Global Area size is 60 GB. For optimal performance,
prior to the next instance restart:
1. Increase the number of unused large pages by
at least 936 (page size 2048 KB, total size 1872 MB) system wide to
get 100% of the System Global Area allocated with large pages
能够发现sga并没有所有放在大页里,这样可能对性能带来负面影响。Oracle建议我们再添加936个大页,可见Oracle的大页脚本计算并不准确,我们须要添加大页数量,并设置參数Use_large_pages=only。该參数确保Oracle的共享内存所有使用大页。
再重新启动DB,此时alert日志:
************************ Large Pages Information *******************
Parameter use_large_pages = ONLY
Per process system memlock (soft) limit = 100 GB
Total Shared Global Region in Large Pages = 60 GB (100%)
Large Pages used by this instance: 30721 (60 GB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 31675 (62 GB)
Large Page size = 2048 KB
能够发现sga所有使用了大页了。
另需确保环境变量DISABLE_HUGETLBFS unset,该变量会禁用Oracle使用Hugepage
附:计算HugePage大小的脚本:
#!/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.
#
# This script is provided by Doc ID 401749.1 from My Oracle Support
# http://support.oracle.com
# Welcome text
echo "
This script is provided by Doc ID 401749.1 from My Oracle Support
(http://support.oracle.com) where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments. Before proceeding with the execution please note following:
* For ASM instance, it needs to configure ASMM instead of AMM.
* The 'pga_aggregate_target' is outside the SGA and
you should accommodate this while calculating SGA size.
* In case you changes the DB SGA size,
as the new SGA will not fit in the previous HugePages configuration,
it had better disable the whole HugePages,
start the DB with new SGA size and run the script again.
And make sure that:
* Oracle Database instance(s) are up and running
* Oracle Database 11g Automatic Memory Management (AMM) is not setup
(See Doc ID 749851.1)
* The shared memory segments can be listed by command:
# ipcs -m
Press Enter to proceed..."
read
# 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}'`
if [ -z "$HPG_SZ" ];then
echo "The hugepages may not be supported in the system where the script is being executed."
exit 1
fi
# Initialize the counter
NUM_PG=0
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | cut -c44-300 | awk '{print $1}' | 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
RES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`
# An SGA less than 100MB does not make sense
# Bail out if that is the case
if [ $RES_BYTES -lt 100000000 ]; then
echo "***********"
echo "** ERROR **"
echo "***********"
echo "Sorry! There are not enough total of shared memory segments allocated for
HugePages configuration. HugePages can only be used for shared memory segments
that you can list by command:
# ipcs -m
of a size that can match an Oracle Database SGA. Please make sure that:
* Oracle Database instance is up and running
* Oracle Database 11g Automatic Memory Management (AMM) is not configured"
exit 1
fi
# Finish with results
case $KERN in
'2.2') echo "Kernel version $KERN is not supported. Exiting." ;;
'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" ;;
'3.8') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
esac
# End
Linux配置hugepage的更多相关文章
- 为Linux版本Oracle 11gR2配置HugePage
HugePage是Oracle在Linux版本下一种性能优化手段.对于共享内存区域(SGA)的数据库系统,Oracle通常都推荐在操作系统层面配置上HugePage,为Oracle实例准备更大的可用共 ...
- linux配置网卡IP地址命令详细介绍及一些常用网络配置命令
linux配置网卡IP地址命令详细介绍及一些常用网络配置命令2010-- 个评论 收藏 我要投稿 Linux命令行下配置IP地址不像图形界面下那么方 便,完全需要我们手动配置,下面就给大家介绍几种配置 ...
- linux配置java环境变量(详细)
linux配置java环境变量(详细) 本文完全引用自: http://www.cnblogs.com/samcn/archive/2011/03/16/1986248.html 一. 解压安装jdk ...
- linux配置hosts
linux配置hosts linux下配置hosts和windows下其实就是一样的,找到文件在哪里就好 sudo vim /etc/hosts
- linux配置java环境变量
linux配置java环境变量(详细) 一. 解压安装jdk 在shell终端下进入jdk-6u14-linux-i586.bin文件所在目录, 执行命令 ./jdk-6u14-linux-i586. ...
- Linux 配置本地yum源
Linux 配置无网络状态利用yum安装软件 在有网络的情况下安装软件只需一条yum install xxx命令,例如安装gcc只需一条指令:yum install gcc 那么在没有网络的情况下该 ...
- Linux配置支持高并发TCP连接(socket最大连接数)
Linux配置支持高并发TCP连接(socket最大连接数) Linux配置支持高并发TCP连接(socket最大连接数)及优化内核参数 2011-08-09 15:20:58| 分类:LNMP&a ...
- Linux配置完iptables后,重启失效的解决方案
Linux配置完iptables后,重启失效的解决方案 因为只有root用户才可访问1024以下的端口,非root用户登陆是不能启用80端口的.web service 往往启动1024以上的端口,并通 ...
- linux配置java环境变量(转)
linux配置java环境变量(详细) 一. 解压安装jdk 在shell终端下进入jdk-6u14-linux-i586.bin文件所在目录, 执行命令 ./jdk-6u14-linux-i586. ...
随机推荐
- LN : leetcode 690 Employee Importance
lc 690 Employee Importance 690 Employee Importance You are given a data structure of employee inform ...
- 利用eclipse调试JDK源码
先看效果图 综合网上各种教程,总结如下 新建 D:/jdk/src .D:/jdk/debug 目录 src存放源码 debug存放编译结果 将 %JAVA_HOME%/src.zip 解压到 D:/ ...
- Selenium基于Python web自动化基础一 -- 基础汇总及简单操作
Selenium是UI层WEB端的自动化测试框架,也是目前市面上比较流行的自动化测试框架. ui层自动化测试本质是什么?模拟用户的真实操作行为. 基础汇总: 导入所需要的模块 from seleniu ...
- dede手机访问网站跳转到手机端模板
如何手机访问的时候跳转到自己的手机端模板,这时候需要一个js跳转代码:当手机访问的时候直接跳转到手机端 那手机端前提要有手机端的模板 <script> if(navigator.platf ...
- Farseer.net轻量级开源框架 中级篇:DbFactory数据工厂
导航 目 录:Farseer.net轻量级开源框架 目录 上一篇:Farseer.net轻量级开源框架 中级篇: 执行SQL语句 下一篇:Farseer.net轻量级开源框架 中级篇: 数据绑定 ...
- MySql(四)Select条件查询
select条件查询的格式如下: SELECT 查询列表FROM 表名WHERE 筛选条件:123456根据筛选条件可以分为以下几类: 按照条件按表达式进行筛选 常用条件运算符如下:> .< ...
- WEB前端响应式布局之BootStarp使用
1.Bootstrap简介:1. 概念: 一个前端开发的框架,Bootstrap,来自 Twitter,是目前很受欢迎的前端框架.Bootstrap 是基于 HTML.CSS.JavaScript 的 ...
- vue基础---介绍
(1)声明式渲染 Vue.js 的核心是采用简洁的模板语法来声明式地将数据渲染进 DOM 的系统: ①文本 <div id="app"> {{ message }} & ...
- 15Microsoft SQL Server 数据库维护
Microsoft SQL Server 数据库维护 2.6.1数据库联机与脱机 --联机:该状态为数据库正常状态,也就是我们常看到的数据库的状态,该状态下的数据库处于可操作状态,可以对数据库进行任何 ...
- js识别手机访问自动跳转到相应页面
/* * 智能机浏览器版本信息: * */ var browser={ versions:function(){ var u = navigator.userAgent, app = navigato ...