Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@eccyan
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eccyan/89de903b75feb3ffe4d8 to your computer and use it in GitHub Desktop.
Save eccyan/89de903b75feb3ffe4d8 to your computer and use it in GitHub Desktop.
Redis のメモリが足りなくなった時にどうやってチューニングしたか ref: http://qiita.com/eccyan/items/e8cc56948a00d6aad0aa
$ rdb -c memory dump.rdb > redis_memory.csv
# バイトサイズとキーの個数と単位バイトサイズを出す
$ cat redis_memory.csv | sed -E "1d" | sed -E 's/:[0-9]+(:|")/:{id}\1/g' | cut -d ',' -f 3,4 | awk -F ',' '{ sum[$1] += $2; count[$1] += 1 } END { for (key in sum) print key, sum[key], count[key], sum[key] /count[key] }' > redis_memory_status.csv
[{ question_id: <INTEGER>
accessed_at: <STRING>
}
, // …
]
redis> object encoding <KEY>
hash-max-zipmap-entries 64 (hash-max-ziplist-entries for Redis >= 2.6)
hash-max-zipmap-value 512 (hash-max-ziplist-value for Redis >= 2.6)
list-max-ziplist-entries 512
list-max-ziplist-value 64
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
set-max-intset-entries 512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment