How does Redis know the value size of key? Or sort by the size of value?

Source: Internet
Author: User
Now occasionally found in Redis some key value has dozens of MB, this is abnormal data, there is no way to sort by value size list more than 10MB all key?

Reply content:

Now occasionally found in Redis some key value has dozens of MB, this is abnormal data, there is no way to sort by value size list more than 10MB all key?

Find you a tool that has been tested for use: Https://github.com/sripathikrishnan/redis-rdb-tools#generate-memory-report

The installation and use method is written on the document, and if an RDB command is not found on the installation, it can be executed directly in the installation directory:

rdbtools/cli/rdb.py -c memory /path/to/your/dump.rdb > result.csv
Database type Key size_in_bytes encoding num_elements len_largest_element
0 String "CCCC" 98 String 4 4
0 String "BBB" 96 String 3 3
0 Hash "User" 102 Ziplist 1 6
0 String "AA" 94 String 2 2

The sizeinbytes in the result column is the size you want, and you can order it after you export it. Also, be careful to modify your own Dump.rdb file path. I haven't tested the volume of data too much, and the analysis is expected to be slower.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.