[Redis]
- 얼마나 많은 요청을 한꺼번에 처리할 수 있는지
- 요청 하나를 처리하는 데 걸리는 시간(Latency) 등을 측정
Redis 성능 확인하기
- 명령어를 사용하기 위한 경로
root@97bd8fbf6f8d:/usr#
- 명령어 결과
root@97bd8fbf6f8d:/usr# redis-benchmark
====== PING_INLINE ======
100000 requests completed in 2.79 seconds # 만 개의 명령을 처리하는 데 걸린 시간 2.79초
50 parallel clients # 50개의 클라이언트 동시 연결
3 bytes payload # 저장 데이터의 크기 3바이트
keep alive: 1 # 클라이언트 연결 유지 상태 정보
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
0.00% <= 0.4 milliseconds
0.08% <= 0.5 milliseconds
2.13% <= 0.6 milliseconds
10.04% <= 0.7 milliseconds
25.00% <= 0.8 milliseconds
43.93% <= 0.9 milliseconds
63.18% <= 1.0 milliseconds
78.15% <= 1.1 milliseconds
87.81% <= 1.2 milliseconds
93.52% <= 1.3 milliseconds
96.47% <= 1.4 milliseconds
98.01% <= 1.5 milliseconds
98.73% <= 1.6 milliseconds
99.11% <= 1.7 milliseconds
99.33% <= 1.8 milliseconds
99.45% <= 1.9 milliseconds
99.54% <= 2 milliseconds
99.92% <= 3 milliseconds
99.98% <= 4 milliseconds
100.00% <= 4 milliseconds
35842.29 requests per second # 초당 처리된 명령 수
====== PING_BULK ======
100000 requests completed in 2.71 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
54.86% <= 1 milliseconds
99.78% <= 2 milliseconds
99.98% <= 3 milliseconds
100.00% <= 3 milliseconds
36954.91 requests per second
====== SET ======
100000 requests completed in 2.87 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
65.98% <= 1 milliseconds
99.96% <= 2 milliseconds
100.00% <= 2 milliseconds
34867.50 requests per second
====== GET ======
100000 requests completed in 2.83 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
66.07% <= 1 milliseconds
99.98% <= 2 milliseconds
100.00% <= 2 milliseconds
35360.68 requests per second
====== INCR ======
100000 requests completed in 2.82 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
66.94% <= 1 milliseconds
99.99% <= 2 milliseconds
100.00% <= 2 milliseconds
35486.16 requests per second
====== LPUSH ======
100000 requests completed in 2.87 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
64.74% <= 1 milliseconds
99.95% <= 2 milliseconds
99.99% <= 3 milliseconds
100.00% <= 3 milliseconds
34806.82 requests per second
====== RPUSH ======
100000 requests completed in 2.87 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
64.67% <= 1 milliseconds
99.87% <= 2 milliseconds
99.99% <= 3 milliseconds
100.00% <= 3 milliseconds
34867.50 requests per second
====== LPOP ======
100000 requests completed in 2.89 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
65.48% <= 1 milliseconds
99.92% <= 2 milliseconds
100.00% <= 3 milliseconds
100.00% <= 3 milliseconds
34602.07 requests per second
====== RPOP ======
100000 requests completed in 2.91 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
64.82% <= 1 milliseconds
99.96% <= 2 milliseconds
100.00% <= 2 milliseconds
34399.72 requests per second
====== SADD ======
100000 requests completed in 2.94 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
0.00% <= -33 milliseconds
0.03% <= -32 milliseconds
0.04% <= 0 milliseconds
58.66% <= 1 milliseconds
99.55% <= 2 milliseconds
99.98% <= 3 milliseconds
100.00% <= 3 milliseconds
34013.61 requests per second
====== HSET ======
100000 requests completed in 2.96 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
61.09% <= 1 milliseconds
99.89% <= 2 milliseconds
100.00% <= 2 milliseconds
33726.81 requests per second
====== SPOP ======
100000 requests completed in 2.74 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
64.93% <= 1 milliseconds
99.94% <= 2 milliseconds
99.99% <= 3 milliseconds
100.00% <= 3 milliseconds
36496.35 requests per second
====== LPUSH (needed to benchmark LRANGE) ======
100000 requests completed in 2.88 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
63.70% <= 1 milliseconds
99.95% <= 2 milliseconds
100.00% <= 2 milliseconds
34698.12 requests per second
====== LRANGE_100 (first 100 elements) ======
100000 requests completed in 3.45 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
47.14% <= 1 milliseconds
99.90% <= 2 milliseconds
100.00% <= 2 milliseconds
28993.91 requests per second
====== LRANGE_300 (first 300 elements) ======
100000 requests completed in 5.92 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
0.01% <= 1 milliseconds
97.25% <= 2 milliseconds
99.96% <= 3 milliseconds
100.00% <= 3 milliseconds
16889.04 requests per second
====== LRANGE_500 (first 450 elements) ======
100000 requests completed in 7.05 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
0.00% <= 1 milliseconds
84.77% <= 2 milliseconds
99.68% <= 3 milliseconds
99.96% <= 4 milliseconds
100.00% <= 4 milliseconds
14176.35 requests per second
====== LRANGE_600 (first 600 elements) ======
100000 requests completed in 8.47 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
0.00% <= -32 milliseconds
0.00% <= -31 milliseconds
0.02% <= -30 milliseconds
0.03% <= 0 milliseconds
0.04% <= 1 milliseconds
20.78% <= 2 milliseconds
97.89% <= 3 milliseconds
99.84% <= 4 milliseconds
99.94% <= 5 milliseconds
99.99% <= 6 milliseconds
100.00% <= 6 milliseconds
11800.80 requests per second
====== MSET (10 keys) ======
100000 requests completed in 3.03 seconds
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
49.40% <= 1 milliseconds
99.90% <= 2 milliseconds
100.00% <= 2 milliseconds
32959.79 requests per second
성능 측정 세부 설정
- 50 바이트와 1,024바이트의 데이터를 문자열, 리스트, set 데이터형으로 저장하고 읽어내는 데 걸리는 시간 측정 결과를 진행률을 제외하고 출력
root@97bd8fbf6f8d:/usr# redis-benchmark -d 50 -q -t get,set,lpush,lpop,sadd,spop
SET: 34566.20 requests per second
GET: 35511.36 requests per second
LPUSH: 34698.12 requests per second
LPOP: 34518.46 requests per second
SADD: 33978.93 requests per second
SPOP: 34770.52 requests per second
root@97bd8fbf6f8d:/usr# redis-benchmark -d 1024 -q -t get,set,lpush,lpop,sadd,spop
SET: 34129.69 requests per second
GET: 34734.29 requests per second
LPUSH: 33715.44 requests per second
LPOP: 33222.59 requests per second
SADD: 34806.82 requests per second
SPOP: 34566.20 requests per second
- 데이터의 크기가 20배 정도 늘었으나 읽기와 쓰기 횟수는 10% 정도 차이 밖에 나지 않는다.
- 백만 개의 키를 문자열 데이터로 추가하는 테스트 명령
root@97bd8fbf6f8d:/usr# redis-benchmark -t set -n 1000000 -r 1000000
====== SET ======
1000000 requests completed in 29.68 seconds # 백만 개의 데이터를 입력하는 데 약 29초 소요
50 parallel clients
3 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
0.00% <= -32.8 milliseconds
0.00% <= -32.7 milliseconds
0.00% <= -32.6 milliseconds
0.00% <= -32.5 milliseconds
0.00% <= -32.4 milliseconds
0.00% <= -32.3 milliseconds
0.00% <= -32.2 milliseconds
0.00% <= -32.0 milliseconds
0.00% <= 0.4 milliseconds
0.01% <= 0.5 milliseconds
0.52% <= 0.6 milliseconds
4.87% <= 0.7 milliseconds
18.67% <= 0.8 milliseconds
39.65% <= 0.9 milliseconds
60.82% <= 1.0 milliseconds
77.10% <= 1.1 milliseconds
87.37% <= 1.2 milliseconds
93.07% <= 1.3 milliseconds
96.13% <= 1.4 milliseconds
97.75% <= 1.5 milliseconds
98.59% <= 1.6 milliseconds
99.03% <= 1.7 milliseconds
99.28% <= 1.8 milliseconds
99.43% <= 1.9 milliseconds
99.51% <= 2 milliseconds
99.87% <= 3 milliseconds
99.99% <= 4 milliseconds
100.00% <= 5 milliseconds
100.00% <= 5 milliseconds
33697.26 requests per second # 초당 3만 3천개 이상의 데이터를 저장
- 레디스 성능 측정 도구 옵션
옵션 | 설명 | 기본값 |
-h <hostname> | 테스트를 수행하기 위해 접속할 레디스 서버의 호스트명 | 127.0.0.1 |
-p <port> | 테스트를 수행하기 위해 접속할 레디스 서버의 포트 | 6379 |
-s <socket> | 테스트를 수행하기 위해 접속할 레디스 서버의 유닉스 서버 소켓 | - |
-c <clients> | 테스트를 위한 가상 클라이언트의 동시 접속 수 | 50 |
-n <requests> | 각 명령의 테스트 횟수 | 10000 |
-d <size> | 테스트에 사용할 데이터 크기 | 3* |
-k <boolean> | 테스트를 위한 가상 클라이언트의 접속 유지 여부 | 1: 접속유지, 0: 접속 유지하지 않음 |
-r <keyspacelen> | 테스트에 사용할 랜덤 키의 범위 | 0 |
-P <numreq> | 파이프라인 명령을 사용한 테스트와 파이프라인당 요청할 명령의 개수 | 0: 파이프라인 미사용 |
-q | 테스트 진행 상황을 출력하지 않고 결과만 출력하기 | - |
--csv | 테스트 결과를 csv 포맷으로 출력하기 | - |
-l | 브레이크(ctrl + c)를 걸기 전까지 계속 수행 | - |
-t <tests> | 쉼표로 구분된 테스트 명령의 목록 | - |
-l | 명령 전송 없는 연결 생성 후 브레이크 입력(ctrl + c) 때까지 대기 | - |