Skip to content

Reserving Hugepages for MySql

March 3, 2011

To get a hugepage support for mysql, follow the step given below:

1. Allocate Hugepages for Mysql using following command

[ashwin@wildfire]$ echo 40 > /proc/sys/vm/nr_hugepages

Other way to configure Hugepages

[ashwin@wildfire]$ sysctl -w vm.nr_hugepages=40

2. Check the Status of Allocation

[ashwin@wildfire]$ grep -i huge /proc/meminfo

HugePages_Total: 40

HugePages_Free: 40

HugePages_Rsvd: 0

Hugepagesize: 2048 kB

HugePages_Total : Total Number of Hugepages in pools
HugePages_Free  : Number of free Hugepages(unallocated) in pool
HugePages_Rsvd  : Number of Committed Hugepages to kernel      
Hugepagesize    : Size of Hugepages

3. Get mysql process id using following command

[ashwin@wildfire]$id mysql

uid=27(mysql) gid=27(mysql) groups=27(mysql)

4. Do following changes

[ashwin@wildfire]$ vi /etc/sysctl.conf

Add the following 4 lines :

###########

vm.nr_hugepages=40

vm.hugetlb_shm_group=27

kernel.shmmax = 68719476736

kernel.shmall = 4294967296

#############

[ashwin@wildfire]$ sysctl -p

[ashwin@wildfire]$vi /etc/my.cnf

Add:

##########

[mysqld]

large-pages

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

##########

[ashwin@wildfire]$vi /etc/security/limits.conf

Add:

#########

@mysql soft memlock unlimited

@mysql hard memlock unlimited

##########

5. Restart Mysql server

[ashwin@wildfire]$service mysqld restart

—–

6. Check whether the hugepages are configured to mysql.

[ashwin@wildfire]$ grep -i huge /proc/meminfo

HugePages_Total: 40

HugePages_Free: 40

HugePages_Rsvd: 40

Hugepagesize: 2048 kB

Advertisements

From → Hugepages, Linux

One Comment

Trackbacks & Pingbacks

  1. Activer les HugePages pour MySQL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: