Redis: Show database size/size for keys

前端 未结 9 1774
青春惊慌失措
青春惊慌失措 2020-12-12 11:26

My redis instance seems to being growing very large and I\'d like to find out which of the multiple databases I have in there consumes how much memory. Redis\' INFO

相关标签:
9条回答
  • 2020-12-12 12:04

    So my solution to my own problem: After playing around with redis-cli a bit longer I found out that DEBUG OBJECT <key> reveals something like the serializedlength of key, which was in fact something I was looking for...

    For a whole database you need to aggregate all values for KEYS * which shouldn't be too difficult with a scripting language of your choice...

    The bad thing is that redis.io doesn't really have a lot of information about DEBUG OBJECT.

    0 讨论(0)
  • 2020-12-12 12:07

    The solution from the comments deserves it's own answer:

    redis-cli --bigkeys
    
    0 讨论(0)
  • 2020-12-12 12:08

    MEMORY USAGE key command gives you the number of bytes that a key and its value require to be stored in RAM.

    The reported usage is the total of memory allocations for data and administrative overheads that a key its value require (source redis documentation)

    0 讨论(0)
提交回复
热议问题