It scans every key in the database in one call and blocks all other clients while it runs
KEYS checks every key in the database in one command. Its cost is O(N), where N is the number of keys. With millions of keys, it stops the single command thread, so every other client waits.
"It was removed in Redis 7" is wrong: KEYS still exists. "It only returns the first 1000 matches" is also wrong: it returns all matches, and that is exactly the problem. Use SCAN instead. SCAN uses a cursor to go through the keys in small steps.
Read more