Redis-4.0.11 - Lazy Freeing and activedefrag Reg.

147 views
Skip to first unread message

Sairam M P

unread,
Aug 21, 2018, 5:25:47 PM8/21/18
to Redis DB
Hi,

We were testing the latest stable redis-4.0.11 in order to migrate our production servers. During our testing happened to notice that there were these - lazy freeing and activedefrag options were introduced in the latest redis. Those are really nice options when it comes to memory management and latency. 

We tried to enable these configs and tried to check the performance of the redis server, but unfortunately, the freeing of memory is done in sync with redis client commands and there were no activedefrag running. 

We are running the redis server in CentOS Linux release 7.4.1708 (Core) and complied the redis source using the following commands : 

cd deps
make *
cd ..
make
make test
mkdir -p /sairam/redis
make PREFIX=/sairam/redis install

Hope the abvoe compilation should using the jemalloc that was bundled with redis source.

We enabled the below configs both dynamically and also before the redis is started(through redis.conf) but of no use :

activedefrag yes

lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
slave-lazy-flush yes

The size of the data set that we tested with was 2.5 GB. We tested for both eviction and flushdb/flushall cases with 2.5GB of data. 

Eviction : The maxmemory configured for the redis server is 2.5 GB, and when it was already full (2.5GB), we will keep inserting new values to redis and we were able to see the increase in evicted_keys but none of the below options got enabled :

active_defrag_running:0
lazyfree_pending_objects:0

Flushdb/Flushall : The flushdb/flushall command took ~4 secs and haven't retured as soon it was attempted, which meant it was performed in sync in the client thread and were able to see the reduction in the server memory usage of the command got succeeded. It doesn't looked like the flush/eviction happened in the background lazily. Also there was no change in the above info variables.

Note : The mem_fragmentation_ratio was 1.18 when we enabled activedefrag but still it didn't got reduced even after hours.

Are we missing something here !? Kindly help us in enabling lazy freeing and activedefrag.

Thanks in advance.

-Sairam.

Юрий Соколов

unread,
Aug 22, 2018, 10:16:50 AM8/22/18
to Redis DB
 The mem_fragmentation_ratio was 1.18 when we enabled activedefrag but still it didn't got reduced even after hours.

1.18 is really small fragmentation. Our redis servers typical fragmentation is around 1.3 and doesn't decrease with activedefrag enabled.
Note: there is five options that control activedefrag behavior.

Reply all
Reply to author
Forward
0 new messages