数据库
首页 > 数据库> > 【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

标签:5.2,lib,wallet01,5.7,usr,MySQL,jemalloc,root
来源: https://blog.51cto.com/u_13598811/2913719