Adds memory information about the scripts' cache to INFO#4883
Merged
antirez merged 2 commits intoredis:unstablefrom Jul 23, 2018
Merged
Adds memory information about the scripts' cache to INFO#4883antirez merged 2 commits intoredis:unstablefrom
antirez merged 2 commits intoredis:unstablefrom
Conversation
Implementation notes: as INFO is "already broken", I didn't want to break it further. Instead of computing the server.lua_script dict size on every call, I'm keeping a running sum of the body's length and dict overheads.
This implementation is naive as it **does not** take into consideration dict rehashing, but that inaccuracy pays off in speed ;)
Demo time:
```bash
$ redis-cli info memory | grep "script"
used_memory_scripts:96
used_memory_scripts_human:96B
number_of_cached_scripts:0
$ redis-cli eval "" 0 ; redis-cli info memory | grep "script"
(nil)
used_memory_scripts:120
used_memory_scripts_human:120B
number_of_cached_scripts:1
$ redis-cli script flush ; redis-cli info memory | grep "script"
OK
used_memory_scripts:96
used_memory_scripts_human:96B
number_of_cached_scripts:0
$ redis-cli eval "return('Hello, Script Cache :)')" 0 ; redis-cli info memory | grep "script"
"Hello, Script Cache :)"
used_memory_scripts:152
used_memory_scripts_human:152B
number_of_cached_scripts:1
$ redis-cli eval "return redis.sha1hex(\"return('Hello, Script Cache :)')\")" 0 ; redis-cli info memory | grep "script"
"1be72729d43da5114929c1260a749073732dc822"
used_memory_scripts:232
used_memory_scripts_human:232B
number_of_cached_scripts:2
✔ 19:03:54 redis [lua_scripts-in-info-memory L ✚…⚑] $ redis-cli evalsha 1be72729d43da5114929c1260a749073732dc822 0
"Hello, Script Cache :)"
```
Member
Author
|
TODO: once merged, this needs to be added to INFO's documentation |
Member
|
@itamarhaber, very good and needed improvement. Other than that, i think the scripts memory metric should include the following:
i think you should sum your server.lua_scripts_mem and the bullets i just suggested in |
Member
Author
|
@oranagra thanks for the review!
Note: someone needs to fix "MEMORY HELP" to follow the "standard" help mechanism. |
Contributor
|
@itamarhaber, @oranagra Thanks, looks good but I'm going to change 42 ;-) |
Contributor
|
Merged, thank you. |
antirez
added a commit
that referenced
this pull request
Jul 23, 2018
antirez
added a commit
that referenced
this pull request
Jul 23, 2018
itamarhaber
referenced
this pull request
in itamarhaber/redis-doc
Jul 24, 2018
As per https://github.com/antirez/redis/pull/4883 Signed-off-by: Itamar Haber <[email protected]>
itamarhaber
referenced
this pull request
in itamarhaber/redis-doc
Jul 24, 2018
Member
Author
|
Yippie :)
|
JackieXie168
pushed a commit
to JackieXie168/redis
that referenced
this pull request
Dec 17, 2018
…mory Adds memory information about the scripts' cache to INFO
JackieXie168
pushed a commit
to JackieXie168/redis
that referenced
this pull request
Dec 17, 2018
itamarhaber
referenced
this pull request
in redis/redis-doc
Oct 14, 2019
pulllock
pushed a commit
to pulllock/redis
that referenced
this pull request
Jun 28, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation notes: as INFO is "already broken", I didn't want to break it further. Instead of computing the server.lua_script dict size on every call, I'm keeping a running sum of the body's length and dict overheads.
This implementation is naive as it does not take into consideration dict rehashing, but that inaccuracy pays off in speed ;)
Demo time: