Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Configure MSYQL on LINUX platform to support large page memory

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Operating system:

[root@oradb ~] # cat / etc/redhat-release

Red Hat Enterprise Linux Server release 6.4 (Santiago)

Database:

Mysql > select version ()

+-+

| | version () |

+-+

| | 5.6.27 |

+-+

1 row in set (0.00 sec)

In this test, we set up 400MB's large page memory for MYSQL to use.

1. Turn off anonymous large page memory

The following command output as [always] indicates that anonymous large page memory is enabled and needs to be closed.

[root@oradb ~] # cat / sys/kernel/mm/transparent_hugepage/enabled

[always] never

Adding transparent_hugepage=never to the / boot/grub/grub.conf file forbids anonymous large page memory

Default=0

Timeout=5

Splashimage= (hd0,0) / grub/splash.xpm.gz

Hiddenmenu

Title Red Hat Enterprise Linux (2.6.32-358.el6.x86_64)

Root (hd0,0)

Kernel / vmlinuz-2.6.32-358.el6.x86_64 ro root=UUID=bfd79be7-6446-4864-bc1f-ad15d4b242ad rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet transparent_hugepage=never

Initrd / initramfs-2.6.32-358.el6.x86_64.img

Restart the operating system and check to see if anonymous large pages are disabled

[root@oradb ~] # cat / sys/kernel/mm/transparent_hugepage/enabled

Always [never] # has successfully disabled anonymous large page memory

[root@oradb ~] # cat / proc/meminfo | grep-I huge

AnonHugePages: 0 kB # AnonHugePages is zero, indicating that anonymous large page memory has been successfully disabled

HugePages_Total: 0

HugePages_Free: 0

HugePages_Rsvd: 0

HugePages_Surp: 0

Hugepagesize: 2048 kB # the page size of large page memory is 2MB

two。 Configure 400MB's large page memory in kernel parameters

# vi / etc/sysctl.conf

# config hugepages

# vm.nr_hugepages = memory to be used by MYSQL / page size of large pages = 400,000,200

Vm.nr_hugepages=200

Vm.hugetlb_shm_group=507 # 507 is the group ID to which MYSQL belongs

[root@oradb ~] # sysctl-a | grep shmmax

Kernel.shmmax = 68719476736

[root@oradb ~] # sysctl-a | grep shmall

Kernel.shmall = 4294967296

The operating system has set kernel.shmmax=64GB,kernel.shmall=4GB by default, which has surpassed us.

The amount of memory required (400MB) so there is no need to adjust these two parameters.

3. Reload kernel parameters with LINUX

Sysctl-p

4. Set MYSQL user limit memory lock 400MB

Vi / etc/security/limits.conf

Mysql soft memlock 409600 # unit is KB, what we configure is MYSQL user limit memory lock 400MB

Mysql hard memlock 409600

5. Configure MYSQL to enable large page memory

[mysqld]

Large-pages

6. Start MYSQL

/ app/oracle/oradata2/mysql-5.6.27/bin/mysqld_safe-defaults-file=/app/oracle/oradata2/mysql-5.6.27/my.cnf-user=mysql &

Check that large pages of memory have been used

[root@oradb mysql-5.6.27] # cat / proc/meminfo | grep-I huge

AnonHugePages: 0 kB

HugePages_Total: 200

HugePages_Free: 197

HugePages_Rsvd: 67

HugePages_Surp: 0

Hugepagesize: 2048 kB

HugePages_Total is the number of pages allocated, which is multiplied by Hugepagesize to get the allocated memory size. 2002Action1024 is about 200MB.

HugePages_Free is the number of Hugepages that has never been used. Even though the MYSQL INNDOB buffer pool has allocated this part of memory, if there is no actual write

So what I see is still Free's. This is easy to misunderstand.

HugePages_Rsvd is the number of page that has been allocated and reserved but not yet used. When MYSQL is just started, most of the memory should be Reserved and Free, with

With the use of INNDOB buffer pools, both Reserved and Free will continue to decrease.

HugePages_Free-HugePages_Rsvd this part of the memory is not used, if there are no other MYSQL instances, this part of memory may never be used, that is, wasted.

The large page memory that was not used in this test was 197-67=130*2=260MB.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report