Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new INFO evicted_scripts field and eval scripts eviction #2686

Merged
merged 4 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions commands/eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ to ensure the correct execution of scripts, both in standalone and clustered dep
The script **should only** access keys whose names are given as input arguments.
Scripts **should never** access keys with programmatically-generated names or based on the contents of data structures stored in the database.

**Important:**
enjoy-binbin marked this conversation as resolved.
Show resolved Hide resolved
in some cases, users will abuse Lua EVAL by embedding values in the script instead of providing them as argument, and thus generating a different script on each call to EVAL.
These are added to the Lua interpreter and cached to redis-server, consuming a large amount of memory over time.
Starting from Redis 8.0, scripts loaded with `EVAL` will be deleted from redis after a certain number (least recently used order).
enjoy-binbin marked this conversation as resolved.
Show resolved Hide resolved
The number of evicted scripts can be viewed through `INFO`'s `evicted_scripts`.

Please refer to the [Redis Programmability](/topics/programmability) and [Introduction to Eval Scripts](/topics/eval-intro) for more information about Lua scripts.

@examples
Expand Down
1 change: 1 addition & 0 deletions commands/info.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ Here is the meaning of all fields in the **stats** section:
* `expire_cycle_cpu_milliseconds`: The cumulative amount of time spent on active expiry cycles
* `evicted_keys`: Number of evicted keys due to `maxmemory` limit
* `evicted_clients`: Number of evicted clients due to `maxmemory-clients` limit. Added in Redis 7.0.
* `evicted_scripts`: Number of evicted EVAL scripts due to LRU policy, see `EVAL` for more details. Added in Redis 8.0.
* `total_eviction_exceeded_time`: Total time `used_memory` was greater than `maxmemory` since server startup, in milliseconds
* `current_eviction_exceeded_time`: The time passed since `used_memory` last rose above `maxmemory`, in milliseconds
* `keyspace_hits`: Number of successful lookup of keys in the main dictionary
Expand Down
Loading