Home Database Mysql Tutorial Linux HugePages及MySQL大页配置_MySQL

Linux HugePages及MySQL大页配置_MySQL

Jun 01, 2016 pm 01:31 PM
linux

bitsCN.com

Linux HugePages及MySQL大页配置

 

     ㈠ HugePages简介

     

        HugePages是kernel 2.6引入以便适应越来越大的物理内存

        在Linux下、page size默认是4K、如果使用HugePages、默认是2M

     

        再看2个术语:

        page table 映射表:物理内存和swap的对应关系、访问内存是先读page table、根据表里的映射关系操作

        TLB :cpu cache组件、缓存部分page table以提高转换速度

 

     ㈡ MySQL 配置大页

     

       好处

     

         ① 提高TLB的命中率

         ② 利用HugePages不会被Swap 的特性保证MySQL内存不会被交换到Swap中

       

       目前在MySQL中HugePages只被InnoDB所支持

       

       以下简单介绍其配置流程

       

       ⑴ 配置前:[plain] [root@cdio ~]# cat /proc/meminfo | grep -i huge  HugePages_Total:     0  HugePages_Free:      0  HugePages_Rsvd:      0  Hugepagesize:     2048 kB         ⑵ 设置大页数量、每页通常2M、20个就40M、系统要有足够的内存待分配[plain] [root@obe11g ~]# echo 20 > /proc/sys/vm/nr_hugepages         ⑶ 增加最大共享内存段的大小、本例12G[plain] [root@obe11g ~]# echo 1560281088 > /proc/sys/kernel/shmmax         ⑷ 增加共享内存的大小、每页4K[plain] [root@obe11g ~]# echo 4194304 > /proc/sys/kernel/shmall         ⑸ 将mysql用户所属组添加到系统内核中[plain] [root@obe11g ~]# more /proc/sys/vm/hugetlb_shm_group  0  [root@obe11g ~]# id mysql  uid=501(mysql) gid=501(dba) groups=501(dba)  [root@obe11g ~]# echo 501 > /proc/sys/vm/hugetlb_shm_group         ⑹ 再次确认配置情况[plain] [root@obe11g ~]# cat /proc/meminfo | grep -i huge  HugePages_Total:    20  HugePages_Free:     20  Hugepagesize:     4096 kB         ⑺ 设置max locked memory[plain] [root@obe11g ~]# cat /etc/security/limits.conf  | grep -i mysql  mysql            hard    memlock         unlimited  mysql            soft    memlock         unlimited         ⑻ 配置 my.cnf[plain] [mysqld]  large-pages         ⑼ 启动mysqld            ⑽ 观察HugePages 使用情况[plain] [root@obe11g ~]# grep -i huge /proc/meminfo  HugePages_Total:    20  HugePages_Free:     16  Hugepagesize:     4096 kB  
Copy after login

 


bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Android TV Box gets unofficial Ubuntu 24.04 upgrade Android TV Box gets unofficial Ubuntu 24.04 upgrade Sep 05, 2024 am 06:33 AM

Android TV Box gets unofficial Ubuntu 24.04 upgrade

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

deepseek web version entrance deepseek official website entrance

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

How to install deepseek

BitPie Bitpie wallet app download address BitPie Bitpie wallet app download address Sep 10, 2024 pm 12:10 PM

BitPie Bitpie wallet app download address

BITGet official website installation (2025 beginner's guide) BITGet official website installation (2025 beginner's guide) Feb 21, 2025 pm 08:42 PM

BITGet official website installation (2025 beginner's guide)

Detailed explanation: Shell script variable judgment parameter command Detailed explanation: Shell script variable judgment parameter command Sep 02, 2024 pm 03:25 PM

Detailed explanation: Shell script variable judgment parameter command

Zabbix 3.4 Source code compilation installation Zabbix 3.4 Source code compilation installation Sep 04, 2024 am 07:32 AM

Zabbix 3.4 Source code compilation installation

Ouyi okx installation package is directly included Ouyi okx installation package is directly included Feb 21, 2025 pm 08:00 PM

Ouyi okx installation package is directly included

See all articles