redis - 使用 Redis-Cli 了解延迟

标签 redis redis-cli

我正在使用 redis-cli 工具来观察 redis-server 延迟。这是一个例子:

ubuntu:~$ redis-cli --latency -h 127.0.0.1 -p 6379
min: 0, max: 15, avg: 0.12 (2839 samples)

问题是,这些值究竟意味着什么?除了该工具自己的帮助文档中提供的内容之外,我正在努力寻找与此相关的文档。

最佳答案

redis-cli --latency -h -p命令是一种工具,可帮助解决和了解您在使用 Redis 时可能遇到的延迟问题。它通过测量 Redis 服务器响应 Redis PING 命令的时间(以毫秒为单位)来实现。

In this context latency is the maximum delay between the time a client issues a command and the time the reply to the command is received by the client. Usually Redis processing time is extremely low, in the sub microsecond range, but there are certain conditions leading to higher latency figures.

-- Redis latency problems troubleshooting

所以当我们运行命令时 redis-cli --latency -h 127.0.0.1 -p 6379 Redis 进入一种特殊模式,在这种模式下它会连续采样延迟(通过运行 PING)。

现在让我们分解它返回的数据:min: 0, max: 15, avg: 0.12 (2839 samples)

什么是 (2839 samples) ? 这是 redis-cli 的次数记录发出 PING 命令并收到响应。换句话说,这是您的示例数据。在我们的示例中,我们记录了 2839 个请求和响应。

什么是 min: 0 ? min值表示 CLI 发出 PING 之间的最小延迟以及收到回复的时间。换句话说,这是我们采样数据中的绝对最佳响应时间。

什么是 max: 15 ? max值与 min 相反.它表示 CLI 发出 PING 之间的最大延迟以及收到命令回复的时间。这是我们采样数据中最长的响应时间。在我们的 2839 个样本示例中,最长的交易花费了 15ms .

什么是 avg: 0.12 ? avg value 是我们所有采样数据的平均响应时间(以毫秒为单位)。所以平均而言,从我们的 2839 个样本中,响应时间花费了 0.12ms .

基本上,min 的数字更高, max , 和 avg是一件坏事。

关于如何使用这些数据的一些很好的后续 Material :

关于redis - 使用 Redis-Cli 了解延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27735411/

相关文章:

redis - 在 redis 散列中(在管道内)对相同值执行 hget 和 hset 的准确性

redis - StackExcange.Redis.RedisTimeoutException异常

redis - 将 redis 客户端列表保存到文件

redis - 如何删除带有特殊字符的Redis键?

redis - 获取redis中存在的所有哈希值

java - RediscacheManager 实例,Spring data redis 版本高于 2.0x

node.js - 跨 Node 应用程序共享 Redis session

java - 模拟redis模板

redis - 如何在不知道列表大小的情况下使用 redis-cli 打印列表中的所有值?

redis - 向 Redis 集群添加新服务器