如何判断与Redis相关的内容并阻止?

时间:2018-01-18 04:31:34

标签: redis

我有一个redis缓存,它会持续达到100%的使用率阈值。

当我运行CLIENT LIST

我回来了:

    redis 127.0.0.1:6379> CLIENT LIST
    addr=127.0.0.1:54210 fd=5 name= age=27325 idle=18609 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=incrby
    addr=127.0.0.1:54211 fd=6 name= age=27325 idle=18610 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=exec
    addr=127.0.0.1:54212 fd=7 name= age=27325 idle=24817 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=2916 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=blpop
    addr=127.0.0.1:54213 fd=8 name= age=27325 idle=27325 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=2646 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=blpop
    addr=127.0.0.1:54214 fd=9 name= age=27325 idle=27325 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=2156 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=blpop
    addr=127.0.0.1:54215 fd=10 name= age=27325 idle=18609 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=2254 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=blpop
    addr=127.0.0.1:54216 fd=11 name= age=27325 idle=21886 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=2842 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=blpop
    addr=127.0.0.1:54217 fd=12 name= age=27325 idle=27325 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=441 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=blpop
    addr=127.0.0.1:54218 fd=13 name= age=27325 idle=27325 flags=b db=0 sub=0 psub=0 multi=-1 qbuf=441 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=blpop
    addr=127.0.0.1:54219 fd=14 name= age=27325 idle=27325 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=info
    addr=127.0.0.1:54220 fd=15 name= age=27325 idle=27325 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=info
    addr=127.0.0.1:54221 fd=16 name= age=27286 idle=18609 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=hset
    addr=127.0.0.1:54222 fd=17 name= age=27286 idle=18610 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=exec
    addr=127.0.0.1:54223 fd=18 name= age=27286 idle=18609 flags=N db=0 sub=1 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=subscribe
    addr=127.0.0.1:54302 fd=19 name= age=27 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client

为什么这么多flag = b(客户端阻塞)?我怎么知道这些是什么以及阻塞的原因?

1 个答案:

答案 0 :(得分:3)

  

为什么这么多flag = b(客户端阻塞)?

flag=b表示这些客户端正在运行阻止命令。

  

我怎么知道这些是什么

在您的情况下,这些客户端正在向Redis发送BLPOP命令,即cmd=blpop

  

为什么阻止?

当给定BLPOP中没有元素时,

LIST命令会阻止连接。有关详细信息,请参阅doc