Redis HMGET, HGETALL, HSET, HGET Benchmark

Posted on February 16, 2019 at 9:19 pm

Today I tested HMGET, HGETALL, HSET, HGET performance.

Here are my tests, see the “requests per second” value for comparisons:

TESTING GET COMMAND
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 get MYKEY
====== get MYKEY ======
  100000 requests completed in 3.27 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
94.64% <= 1 milliseconds
99.99% <= 2 milliseconds
100.00% <= 2 milliseconds
30553.01 requests per second
 
 
##################################################################################################
 
 
TESTING HGETALL COMMAND
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hgetall MYKEY
====== hgetall MYKEY ======
  100000 requests completed in 3.49 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
92.50% <= 1 milliseconds
100.00% <= 1 milliseconds
28645.09 requests per second
 
127.0.0.1:6379[1]> hkeys MYKEY
1) "field1"
2) "field2"
3) "field3"
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hgetall MYKEY4
====== hgetall MYKEY4 ======
  100000 requests completed in 3.61 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
90.00% <= 1 milliseconds
100.00% <= 1 milliseconds
27700.83 requests per second
 
127.0.0.1:6379[1]> hkeys MYKEY4
1) "field1"
2) "field2"
3) "field3"
4) "field4"
5) "field5"
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hgetall MYKEY5
====== hgetall MYKEY5 ======
  100000 requests completed in 3.92 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
55.81% <= 1 milliseconds
99.90% <= 2 milliseconds
100.00% <= 2 milliseconds
25523.23 requests per second
 
127.0.0.1:6379[1]> hkeys MYKEY5
 1) "field1"
 2) "field2"
 3) "field3"
 4) "field4"
 5) "field5"
 6) "field6"
 7) "field7"
 8) "field8"
 9) "field9"
10) "field10"
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hgetall MYKEY2
====== hgetall MYKEY2 ======
  100000 requests completed in 4.25 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
0.23% <= 1 milliseconds
99.95% <= 2 milliseconds
100.00% <= 2 milliseconds
23507.29 requests per second
 
127.0.0.1:6379[1]> hkeys MYKEY2
 1) "field1"
 2) "field2"
 3) "field3"
 4) "field4"
 5) "field5"
 6) "field6"
 7) "field7"
 8) "field8"
 9) "field9"
10) "field10"
11) "field11"
12) "field12"
13) "field13"
14) "field14"
15) "field15"
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hgetall MYKEY3
====== hgetall MYKEY3 ======
  100000 requests completed in 5.02 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
0.00% <= 1 milliseconds
99.93% <= 2 milliseconds
100.00% <= 2 milliseconds
19924.29 requests per second
 
127.0.0.1:6379[1]> hkeys MYKEY3
 1) "field1"
 2) "field2"
 3) "field3"
 4) "field4"
 5) "field5"
 6) "field6"
 7) "field7"
 8) "field8"
 9) "field9"
10) "field10"
11) "field11"
12) "field12"
13) "field13"
14) "field14"
15) "field15"
16) "field111"
17) "field112"
18) "field31"
19) "field41"
20) "field51"
21) "field61"
22) "field81"
23) "field91"
24) "field101"
25) "field121"
26) "field131"
27) "field141"
28) "field151"
 
 
##################################################################################################
 
 
TESTING HMGET COMMAND
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hmget MYKEY field1 field2 field3
====== hmget MYKEY field1 field2 field3 ======
  100000 requests completed in 3.38 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
93.07% <= 1 milliseconds
99.99% <= 2 milliseconds
100.00% <= 2 milliseconds
29585.80 requests per second
 
127.0.0.1:6379[1]> hkeys MYKEY
1) "field1"
2) "field2"
3) "field3"
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hmget MYKEY5 field1 field2 field3 field4 field5 field6 field7 field8 field9 field10
====== hmget MYKEY5 field1 field2 field3 field4 field5 field6 field7 field8 field9 field10 ======
  100000 requests completed in 3.58 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
40.34% <= 1 milliseconds
99.44% <= 2 milliseconds
99.99% <= 3 milliseconds
100.00% <= 3 milliseconds
27917.37 requests per second
 
127.0.0.1:6379[1]> hkeys MYKEY5
 1) "field1"
 2) "field2"
 3) "field3"
 4) "field4"
 5) "field5"
 6) "field6"
 7) "field7"
 8) "field8"
 9) "field9"
10) "field10"
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hmget MYKEY3 field10 field11 field12 field13 field14 field15 field31 field41 field51 field61
====== hmget MYKEY3 field10 field11 field12 field13 field14 field15 field31 field41 field51 field61 ======
  100000 requests completed in 3.69 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
1.79% <= 1 milliseconds
87.19% <= 2 milliseconds
100.00% <= 2 milliseconds
27078.26 requests per second
 
127.0.0.1:6379[1]> hkeys MYKEY3
 1) "field1"
 2) "field2"
 3) "field3"
 4) "field4"
 5) "field5"
 6) "field6"
 7) "field7"
 8) "field8"
 9) "field9"
10) "field10"
11) "field11"
12) "field12"
13) "field13"
14) "field14"
15) "field15"
16) "field111"
17) "field112"
18) "field31"
19) "field41"
20) "field51"
21) "field61"
22) "field81"
23) "field91"
24) "field101"
25) "field121"
26) "field131"
27) "field141"
28) "field151"
 
 
##################################################################################################
 
 
TESTING HINCRBY COMMAND
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hincrby MYKEY field1 5
====== hincrby MYKEY field1 5 ======
  100000 requests completed in 3.16 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
76.61% <= 1 milliseconds
99.96% <= 2 milliseconds
100.00% <= 2 milliseconds
31655.59 requests per second
 
 
##################################################################################################
 
 
TESTING HGET COMMAND
 
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hget MYKEY4 field1
====== hget MYKEY4 field1 ======
  100000 requests completed in 3.25 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
97.84% <= 1 milliseconds
100.00% <= 1 milliseconds
30797.66 requests per second
 
 
##################################################################################################
 
 
TESTING HSET COMMAND
 
root@server:~# redis-benchmark -h 127.0.0.1 -p 6379 --dbnum 1 hset MYKEY3 field2 rand_int
====== hset MYKEY3 field2 rand_int ======
  100000 requests completed in 3.21 seconds
  50 parallel clients
  3 bytes payload
  keep alive: 1
 
89.24% <= 1 milliseconds
99.97% <= 2 milliseconds
100.00% <= 2 milliseconds
31162.36 requests per second

Seems that HMGET is faster than HGETALL.

Receive updates via email

Other Posts

Updated Posts