From bbc2c44541fbb50c5d1fc001afe2d2fca3a42eda Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Wed, 25 Nov 2020 23:39:01 +0200 Subject: [PATCH] INFO client_recent_max_input_buffer includes argv array (#8065) this metric already includes the argv bytes, like what clientsCronTrackClientsMemUsage does, but it's missing the array itself. p.s. For the purpose of tracking expensive clients we don't need to include the size of the client struct and the static reply buffer in it. --- src/server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server.c b/src/server.c index f30d33555..7054b225e 100644 --- a/src/server.c +++ b/src/server.c @@ -1615,7 +1615,8 @@ size_t ClientsPeakMemInput[CLIENTS_PEAK_MEM_USAGE_SLOTS]; size_t ClientsPeakMemOutput[CLIENTS_PEAK_MEM_USAGE_SLOTS]; int clientsCronTrackExpansiveClients(client *c) { - size_t in_usage = sdsZmallocSize(c->querybuf) + c->argv_len_sum; + size_t in_usage = sdsZmallocSize(c->querybuf) + c->argv_len_sum + + (c->argv ? zmalloc_size(c->argv) : 0); size_t out_usage = getClientOutputBufferMemoryUsage(c); int i = server.unixtime % CLIENTS_PEAK_MEM_USAGE_SLOTS; int zeroidx = (i+1) % CLIENTS_PEAK_MEM_USAGE_SLOTS;