0

I recently installed jemmaloc 3.6.0-11 using apt-get install libjemalloc1 on my ubuntu server 18.04

The installation were successfull, but when I check using

pt-mysql-summary | grep -A5 -i "memory management"

I get

    Memory management library 
    jemalloc is not enabled in mysql config 
for process with id 89539 
    The End 

How I can do this ?

I am using Mysql 5.7.26

Marcello Miorelli
  • 17,274
  • 53
  • 180
  • 320
Ekkai Imwe
  • 11
  • 7

2 Answers2

2

I had to do a bit more to get this to work. This worked for me. First the problem:

Starting in Ubuntu 18.04, Percona / MySQL are configured thru systemd This means setting malloc-lib= in my.cnf no longer works! It also no longer works "out of the box" (at least not for me).

So how do we get this to work?

  1. Create an override.conf file to load jemalloc. This is done using systemd controls.

    sudo systemctl edit mysql

  2. This will pop up an editor. Unless this has been done before, odds are this will be a blank new file. Enter this in:

    [Service]

    Environment="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1"

  3. Then sudo systemctl daemon-reload which loads the override.conf

  4. Then sudo systemctl restart mysql which restarts the server

Resources:

The instructions on how to verify the jemalloc is actually being used are key.

0

found it

it turned out I need to add a line Environment=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1

in /lib/systemd/system/mysql.service

what a headache hahaha

Ekkai Imwe
  • 11
  • 7