-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63d442a
commit 09772b7
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
## This program is free software: you can redistribute it and/or modify | ||
## it under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation, either version 3 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this file. If not, see <http://www.gnu.org/licenses/>. | ||
## | ||
# | ||
# Script installation: | ||
#echo "cd /etc/bacula/scripts && git clone https://github.com/MykolaPerehinets/auditlinuxsystem.git" | ||
# | ||
# Script function: | ||
# Configuring HugePages for Oracle on Linux (x86-64). Linux bash script to compute values for the | ||
# recommended HugePages/HugeTLB configuration | ||
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/performance_tuning_guide/s-memory-transhuge | ||
# https://oracle-base.com/articles/linux/configuring-huge-pages-for-oracle-on-linux-64 | ||
# https://www.cnblogs.com/zhangshengdong/p/11889148.html | ||
# Please use for this action root account! | ||
# | ||
# 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. | ||
# | ||
# | ||
# Script Submitted and Deployment in Production environments by: | ||
# Mykola Perehinets (mperehin) | ||
# Tel: +380 67 772 6910 | ||
# Mailto: [email protected] | ||
# | ||
####################################################################################################################### | ||
# Script modified date | ||
Version=25012022 | ||
# | ||
####################################################################################################################### | ||
# | ||
# 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' | '3.8' | '3.10' | '4.1' | '4.14' ) echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;; | ||
*) echo "Unrecognized kernel version $KERN. Exiting." ;; | ||
esac | ||
# | ||
# End | ||
|