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 ...
随机推荐
- Mac终端中输入ps aux显示全部进程
ps命令是Process Status的缩写. ps aux命令用来列出系统中当前运行的那些进程. ps aux | grep chrome 表示查询关于chrome的所有程序(grep可作为文件内的 ...
- python验证码识别接口及识别思路代码
1,验证码识别接口代码 import json import base64 import requests def shibie(): data = {} path = "./img/&qu ...
- Ubuntu 16.04 上安装 PCL 1.8.0
Ubuntu16.04之后安装pcl可以直接apt-get sudo apt-get install libpcl-dev pcl-tools 安装之前,准备一些依赖库 sudo apt-get up ...
- asp.net 下载视频 保存视屏
第一张图片为html,第一站图片为js上传视频并播放,限定大小,第三张图片是将视频保存到以字节流的方式保存到数据中,或者是将视频保存到项目中 String filename=this.Filevide ...
- 【深度好文】多线程之WaitHandle-->派生EventWaitHandle事件构造-》AutoResetEvent、ManualResetEvent
AutoResetEvent/ManualResetEvent 都是继承自 EventWaitHandle ,EventWaitHandle继承自WaitHandle. 在讨论这个问题之前,我们先了解 ...
- Unity3D UI适配
直接贴图
- devexpress总结 accordionControl 加载panelcontrol 的快捷方式
先说保存: UserControl control; private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars. ...
- centos-1 nginx
常用命令 su #切换用户mkdir flodr #创建目录rm -r flodr #删除文件/目录,有提示rm -rf flodr #删除文件/目录,无提示pwd #查看当前路径 防火墙设置 ht ...
- Json格式获取接口返回的值
关键字:Set Variable Get Json Value to json Get From Dictionary 具体关键字用法不再说明,可百度一下 ...
- windows server 2016安装
slmgr /skms kms.03k.org slmgr /ato slmgr /ipk WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY kms服务器: https://03k.org/ ...