I have a Redis cluster that is constantly at a memory fragmentation ratio of about 2.
I was trying to enable activedefrag
by running CONFIG SET activedefrag yes
in redis-cli
, but I received the error message:
(error) ERR Invalid argument 'yes' for CONFIG SET 'activedefrag' - Active defragmentation cannot be enabled: it requires a Redis server compiled with a modified Jemalloc like the one shipped by default with the Redis source distribution
The redis-server package shipped with Ubuntu 22.04 is 6.0 and the version string looks like it was compiled with jemalloc.
# redis-server --version
Redis server v=6.0.16 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=a3fdef44459b3ad6
ldd confirms that it is linked to libjemalloc.
# ldd `which redis-server`
...
libjemalloc.so.2 => /lib/x86_64-linux-gnu/libjemalloc.so.2 (0x00007f0428b26000)
When setting the option in the config file redis-server fails to start with a similar error message.
Is there any option I am missing or do I need to compile Redis myself to be able to use defragmentation? I could not find any configuration option to "enable" jemalloc.