Redis Server Performance

Redis Server Course Redis Technical Support Redis Enterprise Server

레디스 서버 성능 New

Redis-7과 8 성능 비교

Redis-8을 출시(2025년 5월 02일)하면서 아래 '막대 그래프 이미지'를 보면 성능이 이전 버전보다 매우 좋아진 것으로 발표했습니다. 그래서 benchmark를 사용해서 Redis-7과 Redis-8의 성능을 비교 확인해 보았습니다.

redis performance

테스트 서버 Spec

H/W Model: Dell R230 Xeon E3-1230v6(3.5G/4코어)
CPU: Intel(R) Xeon(R) CPU E3-1230 v6 @ 3.50GHz, 4cores/8threads
Memory: 8G
OS: CentOS 7.5
C Compiler: gcc 8.3.1

Redis-7.2.7과 Redis-8.0.0 명령별 성능 비교

  • 평균(입력): 입력 명령들 평균이 초당 114,500으로 Redis-7과 Redis-8이 거의 비슷했습니다.
  • 평균(전체): 대량 조회 명령을 포함한 전체 평균은 초당 97,700으로 Redis-7과 Redis-8이 거의 비슷했습니다.
  • 결론: (실무적인 관점에서) Redis-7과 Redis-8의 성능은 거의 차이나지 않습니다.
CommandsRedis-7.2.7Redis-8.0.0 비교
SET 115,473116,414 101%
GET112,486112,360 100%
INCR116,144116,279 100%
LPUSH115,875116,550 101%
RPUSH115,473116,279 101%
LPOP116,144112,233 97%
RPOP116,009116,414 100%
SADD111,111114,416 103%
HSET115,607115,607 100%
SPOP112,613112,867 100%
ZADD113,250114,943 101%
ZPOPMIN112,486113,507 101%
LPUSH116,414116,550 100%
평균(입력)114,545114,955100%
LRANGE_10066,05065,876 100%
LRANGE_30030,59030,358 99%
LRANGE_50020,84219,708 95%
LRANGE_60017,86417,117 96%
MSET115,473116,009 100%
XADD116,822116,009 99%
평균(전체)97,72397,868 100%

* 레디스는 거의 기본으로 설정(redis.conf)했고, Redis-benchmark도 기본으로 실행했습니다.
* Server io-threads 1, benchmark threads 1

Redis-7 io-threads 설정 성능 비교

Redis-6부터 클라이언트로부터 오는 명령 읽기(read)와 결과 내보내기(write)를 별도 스레드로 처리할 수 있습니다. redis.conf 관련 파라이터는 아래와 같습니다.

  • io-threads 1: default 1, 설정할 경우 CPU 코어수 - 1, 8코어(스레드)인 경우 7로 설정.
  • io-threads-do-reads no/yes: default no. 권장: yes
    redis.conf 설명에 yes로 설정하는 것이 별로 도움이 되지 않는다고 적혀있으나 테스트 결과를 보면 yes로 설정해야 성능이 향상됩니다.
    redis.conf: "Usually threading reads doesn't help much." (읽기는 별 도움이 되지 않습니다.)

테스트 Case

  • Case1: server io-threads 1, io-threads-do-reads no, benchmark threads 1 -> 기본 설정 100%
  • Case2: server io-threads 7, io-threads-do-reads no, benchmark threads 1 -> 성능이 떨어진다. 96%
  • Case3: server io-threads 7, io-threads-do-reads no, benchmark threads 7 -> 성능이 떨어진다. 96%
  • Case4: server io-threads 7, io-threads-do-reads yes, benchmark threads 7 -> 성능이 좋아진다. 116%
  • 결론: 'io-threads'를 사용하면 성능이 조금 좋아진다. 하지만 서버 CPU를 400~500% 사용한다. 그리고 클라이언트도 스레드 개수를 맞추어야 하는 번거로움이 있어서 실무적으로 볼 때 굳이 사용할 필요는 없어 보인다.
Commands Case1
(1/no/1)
Case2
(7/no/1)
비교1 Case3
(7/no/7)
비교2 Case4
(7/yes/7)
비교3
SET115,473114,81199%99,80086%132,979115%
GET112,486110,86599%132,979118%132,979118%
INCR116,144114,81199%99,70186%132,979114%
LPUSH115,875115,741100%99,50286%132,979115%
RPUSH115,473115,207100%99,80086%131,406114%
LPOP116,144115,34099%99,20685%133,156115%
RPOP116,009115,875100%99,80086%132,979115%
SADD111,111111,483100%99,80090%132,979120%
HSET115,607111,85797%99,70186%133,156115%
SPOP112,61392,33682%132,626118%132,626118%
ZADD113,25099,40488%133,156118%132,802117%
ZPOPMIN112,486102,24991%132,626118%133,333119%
LPUSH116,414115,34099%99,10885%132,802114%
평균(입력)114,545110,40996%109,83196%132,858116%
LRANGE_10066,05065,57499%49,87576%56,85086%
LRANGE_30030,59030,722100%26,57587%24,90781%
LRANGE_50020,84220,825100%15,94176%16,61180%
LRANGE_60017,86417,60699%13,75377%13,30574%
MSET115,473108,34294%79,80869%79,80869%
XADD116,82299,70185%99,80085%99,60285%
평균(전체)97,72393,58496%90,18792%106,223109%

Redis-8 io-threads 설정 성능 비교

'io-threads'가 크게 개선되었다. 그리고 관련 소스 코드가 networking.c에 있었는데 iothread.c 파일을 새로 만들어서 옮겼다.

  • io-threads 1: default 1, 설정할 경우 CPU 코어수 - 1, 8코어(스레드)인 경우 7로 설정.
  • io-threads-do-reads: Redis-8에서 이 항목이 없어졌다.

테스트 Case

  • Case1: server io-threads 1, benchmark threads 1 -> 기본 설정 100%
  • Case2: server io-threads 7, benchmark threads 1-> 성능이 떨어진다. 82%
  • Case3: server io-threads 7, benchmark threads 7 -> 성능이 매우 좋아진다. 173%
  • 결론: 'io-threads'를 사용하면 성능이 크게 좋아집니다. 클라이언트 스레드 개수를 맞추어야 하는 번거로움이 있지만 시도해 볼만합니다.
Commands Case1 (1/1) Case2 (7/1) 비교1 Case3 (7/7) 비교2
SET116,41482,85071%199,203171%
GET112,36094,60784%199,203177%
INCR116,27995,05782%197,239170%
LPUSH116,55095,51182%195,312168%
RPUSH116,27994,96782%197,239170%
LPOP112,23396,89986%196,850175%
RPOP116,41494,87781%198,807171%
SADD114,41693,19781%198,807174%
HSET115,60795,14782%198,020171%
SPOP112,86794,78784%199,203176%
ZADD114,94393,37181%199,203173%
ZPOPMIN113,50795,51184%199,601176%
LPUSH116,55099,80086%199,601171%
평균(입력)114,95594,35282%198,330173%
LRANGE_10065,87660,35092%99,701151%
LRANGE_30030,35828,15393%56,980188%
LRANGE_50019,70819,19497%36,284184%
LRANGE_60017,11716,63697%28,458166%
MSET116,00998,23285%132,979115%
XADD116,00997,08784%199,203172%
평균(전체)97,86881,38183%164,837168%

* 8코어 서버에서 io-threads 14로 설정하면 오히려 성능이 떨어집니다.

CPU 별 Redis 성능

CPU (Intel Xeon) OS SET GET 비교
Platinum 8358 2.6GHz 2tRed Hat 8.6178,000187,0002024년 10월
Gold 5217 3.0GHz 32tRed Hat 8.687,00091,0002023년 12월
Gold 5317 3.0GHz 8tRed Hat 8.6205,000189,0002024년 02월
Gold 5515+ 3.2GHzRed Hat 8.10205,338185,8732024년 11월
Gold 6138 2.0GHz 2tCentOS 7.996,700 2022년 08월
Gold 6230 2.1GHz 4tRed Hat 8.4132,626130,3782024년 11월
Gold 6244 3.6GHz 16t Oracle Linux 8.4166,000 2022년 06월
Gold 6248R 3.0GHz 8tRed Hat 8.4103,500 2023년 11월
Gold 6248R 3.0GHz 4tRed Hat 7.8150,000 2022년 02월
Gold 6254 3.1GHzRed Hat 6.99100,000 2021년 03월
Gold 6326 2.9GHzUbuntu22.04.5130,000125,0002024년 11월
Gold 6346 3.1GHz 8tRed Hat 8.6220,000195,0002024년 04월
Gold 6348 2.6GHz 8tRed Hat 8.4195,848 2023년 04월
Gold 6442Y Red Hat 8.10182,149162,8662025년 04월
Gold 6526Y 32tRocky Linux 9.5192,307186,2192025년 02월
Silver 4108 1.8GHz 4tRocky Linux 9.451,50056,4002024년 06월
Silver 4208 2.1GHz 16tCentOS 7.7140,000140,0002021년 09월
Silver 4309Y 2.8GHz 16tRocky Linux 8.10202,020207,9002024년 04월
E5-2623 v4 2.6GHzRocky Linux 8.583,00091,0002024년 09월
E5-2680 v4 2.4GHz 4tCentOS 7.962,00070,0002024년 03월
ToastCloud Virtual Gen2 16tCentOS 7.974,000 2024년 01월


레디스 서버 성능 2

성능 테스트 서버 사양 Specification

Redis Server : Version 3.0.1
OS : CentOS 7
H/W Model: HP DL320e Gen8 v2
Processor : Intel Xeon E3-1231V3.3 3.4GHz
Main Memory: DDR3 8GB RAM
Disk 1: SSD 256GB
Disk 2: SATA3 1TB

Redis-benchmark 기본 테스트

  • 테스트 결과
  • Case 1: Appendonly No
    Case 2: Appendonly Yes, everysec, Disk: SSD
    Case 3: Appendonly Yes, everysec, Disk: SATA3

    CommandsCase 1Case 2Case 3 Remark
    PING_INLINE 207,468208,333217,864
    PING_BULK 257,069261,096260,416
    SET 260,416263,852266,666
    GET 261,096261,096258,397
    INCR 263,157268,817269,541
    LPUSH 263,852269,541266,666
    LPOP 261,780268,817268,096
    SADD 264,550265,957267,379
    SPOP 265,252266,666263,852
    평균(입력) 262,872266,392265,800
    LRANGE_100 97,75198,32897,276 first 100 elements
    LRANGE_300 37,07836,87336,941 first 300 elements
    LRANGE_500 25,94025,77925,786 first 450 elements
    LRANGE_600 19,92419,95219,813 first 600 elements
    MSET 208,768161,550168,350 10 keys
    평균(전체) 185,797183,936184,064

  • 테스트 결과를 보면 SET, INCR, LPUSH 같은 대표적인 명령들이 초당 26만회 정도 처리한다.
  • Appendonly 여부와 상관없이 비슷한 성능이 나왔다.
    Appendonly를 everysec로 설정해서 운영하면 성능에 별 영향이 없을것으로 판단된다.
  • Appendonly를 always 설정하면 초당 1200회 처리하는 것으로 나왔다.
    Always로 하고 레디스를 사용하는 것은 고려하지 않는것이 좋을거 같다.

Master-Slaves SET 테스트

  • Master : appendonly no, rdb no
  • 260,416 requests per second
  • Master -> Slave1 : appendonly no, rdb no
  • 241,466 requests per second
  • Master -> Slave1 -> Slave2 : appendonly no, rdb no
  • 226,730 requests per second
  • Master -> Slave1 -> Slave2 : Slave2 만 appendonly yes 로 설정, rdb no
  • 220,306 requests per second
  • Master -> SlaveA1 : appendonly no, rdb no
               -> SlaveB1 : appendonly no, rdb no
  • 200,154 requests per second
  • Master : 물리 메모리(RAM) 용량을 초과해서 Swaping 될때 성능이 1/4로 이하로 떨어지므로 메모리를 초과해서 사용하지 않도록 모니터링을 해야 하고, 성능이 떨어졌을때 Swaping 때문인지 확인해 봐야 한다.
  • 51,156 requests per second, 정상 수치 : 260,416
  • Swap 영역을 사용하게 되면 470MB RDB 파일 BGSAVE나 BGREWRITEAOF를 하는데도 상당한 시간이 소요된다.

Data size에 따른 성능

  • H/W: PowerEdge R230
  • CPU: Intel(R) Xeon(R) CPU E3-1230 v6 @ 3.50GHz
  • # src/redis-benchmark -p 6000 -t set -d 10
    103519.66 requests per second <- aof on everysec
  • # src/redis-benchmark -p 6000 -t set -d 100
    102880.66 requests per second <- aof on everysec
  • # src/redis-benchmark -p 6000 -t set -d 1000 -> 1k
    94250.71 requests per second <- aof on everysec
  • # src/redis-benchmark -p 6000 -t set -d 10000 -> 10k
    31486.14 requests per second <- aof on everysec
    93196.65 requests per second <- aof no
  • # src/redis-benchmark -p 6000 -t set -d 100000 -> 100k
    2329.97 requests per second <- aof on everysec
    18786.40 requests per second <- aof no
    21074.82 requests per second <- get
  • # src/redis-benchmark -p 6000 -t set -d 200000 -> 200k
    1200.54 requests per second <- aof on everysec
    8776.55 requests per second <- aof no
    9367.68 requests per second <- get
  • # src/redis-benchmark -p 6000 -t set -d 300000 -> 300k
    813.25 requests per second <- aof on everysec
    6346.39 requests per second <- aof no
    5862.35 requests per second <- get

CPU 별 benchmark test

  • cat /proc/cpuinfo
  • Intel Xeon(R) Gold 5220 2.20GHz -> 30,000 ops
    CentOS 7.8, docker, Redis 5.0.9
  • Intel Xeon(R) Gold 6226 2.7GHz -> 90,000 ops
    RedHat 7.6, Redis 5.0.10
  • Intel Xeon(R) Gold 6254 CPU @ 3.10GHz -> 100,000ops
    RedHat 6.99
  • Intel(R) Xeon(R) Silver 4215 CPU @ 2.50GHz -> 140,000ops
    CentOS 7.6
  • 2.0Gz, VM -> 50,000 ops
    3.8GHz, Bare Metal -> 150,000 ops
    CentOS 7
  • 2.20GHz -> 100,000 ops
    Bare Metal, Redis 5.0.10

Redis 성능

redis performance
  • 멀티 클라이언트 vs 레디스 서버 싱글 스레드

성능에 관한 글


<< Architecture Overview Redis Server Performance Redis-cli >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.