Redis-09.慢查询
慢查询指的是redis命令的执行时间,不包括网络传输和排队时间。
Redis配置文件redis.conf中描述慢查询相关的选项在SLOW LOG部分
################################## SLOW LOG ###################################
# The Redis Slow Log is a system to log queries that exceeded a specified
# execution time. The execution time does not include the I/O operations
# like talking with the client, sending the reply and so forth,
# but just the time needed to actually execute the command (this is the only
# stage of command execution where the thread is blocked and can not serve
# other requests in the meantime).
#
# You can configure the slow log with two parameters: one tells Redis
# what is the execution time, in microseconds, to exceed in order for the
# command to get logged, and the other parameter is the length of the
# slow log. When a new command is logged the oldest one is removed from the
# queue of logged commands.
# The following time is expressed in microseconds, so 1000000 is equivalent
# to one second. Note that a negative number disables the slow log, while
# a value of zero forces the logging of every command.
slowlog-log-slower-than 10000
# There is no limit to this length. Just be aware that it will consume memory.
# You can reclaim memory used by the slow log with SLOWLOG RESET.
slowlog-max-len 128
也可以使用config get及config set来查询和修改,config rewrite可以写入配置文件。此外,slowlog命令还可以完成一些慢查询日志相关的其它操作。
# 命令执行超过多少微秒就记录慢查询日志(1秒=1000毫秒=1000000微秒)
127.0.0.1:6379> CONFIG GET slowlog-log-slower-than
1) "slowlog-log-slower-than"
2) "10000"
# 慢查询日志保存的最大条数
127.0.0.1:6379> config get slowlog-max-len
1) "slowlog-max-len"
2) "128"
# 获取慢查询日志列表当前长度
127.0.0.1:6379> slowlog len
(integer) 0
# 获取慢查询
127.0.0.1:6379> slowlog get
# 重置慢查询
127.0.0.1:6379> slowlog reset
OK
一条慢查询日志包括4个属性:日志id、命令执行的时间戳、命令耗时、命令和参数。
Redis-09.慢查询的更多相关文章
- 浅谈Redis之慢查询日志
首先我们需要知道redis的慢查询日志有什么用?日常在使用redis的时候为什么要用慢查询日志? 第一个问题: 慢查询日志是为了记录执行时间超过给定时长的redis命令请求 第二个问题: 让使用者更好 ...
- redis设置慢查询日志
Redis 的慢查询日志功能用于记录执行时间超过给定时长的命令请求, 用户可以通过这个功能产生的日志来监视和优化查询速度. 1.redis生命周期 慢查询发生在第3阶段 2.两个配置 2.1.slow ...
- 在nodejs使用Redis缓存和查询数据及Session持久化(Express)
在nodejs使用Redis缓存和查询数据及Session持久化(Express) https://segmentfault.com/a/1190000002488971
- Redis慢日志查询
Redis slowlog 是个什么 redis的slow log记录了那些执行时间超过规定时长的请求.执行时间不包括I/O操作(比如与客户端进行网络通信等),只是命令的实际执行时间(期间线程会被阻塞 ...
- 使用 Redis 如何实现查询附近的人?「视频版」——面试突击 003 期
面试问题 Redis 如何实现查询附近的人? 涉及知识点 Redis 中如何操作位置信息? GEO 底层是如何实现的? 如何在程序实现查询附近的人? 在实际使用中需要注意哪些问题? 视频答案 视频地址 ...
- 为什么 Redis 的查询很快, Redis 如何保证查询的高效
Redis 如何保证高效的查询效率 为什么 Redis 比较快 Redis 中的数据结构 1.简单动态字符串 SDS 对比 c 字符串的优势 SDS可以常数级别获取字符串的长度 杜绝缓冲区溢出 减少修 ...
- [转]在nodejs使用Redis缓存和查询数据及Session持久化(Express)
本文转自:https://blog.csdn.net/wellway/article/details/76176760 在之前的这篇文章 在ExpressJS(NodeJS)中设置二级域名跨域共享Co ...
- Redis Geo: Redis新增位置查询功能
转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/144.html 移动互联网增进了人与人之间的联系,其中基于位置信息的服务( ...
- Redis 存储、查询
[TOC] 数据存储 假设我们在MySQL数据库中有这样一张表: mysql> desc user_info; Field Type Null Key Default Extra id int( ...
- 转:Redis Geo: Redis新增位置查询功能
原文来自于:http://www.infoq.com/cn/news/2015/07/redis-geo 移动互联网增进了人与人之间的联系,其中基于位置信息的服务(Location Based Ser ...
随机推荐
- checkpoint NGFW 实验(一)
网络拓扑如下: 配置要求: a.实现LAN和DMZ区域正常访问互联网 b.映射LAN内部主机 10.158.1.1/32的RDP给外网访问,发布DMZ区域的10.133.1.100的主机的web服务到 ...
- Python中日期和时间格式化输出的方法
本文转自:https://www.jb51.net/article/62518.htm 本文实例总结了python中日期和时间格式化输出的方法.分享给大家供大家参考.具体分析如下: python格式化 ...
- 获取txt md5值上传文件完整性校验
网络上传文件到服务器 做md5 校对.判断文件是否破坏 首先求txt文件的md5值 ,1万条数据 求出的值 文件MD5:e5467b6a8e3c26af8c5af0bda3739280 服务器处理程序 ...
- 周一要做的事情Sd31y5YE
问实习生活动是否有费用 调查结果更新,提醒各个pm 修改模板,把我们追加的东西体现在模板里
- 在Eclipse中导入web项目时的问题总结
一.导入项目 在Project Explorer右击,import-->Existing Projects into Workspace,选择要导入的文件,Finish. 二.解决报错 (1)T ...
- Mnist
Mnist 先贴一个介绍的很好的博客 https://blog.csdn.net/sysushui/article/details/53257185 mnist是一个手写体数字的数据集.上图是数据集的 ...
- 20175325 《JAVA程序设计》实验二《JAVA开发环境的熟悉》实验报告
20175325 <JAVA程序设计>实验二<JAVA开发环境的熟悉>实验报告 一.实验报告封面 课程:Java程序设计 班级:1753班 姓名:石淦铭 学号:20175325 ...
- AX2009 批处理作业中使用多线程---批量捆绑
批量捆绑 由于Ax服务器中批处理线程是可以多个的,而实际批处理作业中线程往往只使用了一个 Class: /* 批量捆绑 */ /*class Code*/ public class DemoBat ...
- WCF系列_WCF影响客户端导出Excel文件的实现
需求:WCF搭建服务端提供导出并下载Excel文件接口,客户端使用ajax发起请求,浏览器直接下载Excel文件. 难点:WCF中并没有HttpContext对象,因此,服务端总是获取不到HttpCo ...
- 获取Vue的实例方法
我们知道在new Vue({...})后,如果没有赋值给一个变量存储,我们很难拿到这个实例,Vue官方也没有提供Vue.getInstance方法,那我们就自己扩展个吧 Code: Vue.getIn ...