MySQL启用hugepage及相关监控

http://www.mysqlsky.com/201202/mysql_enable_hugepage_howto

1.确认支持huge page






grep -i page /proc/meminfo



2.修改预分配的hugepages大小






sysctl -w vm.nr_hugepages=18000#这里会卡一下grep -i huge /proc/meminfo



3.查看mysql用户的组信息






id mysqluid=502(mysql) gid=501(dba) groups=501(dba)

4.配置使用大页内存的用户组






sysctl -w  vm.hugetlb_shm_group=501

5.修改ulimit






vi /etc/security/limits.conf@mysql soft memlock unlimited@mysql hard memlock unlimited

6.修改/etc/sysconfig.conf






# Increase the amount of shmem allowed per segment# This depends upon your memory, remember yourkernel.shmmax = 68719476736# Increase total amount of shared memory.kernel.shmall = 4294967296

7.修改my.cnf






[mysqld]large_pages

8.监测TLB miss的情况






sudo perf stat -e dTLB-load-misses -p `pidof /u01/mysql/bin/mysqld`

9.监测内存页面交换






sar -B 10

—-

开启大页内存的好处:

1.减少内存置换

2.减少TLB miss次数

3.减少swap

你可能感兴趣的:(mysql)