Describe the bug
I've a requirement to pass custom values in benchmark. I followed https://redis.io/docs/management/optimization/benchmarks/ and came across script load but it doesn't seem to be working as expected. Here is the command that I'm running -
To reproduce
redis-benchmark -n 100000 -q script load "redis.call('set','foo','bar')"
Ouput When I run above command, it doesn't set any keys -
❯ redis-cli dbsize
(integer) 0
❯ redis-benchmark -n 100000 -q script load "redis.call('set','foo','bar')"
script load redis.call('set','foo','bar'): 36469.73 requests per second, p50=0.767 msec
❯ redis-cli dbsize
(integer) 0
Am I missing any steps here?
Comment From: filipecosta90
@himanshusahu06 a stated in docs, the scrip load command "Load a script into the scripts cache, without executing it". You should use the returned SHA1 digest to execute it EVALSHA. Here's an example:
❯ redis-cli dbsize
(integer) 0
❯ redis-cli script load "redis.call('set','foo','bar')"
"a3862cfaeddaf7c3473803cba58cdd0bdca53397"
❯ redis-benchmark -q -n 100000 EVALSHA a3862cfaeddaf7c3473803cba58cdd0bdca53397 0
EVALSHA a3862cfaeddaf7c3473803cba58cdd0bdca53397 0: 161812.31 requests per second, p50=0.175 msec
❯ redis-cli dbsize
(integer) 1
Feel free to reopen the issue if you still believe there's is some doubts.