分析redis key大小的几种方法

当redis被用作缓存时,有时我们希望了解key的大小分布,或者想知道哪些key占的空间比较大。本文提供了几种方法。

一. bigKeys

这是redis-cli自带的一个命令。对整个redis进行扫描,寻找较大的key。例:

redis-cli -h b.redis -p 1959 --bigkeys

输出:

`prism-tokentokenjavascript
Scanning the entire keyspace to find biggest keys as well as
average sizes per key type. You can use -i 0.1 to sleep 0.1 sec
per 100 SCAN commands (not usually needed).

[00.00%] Biggest hash found so far ‘s_9329222’ with 3 fields
[00.00%] Biggest string found so far ‘url_http://mini.eastday.com/mobile/170722090206890.html?qid=sgllq&ch=east_sogou_push&pushid=13’ with 8 bytes
[00.00%] Biggest string found so far ‘foo’ with 40 bytes
[00.00%] Biggest hash found so far ‘s_9329084’ with 4 fields
[00.23%] Biggest zset found so far ‘region_hot_菏泽地’ with 625 members
[00.23%] Biggest zset found so far ‘region_hot_葫芦岛’ with 914 members
[00.47%] Biggest string found so far ‘top_notice_list’ with 135193 bytes
[00.73%] Biggest zset found so far ‘region_hot_自贡’ with 2092 members
[01.90%] Biggest hash found so far ‘uno_facet_2018-12-20’ with 59 fields
[11.87%] Biggest zset found so far ‘region_hot_上海’ with 2233 members
[27.05%] Biggest set found so far ‘blacklist_set_key’ with 31832 members
[73.87%] Biggest string found so far ‘PUSH_NEWS’ with 3104237 bytes
[86.18%] Biggest zset found so far ‘region_hot_北京’ with 2688 members

Original: https://www.cnblogs.com/wangcp-2014/p/15702410.html
Author: 飘飘雪
Title: 分析redis key大小的几种方法

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/528932/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • [ Linux ] Gnome3 禁用桌面屏保

    https://www.cnblogs.com/yeungchie/ gsettings gsettings set org.gnome.desktop.session idle-…

    Linux 2023年6月7日
    0107
  • Linux 压缩、解压缩命令

    Linux 压缩、解压缩命令 tar 语法命令 tar [options…] [files] options:选择描述-A 追加tar文件至归档-c 创建一个新文档-d…

    Linux 2023年6月6日
    0103
  • C语言001–hello world编译详解

    1.编写hello.c程序,并编译运行 book@100ask:~/linux/c01$ cat hello.c -n 1 #include <stdio.h> 2 3…

    Linux 2023年6月6日
    0107
  • 你的团队工作量饱和吗?

    参与软件开发的相关人员,虽然称为工程技术人员,但本质上其实就是手艺人。手艺嘛肯定是一技之长,里面多少有些门道,外行人做不了, 也很难完全搞清楚其中的门道,合作过程中就怕被坑上当 :…

    Linux 2023年6月13日
    089
  • python reportlab 生成table学习笔记

    利用python report生成table表格,需要定义表格的数据,表格的样式,最后利用doc.build方法生成文件。 在reportlab中文手册中描述table方法: Ta…

    Linux 2023年6月14日
    091
  • Ubuntu18.04 显卡驱动安装(解决各种疑难杂症)

    步骤 下载驱动 准备工作 进行安装 检查安装 下载驱动 首先我们需要去官网下载显卡驱动 打开浏览器,在百度搜索框中搜索:显卡驱动 下载 在 手动搜索驱动程序一栏,根据自己的显卡进行…

    Linux 2023年6月14日
    0114
  • [20210917]ssh: error while loading shared libraries: libcrypto.so.1.0.0.txt

    [20210917]ssh: error while loading shared libraries: libcrypto.so.1.0.0.txt –//以后写一些…

    Linux 2023年5月27日
    0134
  • apache tomcat 目录session应用信息漏洞

    Tomcat 是一款开源的 Web 应用服务器软件。Tomcat 属于轻量级应用服务器,在中小型系统和并发访问用户不多的场合下被普遍使用,是开发和调试 JSP 程序的首选。 漏洞描…

    Linux 2023年6月7日
    0135
  • Linux 系统IO响应缓慢系统hang住

    应急处理:reboot 解决方法: sysctl -w vm.dirty_ratio=10 sysctl -w vm.dirty_background_ratio=5 sysctl…

    Linux 2023年6月13日
    0102
  • shell中参数的用法 && wait的用法

    转载自https://www.jianshu.com/p/4db526ff6560 参数 说明 $0 当前脚本的文件名(间接运行时还包括绝对路径) $n 传递给脚本或函数的参数。n…

    Linux 2023年5月28日
    091
  • 容器编排与Kubernates

    1 基本概念 1.1 K8S优势 容器调度、容器管理、容器编排、容器集群管理工具。Google开源,自动化部署。支持弹性收缩、负载均衡。 1.2 K8S在Devops中的角色 ; …

    Linux 2023年6月13日
    0106
  • CMU15-445 数据库导论 Storage01

    CMU15-445 01 Storage 1. 参考资料: [1] CMU15-445:Database Systems [Andy Pavlo] https://15445.co…

    Linux 2023年6月6日
    097
  • 海思3559 FFMPEG移植

    具体参考下面这篇帖子http://bbs.ebaina.com/forum.php?mod=viewthread&tid=79863&pid=156755&…

    Linux 2023年6月13日
    096
  • 使用Amazon Pinpoint对用户行为追踪

    1.前言 最近在做一个项目,我们的后台大数据团队需要了解用户在使用app的时候,都进行了哪些操作,在哪个页面都干了些什么,以及app日活和月活等等,各种数据。总之就是监控用户行为,…

    Linux 2023年6月13日
    0104
  • Mybatis的递归查询实现二级评论

    最近闲来无事,在做毕业设计。前台页面需要一个评论功能,感觉三方的评论太复杂,功能也太多。就想着自己写一个简单点的,本人比较菜,方法比较笨,可能效率不高。 环境介绍 后端:Sprin…

    Linux 2023年6月8日
    0105
  • 【转】我是一个CPU:这个世界慢!死!了!

    简介 我经常听到人们说磁盘慢,网络很慢,这是从人类感知的角度来表达的。比如,把一个文件拷贝到硬盘上需要几分钟到几十分钟,足够我吃一顿饭;而从网上下载一部电影,有时需要几个小时,我可…

    Linux 2023年5月27日
    096
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球