form many blog, i learn that the redis command keys *
may block the redis server, and other command can not be execute on time .
however, today i run the keys *
on my db which has about 8million data.
and then i use my other client to exec other command like get
or set
, this all work well, and give response on time.
so, i'm confused that why my command keys
not block.
the picture is https://i.sstatic.net/8flt4.png
KEYS
(and almost any other Redis command for that matter) is blocking, do not be fooled :)
While Redis is scanning its internal dictionary and assembling the response, it is blocked. However, after the response is ready and moved to the network layer, the server is free to process the next operations. Your client, in the meanwhile, is blocked from the time it sent KEYS
until the entire response is received by it.