-
Notifications
You must be signed in to change notification settings - Fork 729
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 SCRIPT STATS subcommand #1418
base: unstable
Are you sure you want to change the base?
Conversation
Signed-off-by: artikell <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #1418 +/- ##
============================================
+ Coverage 70.85% 70.89% +0.03%
============================================
Files 118 118
Lines 63591 63627 +36
============================================
+ Hits 45058 45108 +50
+ Misses 18533 18519 -14
|
addReplyMapLen(c, 1); | ||
|
||
addReplyBulkCString(c, "running_script"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the thought we will have more stats in the future? I'm wondering if we should just have a command just for the running script, instead of something generic like stats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, this part is a reference to FUNCTION STATS
.
Currently, there is really only one return value., but as a stat method, it is best to reserve the ability for subsequent extensions.
Alternatively, we can consider adding some Lua-related context, such as Lua execution time/ Lua use Memory, to help users locate problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the f$% did the Redis folks do this. I swear they barely thought through functions and then dumped it on the community.
@artikell thanks for your contribution. I'm not sure if it's worth to add a new command to just get the runtime duration of a script, since this can also be tracked by the application that executed the Moreover, it's not clear to me how this new command solves the problem described in https://github.com/orgs/valkey-io/discussions/1404. Can you give us some more insights about it? |
I think when a developer finds that a valkey is blocked by lua, it needs a way to know which lua is blocking. Using this command, users can be guided to locate the problem. Instead of just asking the user to kill the script |
Ah, I think I understand what you're trying to achieve here. You are not interested in the execution time of the script. What you are interested in is the name of the script being executed. The name of an EVAL script is a SHA1 hash value. In order for it to be useful, you'll also need to track this hash value in your application to know exactly, which application script is being executed. serverLog(LL_WARNING,
"Slow script detected: still in execution after %lld milliseconds. "
"You can try killing the script using the %s command. Script name is: %s.",
elapsed, (run_ctx->flags & SCRIPT_EVAL_MODE) ? "SCRIPT KILL" : "FUNCTION KILL", run_ctx->funcname); I'm still not convinced about the usefulness of this new command, since there's always the need from the application side to keep track of the SHA1 -> script code association in order to know which scripting is being executed, and probably is much easier for the application to just log which scripting is currently being executed. |
Considering that the user can know the specific script through the However, for a user who cannot view the log, he has no way of knowing the current running script name. |
An inspiration is needed to query the execution of the current script. Solve this problem https://github.com/orgs/valkey-io/discussions/1404