There is a need to run Redis inside of Kubernetes. This will eliminate the egress costs.
Installation is straightforward if you use Bitnami:
Build a snapshot of redis-14.8.8 from https://github.com/bitnami/charts/tree/master/bitnami/redis
helm repo add bitnami https://charts.bitnami.com/bitnami
helm pull bitnami/redis
Then checkin the new tgz file (under 'charts' folder) and other files to keep the current version as a snapshot in git. The minimal files include:
-rw-r--r-- 1 user 1437522721 767 Aug 27 11:11 Chart.yaml
-rw-r--r-- 1 user 1437522721 235 Aug 27 10:37 README.md
drwxr-xr-x 4 user 1437522721 128 Aug 27 10:37 charts
Install it to Kubernetes:
helm dependency update
helm upgrade -i --create-namespace redis .
To get the Redis default password:
kubectl get secret --namespace "redis" redis -o jsonpath="{.data.redis-password}" | base64 --decode
Benchmark of the HMGET
To prepare testing data, we need to create 10 millions entries in hash key.
If we want to use different key/value, we need to use lua to generate 10 million different key/values for ‘counterhash’ hash table:
@redis-master-0:/tmp$ cp /dev/stdin counterhash.lua
for i=1, 10000000 do
redis.call('hset', 'counterhash', 'counter' .. i, i)
end
@redis-master-0:/tmp$ redis-cli -a cK56wtmkSg --eval counterhash.lua
Check the size of hashkey ‘counterhash’:
@redis-master-0:/$ redis-cli -a UpvoddWilx
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> HLEN counterhash
(integer) 10000000
Benchmark for HMGET when two fields are used:
@redis-master-0:/$ redis-benchmark -a UpvoddWilx -r 20000000 -n 20000000 HMGET counterhash "counter9679805" "counter9458449"
====== HMGET counterhash counter9679805 counter9458449 ====== 92)
20000000 requests completed in 297.01 seconds
50 parallel clients
75 bytes payload
keep alive: 1
host configuration "save":
host configuration "appendonly": yes
multi-thread: no
Summary:
throughput summary: 67338.93 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.392 0.064 0.399 0.543 0.743 5.183
Benchmark for HMGET when ten fields are used:
@redis-master-0:/$ redis-benchmark -a UpvoddWilx -r 20000000 -n 20000000 HMGET counterhash "counter9679800" "counter9679801" "counter9679802" "counter9679803" "counter9679804" "counter9679805" "counter9679806" "counter9679807" "counter9679808" "counter9679809"
====== HMGET counterhash counter9679800 counter9679801 counter9679802 counter9679803 counter9679804 counter9679805 counter9679806 counter9679807 counter9679808 counter9679809 ======
20000000 requests completed in 273.58 seconds
50 parallel clients
244 bytes payload
keep alive: 1
host configuration "save":
host configuration "appendonly": yes
multi-thread: no
Summary:
throughput summary: 73103.42 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.360 0.136 0.335 0.503 0.711 8.383