MySql教程

【MySQL】MySQL 5.7通过jemalloc管理内存

本文主要是介绍【MySQL】MySQL 5.7通过jemalloc管理内存,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
[root@wallet01 ~]# wget https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2
[root@wallet01 ~]# tar -jxvf jemalloc-5.2.1.tar.bz2 
[root@wallet01 ~]# cd jemalloc-5.2.1

[root@wallet01 jemalloc-5.2.1]# ./configure
[root@wallet01 jemalloc-5.2.1]# make
[root@wallet01 jemalloc-5.2.1]# make install

[root@wallet01 ~]# cat /usr/lib/systemd/system/mysqld.service
# Use this to switch malloc implementation
EnvironmentFile=-/etc/sysconfig/mysql

[root@wallet01 ~]# echo 'LD_PRELOAD=/usr/local/lib/libjemalloc.so' > /etc/sysconfig/mysql   

[root@wallet01 ~]# systemctl restart mysqld

[root@wallet01 ~]# lsof -n | grep jemalloc
mysqld     6272         mysql  mem       REG              253,0    4397600  273167915 /usr/local/lib/libjemalloc.so.2
mysqld     6272  6273   mysql  mem       REG              253,0    4397600  273167915 /usr/local/lib/libjemalloc.so.2
mysqld     6272  6274   mysql  mem       REG              253,0    4397600  273167915 /usr/local/lib/libjemalloc.so.2
这篇关于【MySQL】MySQL 5.7通过jemalloc管理内存的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!