antirez/redis — Issue #354: Fragmentation after deleting keys (question)
Author: ehudros
Created: 2012-02-23 08:36:14+00:00
State: open

We're using Redis in production with a medium sized dataset (~5gb or so).
Our usage requires constantly trimming it by deleting keys that are no longer valid, and the end result of this process is a high fragmentation ratio that grows over time (currently > 1.33 after only one day).
Shouldn't the new jemalloc integration help reduce fragmentation issues?
It's worth noting the deleted objects can be rather large (~5k each).

Here's an info output after running for 1 day. The dataset is smaller since it's been up for only a short time:
redis_version:2.4.2
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
process_id:2314
uptime_in_seconds:162993
uptime_in_days:1
lru_clock:878020
used_cpu_sys:17.86
used_cpu_user:172.63
used_cpu_sys_children:14.00
used_cpu_user_children:64.32
connected_clients:99
connected_slaves:0
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
used_memory:2140949360
used_memory_human:1.99G
used_memory_rss:2845585408
used_memory_peak:2723808776
used_memory_peak_human:2.54G
mem_fragmentation_ratio:1.33
mem_allocator:jemalloc-2.2.1
loading:0
aof_enabled:1
changes_since_last_save:4191729
bgsave_in_progress:0
last_save_time:1329825860
bgrewriteaof_in_progress:0
total_connections_received:6351
total_commands_processed:17530737
expired_keys:151521
evicted_keys:0
keyspace_hits:16280751
keyspace_misses:29234992
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:422512
vm_enabled:0
role:master
aof_current_size:2346155521
aof_base_size:1829291557
aof_pending_rewrite:0
db0:keys=1460092,expires=8927

Thanks :)