Redis、XREADGROUP stream with block 一年了,笨蛋?
Redis, XREADGROUP stream with block for a year, stupid?
告诉 XREADGROUP 阻塞直到有消息而不是客户端必须轮询有什么缺点吗?
发件人:
https://redis.io/commands/xreadgroup
不清楚意思是:
"On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data."
有人可以阐明 Redis 中流的阻塞机制吗?
"On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data."
比如说,流是空的,N个客户端用不同的组名调用XREADGROUP
。由于流为空,这些客户端将阻塞直到有新消息。
当你调用XADD
向流中添加消息时,Redis需要向这N个阻塞客户端发送回复。这就是为什么 XADD
会支付 O(N) 时间。
Are there any downsides to telling XREADGROUP to block until there is a message rather than the client having to poll?
如果 N 非常大,即太多客户端阻塞流,XADD
命令可能会阻塞 Redis 一段时间,因为它是 single-threaded。如果 N 较小,则不会对性能产生影响。
告诉 XREADGROUP 阻塞直到有消息而不是客户端必须轮询有什么缺点吗?
发件人:
https://redis.io/commands/xreadgroup
不清楚意思是:
"On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data."
有人可以阐明 Redis 中流的阻塞机制吗?
"On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data."
比如说,流是空的,N个客户端用不同的组名调用XREADGROUP
。由于流为空,这些客户端将阻塞直到有新消息。
当你调用XADD
向流中添加消息时,Redis需要向这N个阻塞客户端发送回复。这就是为什么 XADD
会支付 O(N) 时间。
Are there any downsides to telling XREADGROUP to block until there is a message rather than the client having to poll?
如果 N 非常大,即太多客户端阻塞流,XADD
命令可能会阻塞 Redis 一段时间,因为它是 single-threaded。如果 N 较小,则不会对性能产生影响。