Large Page setup

From Ye Ole Stash
Jump to: navigation, search

Contents

OS setup

/etc/security/limits.conf

  • Below is how I got around the dreaded:
100824 11:57:11  InnoDB: Started; log sequence number 6 3806867600
Warning: Failed to allocate 88080384 bytesx from HugeTLB memory. errno 12
mysql           soft    memlock         unlimited
mysql           hard    memlock         unlimited
 
#If you restart mysql as root you will need this or to run ulimit -l unlimited before restart
root            soft    memlock         unlimited
root            hard    memlock         unlimited

/etc/init.d/mysqld

# Source networking configuration.
. /etc/sysconfig/network
 
ulimit -l unlimited #This is the setting to make it work

Large Page Hack and a 1/2 RHEL/CentOS Init Script

  • Just set pages below
  • NOTE : This also sets your default IO Scheduler if you do not want this just comment out those lines.
#!/bin/bash
 
# chkconfig: 2345 01 99
# description:  MySQL database server large page setup
 
#Ver 0.01 10 minute hack by MisterX Nov 10th 2009 to get large pages set and let the bootup folks know how much MB we are using.
#Ver 0.02 Added Scheduler because there is little reason to NOT use deadline on a dedicated SQL server Comment out if not needed
 
#Set the scheduler
#Options are deadline, noop, cfq, anticipatory cfq is typically default on RHEL
scheduler=deadline
 
for i in /sys/block/sd*; do
    echo $scheduler > $i/queue/scheduler;
done
 
#Set the number of pages
pages=3209
#memused=$($pages * 2048/1024 | bc)
 
#Quick Math hax0r not pretty but she works
memusedKb=`expr $pages \* 2048`
memusedMB=`expr $memusedKb / 1024`
 
case "$1" in
  start)
       echo "Setting Large Pages to" $memusedMB MB
       /bin/echo $pages > /proc/sys/vm/nr_hugepages
       /bin/echo "Default I/O scheduler is set to" $scheduler
       ;;
  stop)
       echo "Setting Large Pages to 0MB"
       /bin/echo "0"  > /proc/sys/vm/nr_hugepages
       ;;
 
    *)
        echo "Usage: $0 {start|stop|restart|reload|condrestart|status}"
        exit 1
esac
Personal tools