You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this should be classed as a bug or not, so have filed as an Improvement.
Calling RedisCache#clear() results in a call to the Redis KEYS command, which you are advised not to use in production. Would it be possible to move this to use SCAN, at least when not calling a Redis cluster?
Some more context on the issue:
We recently moved from a Redis cluster to a single instance. As part of that move we replaced all calls to keys() in our code with calls to scan() based on performance issues we observed on a staging environment and the Redis docs:
Warning: consider KEYS as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This command is intended for debugging and special operations, such as changing your keyspace layout. Don't use KEYS in your regular application code. If you're looking for a way to find keys in a subset of your keyspace, consider using SCAN or sets.
However, there were a few places in our code where we call RedisCache#clear() which we didn't realise uses KEYSunder the hood. This resulted in a brief blip on our production environment because our Redis instance essentially locked up (100% CPU, no longer servicing other requests). The SLOWLOG suggested that KEYS was the culprit, which we traced back to a call to clear()
3 votes, 3 watchers
The text was updated successfully, but these errors were encountered:
Louis Morgan opened DATAREDIS-838 and commented
I'm not sure if this should be classed as a bug or not, so have filed as an Improvement.
Calling
RedisCache#clear()
results in a call to the RedisKEYS
command, which you are advised not to use in production. Would it be possible to move this to useSCAN
, at least when not calling a Redis cluster?Some more context on the issue:
We recently moved from a Redis cluster to a single instance. As part of that move we replaced all calls to
keys()
in our code with calls toscan()
based on performance issues we observed on a staging environment and the Redis docs:However, there were a few places in our code where we call
RedisCache#clear()
which we didn't realise usesKEYS
under the hood. This resulted in a brief blip on our production environment because our Redis instance essentially locked up (100% CPU, no longer servicing other requests). TheSLOWLOG
suggested thatKEYS
was the culprit, which we traced back to a call toclear()
3 votes, 3 watchers
The text was updated successfully, but these errors were encountered: