Skip to content

Redis Performance Measurement

Interactive Diagram

새 탭 ↗
Terminal window
$ git clone https://github.com/kloudbank/session-k8s.git
$ cd session-k8s
$ kubectl apply -k ./dev/ngrinder/controller
$ kubectl apply -k ./dev/ngrinder/agent

A performance measurement tool that Redis provides itself for RedisCluster and Sentinel setups.

  • aof:no
SET: 27932.96 requests per second, p50=0.783 msec
GET: 27948.57 requests per second, p50=0.775 msec
LPUSH: 27987.69 requests per second, p50=0.775 msec
LPOP: 28538.81 requests per second, p50=0.775 msec
  • aof:yes, aofsync:everysec
SET: 33579.59 requests per second, p50=0.375 msec
GET: 31289.11 requests per second, p50=0.399 msec
LPUSH: 33355.57 requests per second, p50=0.375 msec
LPOP: 33590.86 requests per second, p50=0.375 msec
  • aof:yes, aofsync:always
SET: 9087.60 requests per second, p50=5.655 msec
GET: 31908.10 requests per second, p50=0.391 msec
LPUSH: 8882.57 requests per second, p50=5.759 msec
LPOP: 9192.87 requests per second, p50=5.599 msec

Developed by Naver, this is a stress test tool that can simultaneously run script generation / test execution / monitoring and result report generation. http://naver.github.io/ngrinder/

  • Test Architecture
PlantUML Diagram
  • Conducted in a suitable environment that yields performance of at least 3000 TPS
  • nGrinder Agent x2
  • EBS Volume iops 3000
ContainerCPUMemory
Spring Boot0.5 / 44Gi
nGrinder0.5 / 24Gi
MariaDB0.5 / 1.01Gi
Redis0.3 / 0.50.5Gi

  • Calls a Spring Boot API that fetches the cached result of the MariaDB departments table (10 rows by default)
ConditionTPS
(max cpu)
vUserrowsrepl.mariadbredisredis AOF
everysec
redis AOF
always
10001012600 (380m)3630 (90m)3600 (90m)3650 (90m)
20001012600 (400m)2860 (70m)3000 (80m)3090 (80m)
30001012210 (350m)2310 (60m)2440 (60m)2370 (60m)
30001023270 (480m)3310 (90m)3230 (120m)3300 (80m)
100010001180 (110m)1620 (130m)1560 (80m)1580 (80m)
vUserrowsThresholdReplicasTPSErr.Comment
1000102min126000.0%
2000102min126000.0%
3000102min122100.1%Judged as a performance degradation zone
3000105min232700.0%Pod scale-out, 2210 -> 3270
100010002min11800.0%rows increased, 2600 -> 180
vUserrowsThresholdReplicasTPSErr.Comment
1000102min136300.0%
2000102min128600.0%
3000102min123100.9%Judged as a performance degradation zone
3000105min233100.0%Pod scale-out, 2310 -> 3320
100010002min116200.0%rows increased, 3630 -> 1620
vUserrowsThresholdReplicasTPSErr.Comment
1000102min136000.0%
2000102min130000.0%
3000102min124400.1%Judged as a performance degradation zone
3000105min232300.0%Pod scale-out, 2440 -> 3230
100010002min115600.0%rows increased, 3600 -> 1560
vUserrowsThresholdReplicasTPSErr.Comment
1000102min136500.0%
2000102min130900.0%
3000102min123700.1%Judged as a performance degradation zone
3000105min233000.0%Pod scale-out, 2370 -> 3300
100010002min115800.0%rows increased, 3650 -> 1580
  • Calls an API that SETs data into Redis with the same shape as 1 row of the MariaDB departments table
ConditionTPS
(max cpu)
vUserrepl.mariadbredisredis AOF
everysec
redis AOF
always
100011550 (980m)3170 (150m)2410 (150m)2300 (70m)
200011530 (980m)3270 (160m)2310 (130m)2200 (100m)
300011370 (970m)2840 (160m)2100 (130m)1900 (90)
300021940 (970m)3350 (220m)3260 (270m)3140 (180m)
vUserThresholdReplicasTPSErr.Comment
10002min115500.0%
20002min115300.0%
30002min113701.0%Judged as a performance degradation zone
40002min113501.2%
30005min219400.1%Pod scale-out, 1370 -> 1940
vUserThresholdReplicasTPSErr.Comment
10002min131700.0%
20002min132700.0%
30002min128400.1%Judged as a performance degradation zone
40002min125001.3%
30002min223000.1%replicas=2 in the degradation zone
with multiple pods, load distribution is delayed early in the run
30005min233500.0%Pod scale-out, 2840 -> 3350
vUserThresholdReplicasTPSErr.Comment
10002min124000.0%
20002min123100.1%
30002min121000.1%Judged as a performance degradation zone
40002min127001.3%When errors occur, TPS measurement appears somewhat inaccurate
60002min127002.6%When errors occur, TPS measurement appears somewhat inaccurate
30005min232600.0%Pod scale-out, 2100 -> 3260
vUserThresholdReplicasTPSErr.Comment
10002min123000.0%
20002min122000.0%
30002min119000.2%Judged as a performance degradation zone
40002min123001.4%When errors occur, TPS measurement appears somewhat inaccurate
60002min223009.9%When errors occur, TPS measurement appears somewhat inaccurate
30005min231400.0%Pod scale-out, 1900 -> 3140
  • See the Redis Persistence explanation http://redisgate.kr/redis/configuration/persistence.php
  • Based on the benchmark above and the nGrinder load test results, when the Redis instance’s resources stay stable, there is no significant performance difference even when persisting data
    • To verify the performance difference during persistence, an extreme load test was conducted
  • Environment
    • Resources minimized so that CPU is at 100% usage
    • Increased the size of the existing SET data (1 row) by 100
    • Increased so that a lot of memory can be used to persist data
    • EBS Volume iops 3000 -> 100
ContainerappendfsyncCPUMemory
redis-cache-aofeverysec0.1 / 0.14Gi
redis-cache-alwaysalways0.1 / 0.14Gi
  • Memory Usage

    • The redis configured with everysec occupies roughly twice as much memory
  • AOF Redis SET Test

vUserThresholdReplicasTPSMemory(max)Err.Comment
100010min19991747Mi0.0%
100010min16181028Mi2.0%Many errors occurred
(7,228 / 359,730)
  • Comparison of Benchmark vs suitable-environment test vs load test results
    • In the Redis Benchmark Test that does not go over the network, everysec write performance is superior
    • In measurements over a container-to-container network such as the Spring Boot API, no significant difference is observed
PersitenceappendfsyncTPS (B/M)TPS (suitable)TPS (load)
Redis AOFeverysec335792400999
Redis AOFalways90872300618
  • Killing the Redis instance during nGrinder performance measurement
  • After TPS stabilized at 1:40, Redis was killed to force Pod Self Healing
  • At the kill moment, Spring Boot raised “java.io.IOException: Connection reset by peer” | During the suitable performance measurement, nothing notable occurred
ContainerfsyncvUserThresholdReplicasTPSErr
Redisoff10003min127000.1%
Rediseverysec10003min127000.1%
Redisalways10003min126000.1%
  • Redis appendonly off, see container cpu usage : a self-healing instance is created within 10 seconds and resumes processing data

  • Redis appendonly off, see TPS : recovers to a stable TPS level within 10 seconds

Backup> When EBS Volume Mount fails and Self-Healing is delayed
Section titled “Backup> When EBS Volume Mount fails and Self-Healing is delayed”
  • With the current EBS gp3 type volume, Multi Attach is not possible, so when the deploy node changes the volume may not attach right away
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 21s default-scheduler Successfully assigned app-dev/redis-cache-always-7d6db7c847-hjh7j to ip-10-0-0-10.example.compute.internal
Warning FailedAttachVolume 22s attachdetach-controller Multi-Attach error for volume "pvc-00000000-0000-0000-0000-000000000000" Volume is already used by pod(s) redis-cache-always-7d6db7c847-9l54t
Normal SuccessfulAttachVolume 6s attachdetach-controller AttachVolume.Attach succeeded for volume "pvc-00000000-0000-0000-0000-000000000000"