I recently did an experiment with REDIS to test it out as a queuing system. I modeled each queue as a list and setup a single sender to push a 2 KB message into a queue. I also setup receivers using BLOP. I monitored the CPU usage for various number of keys and I saw a linear relationship between number of keys on the BLPOP and the amount of CPU used. Effectively each addition of 25 keys in the BLPOP command resulted in another 6% increase in CPU on the redis server. For example, 100 keys added about 25% to REDIS CPU. However, adding 4 clients that perform BLPOP of only 25 keys results in only a 6% increase in CPU. In both cases the number of keys that are blocked are 100 but one is blocked using only one connection and the other set of 100 is blocked on 4 connections. This behavior is either a bug or should be documented since the BLPOP is currently listed as O(1).
Comment From: filipecosta90
@redis/core-team WDYT about changing the docs to state O(M) time for BLPOP/BRPOP, where M is the number of provided keys?
Comment From: itamarhaber
Aye
Comment From: filipecosta90
Aye
Thank you Itamar :+1: https://github.com/redis/redis-doc/pull/1554
Comment From: filipecosta90
Given the documentation was updated: - https://redis.io/commands/brpop - https://redis.io/commands/blpop we can close this issue. Thank you @cwolfinger !