如何分辨什么连接到你的Redis和阻塞?

5lhxktic  于 2023-10-15  发布在  Redis
关注(0)|答案(1)|浏览(141)

我有一个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(客户端阻塞)?我怎么知道这些是什么,为什么要阻塞?

zvms9eto

zvms9eto1#

为什么有这么多flag=B(客户端阻塞)?
flags=b表示这些客户端正在运行阻塞命令。
我怎么知道这些是什么
在您的例子中,这些客户端正在向Redis发送BLPOP命令,即cmd=blpop
为什么要封锁?
BLPOP命令在给定的LIST中没有元素时阻塞连接。详情请参阅doc

相关问题