summaryrefslogtreecommitdiff
path: root/src/networking.c
diff options
context:
space:
mode:
authorfilipe oliveira <filipecosta.90@gmail.com>2022-11-29 12:20:22 +0000
committerGitHub <noreply@github.com>2022-11-29 14:20:22 +0200
commit7dfd7b9197bbe216912049eebecbda3f1684925e (patch)
treeb521de3a009c121830eb8628d69a6d058c50e318 /src/networking.c
parentf8ac5a65039800d8b59970514b88cdbbc1da08b7 (diff)
downloadredis-7dfd7b9197bbe216912049eebecbda3f1684925e.tar.gz
Reduce eval related overhead introduced in v7.0 by evalCalcFunctionName (#11521)
As being discussed in #10981 we see a degradation in performance between v6.2 and v7.0 of Redis on the EVAL command. After profiling the current unstable branch we can see that we call the expensive function evalCalcFunctionName twice. The current "fix" is to basically avoid calling evalCalcFunctionName and even dictFind(lua_scripts) twice for the same command. Instead we cache the current script's dictEntry (for both Eval and Functions) in the current client so we don't have to repeat these calls. The exception would be when doing an EVAL on a new script that's not yet in the script cache. in that case we will call evalCalcFunctionName (and even evalExtractShebangFlags) twice. Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/networking.c')
-rw-r--r--src/networking.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/networking.c b/src/networking.c
index 757102b19..76566ddd7 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -158,6 +158,7 @@ client *createClient(connection *conn) {
c->original_argc = 0;
c->original_argv = NULL;
c->cmd = c->lastcmd = c->realcmd = NULL;
+ c->cur_script = NULL;
c->multibulklen = 0;
c->bulklen = -1;
c->sentlen = 0;
@@ -2018,6 +2019,7 @@ void resetClient(client *c) {
redisCommandProc *prevcmd = c->cmd ? c->cmd->proc : NULL;
freeClientArgv(c);
+ c->cur_script = NULL;
c->reqtype = 0;
c->multibulklen = 0;
c->bulklen = -1;