Skip to content

Commit 7dbeb33

Browse files
Add new INFO evicted_scripts field and eval scripts eviction (#2686)
Co-authored-by: Oran Agra <[email protected]>
1 parent 51cd6df commit 7dbeb33

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

commands/eval.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ to ensure the correct execution of scripts, both in standalone and clustered dep
1212
The script **should only** access keys whose names are given as input arguments.
1313
Scripts **should never** access keys with programmatically-generated names or based on the contents of data structures stored in the database.
1414

15+
**Note:**
16+
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.
17+
These are added to the Lua interpreter and cached to redis-server, consuming a large amount of memory over time.
18+
Starting from Redis 8.0, scripts loaded with `EVAL` or `EVAL_RO` will be deleted from redis after a certain number (least recently used order).
19+
The number of evicted scripts can be viewed through `INFO`'s `evicted_scripts`.
20+
1521
Please refer to the [Redis Programmability](/topics/programmability) and [Introduction to Eval Scripts](/topics/eval-intro) for more information about Lua scripts.
1622

1723
@examples

commands/info.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ Here is the meaning of all fields in the **stats** section:
276276
* `expire_cycle_cpu_milliseconds`: The cumulative amount of time spent on active expiry cycles
277277
* `evicted_keys`: Number of evicted keys due to `maxmemory` limit
278278
* `evicted_clients`: Number of evicted clients due to `maxmemory-clients` limit. Added in Redis 7.0.
279+
* `evicted_scripts`: Number of evicted EVAL scripts due to LRU policy, see `EVAL` for more details. Added in Redis 8.0.
279280
* `total_eviction_exceeded_time`: Total time `used_memory` was greater than `maxmemory` since server startup, in milliseconds
280281
* `current_eviction_exceeded_time`: The time passed since `used_memory` last rose above `maxmemory`, in milliseconds
281282
* `keyspace_hits`: Number of successful lookup of keys in the main dictionary

0 commit comments

Comments
 (0)