NoSQL 관련 다양한 DB에 성능테스트를 해 볼 수 있다.
다운로드 : https://github.com/brianfrankcooper/YCSB
하나의 데이터가 1K인 데이터를 이용하여 SELECT, INSERT, UPDATE 등을 테스트 할 수 있게 제공한다.
1. 설치
1. 자바가 설치 되어 있어야 한다. (기존에 설치 되어 있는 상태에서 진행을 해서, 꼭 필요한지는 확인 필요)
2. ycsb 파일을 다운 받는다.
wget https://github.com/brianfrankcooper/YCSB/releases/download/0.17.0/ycsb-0.17.0.tar.gz
tar xfvz ycsb-0.17.0.tar.gz
2. 사용 법
Load : 테스트 데이터를 대상 DB에 넣는다.
Run : 테스트 데이터를 이용하여 벤치 마크 수행
workloads 디렉터리 밑에 존재하는 템플릿 중에서 자신이 테스트 하고자 하는 상황에 맞는 파일을 선택하거나, 수정해서 사용 할 수 있다.
각 각의 파일들을 한번 씩 열어 보면 Read/Write 비율이 각각 다름을 확인 할 수 있다.
3. MongoDB 테스트
테스트 대상 몽고 DB 상황
Admin DB에 root / root1122 유저로 인증을 해야 하며, 포트는 9999 이다.
MongoDB 테스트를 위해서 mongodb-binding 디렉터리 밑에 README.md 파일을 보면 자세한 사용법이 나와 있다.
테스트 데이터 생성 |
[root@pgmongo ycsb-0.17.0]# ./bin/ycsb load mongodb -s -P workloads/workloada -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin java -cp /media/ycsb/ycsb-0.17.0/mongodb-binding/conf:/media/ycsb/ycsb-0.17.0/conf:/media/ycsb/ycsb-0.17.0/lib/core-0.17.0.jar:/media/ycsb/ycsb-0.17.0/lib/htrace-core4-4.1.0-incubating.jar:/media/ycsb/ycsb-0.17.0/lib/jackson-mapper-asl-1.9.4.jar:/media/ycsb/ycsb-0.17.0/lib/jackson-core-asl-1.9.4.jar:/media/ycsb/ycsb-0.17.0/lib/HdrHistogram-2.1.4.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongo-java-driver-3.8.0.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/logback-classic-1.1.2.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/slf4j-api-1.7.25.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongodb-async-driver-2.0.1.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/snappy-java-1.1.7.1.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/logback-core-1.1.2.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongodb-binding-0.17.0.jar site.ycsb.Client -db site.ycsb.db.MongoDbClient -s -P workloads/workloada -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin -load Command line: -db site.ycsb.db.MongoDbClient -s -P workloads/workloada -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin -load YCSB Client 0.17.0 Loading workload... Starting test. 2020-09-10 15:05:26:356 0 sec: 0 operations; est completion in 0 second mongo client connection created with mongodb://root:root1122@localhost:9999/ycsb?authSource=admin DBWrapper: report latency for each error is false and specific error codes to track for latency are: [] 2020-09-10 15:05:27:285 0 sec: 1000 operations; 1052.63 current ops/sec; [CLEANUP: Count=1, Max=1633, Min=1633, Avg=1633, 90=1633, 99=1633, 99.9=1633, 99.99=1633] [INSERT: Count=1000, Max=136703, Min=203, Avg=548.51, 90=666, 99=1211, 99.9=2923, 99.99=136703] [OVERALL], RunTime(ms), 950 [OVERALL], Throughput(ops/sec), 1052.6315789473683 [TOTAL_GCS_PS_Scavenge], Count, 0 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 0 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.0 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 0 [TOTAL_GC_TIME], Time(ms), 0 [TOTAL_GC_TIME_%], Time(%), 0.0 [CLEANUP], Operations, 1 [CLEANUP], AverageLatency(us), 1633.0 [CLEANUP], MinLatency(us), 1633 [CLEANUP], MaxLatency(us), 1633 [CLEANUP], 95thPercentileLatency(us), 1633 [CLEANUP], 99thPercentileLatency(us), 1633 [INSERT], Operations, 1000 [INSERT], AverageLatency(us), 548.506 [INSERT], MinLatency(us), 203 [INSERT], MaxLatency(us), 136703 [INSERT], 95thPercentileLatency(us), 816 [INSERT], 99thPercentileLatency(us), 1211 [INSERT], Return=OK, 1000 |
Read/Write 테스트 |
[root@pgmongo ycsb-0.17.0]# ./bin/ycsb run mongodb -s -P workloads/workloada -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin java -cp /media/ycsb/ycsb-0.17.0/mongodb-binding/conf:/media/ycsb/ycsb-0.17.0/conf:/media/ycsb/ycsb-0.17.0/lib/core-0.17.0.jar:/media/ycsb/ycsb-0.17.0/lib/htrace-core4-4.1.0-incubating.jar:/media/ycsb/ycsb-0.17.0/lib/jackson-mapper-asl-1.9.4.jar:/media/ycsb/ycsb-0.17.0/lib/jackson-core-asl-1.9.4.jar:/media/ycsb/ycsb-0.17.0/lib/HdrHistogram-2.1.4.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongo-java-driver-3.8.0.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/logback-classic-1.1.2.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/slf4j-api-1.7.25.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongodb-async-driver-2.0.1.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/snappy-java-1.1.7.1.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/logback-core-1.1.2.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongodb-binding-0.17.0.jar site.ycsb.Client -db site.ycsb.db.MongoDbClient -s -P workloads/workloada -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin -t Command line: -db site.ycsb.db.MongoDbClient -s -P workloads/workloada -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin -t YCSB Client 0.17.0 Loading workload... Starting test. 2020-09-10 15:10:02:204 0 sec: 0 operations; est completion in 0 second mongo client connection created with mongodb://root:root1122@localhost:9999/ycsb?authSource=admin DBWrapper: report latency for each error is false and specific error codes to track for latency are: [] 2020-09-10 15:10:03:232 1 sec: 1000 operations; 945.18 current ops/sec; [READ: Count=491, Max=141823, Min=264, Avg=795.13, 90=812, 99=1165, 99.9=141823, 99.99=141823] [CLEANUP: Count=1, Max=1614, Min=1614, Avg=1614, 90=1614, 99=1614, 99.9=1614, 99.99=1614] [UPDATE: Count=509, Max=9599, Min=269, Avg=514.3, 90=688, 99=1132, 99.9=1529, 99.99=9599] [OVERALL], RunTime(ms), 1058 [OVERALL], Throughput(ops/sec), 945.179584120983 [TOTAL_GCS_PS_Scavenge], Count, 0 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 0 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.0 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 0 [TOTAL_GC_TIME], Time(ms), 0 [TOTAL_GC_TIME_%], Time(%), 0.0 [READ], Operations, 491 [READ], AverageLatency(us), 795.1262729124236 [READ], MinLatency(us), 264 [READ], MaxLatency(us), 141823 [READ], 95thPercentileLatency(us), 934 [READ], 99thPercentileLatency(us), 1165 [READ], Return=OK, 491 [CLEANUP], Operations, 1 [CLEANUP], AverageLatency(us), 1614.0 [CLEANUP], MinLatency(us), 1614 [CLEANUP], MaxLatency(us), 1614 [CLEANUP], 95thPercentileLatency(us), 1614 [CLEANUP], 99thPercentileLatency(us), 1614 [UPDATE], Operations, 509 [UPDATE], AverageLatency(us), 514.2986247544204 [UPDATE], MinLatency(us), 269 [UPDATE], MaxLatency(us), 9599 [UPDATE], 95thPercentileLatency(us), 831 [UPDATE], 99thPercentileLatency(us), 1132 [UPDATE], Return=OK, 509 |
workloads/workloada 파일은 1000건의 데이터를 가지고 테스트를 하기에 너무 작아서 100,000 건으로 테스트 하기 위해서 파일을 수정해서 다시 시작 한다.
[root@pgmongo ycsb-0.17.0]# cd workloads/
[root@pgmongo workloads]# cp workloada workloada_100000
[root@pgmongo workloads]# vi workloada_100000
recordcount=100000
operationcount=100000
두 개의 값을 변경해 주고 저장
다시 테스트를 하기 위해서 몽고 DB에 접속해서 기존의 데이터 삭제
use ycsb
db.usertable.drop()
다시 데이터 만들고 테스트 진행 |
[root@pgmongo ycsb-0.17.0]# ./bin/ycsb load mongodb -s -P workloads/workloada_100000 -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin java -cp /media/ycsb/ycsb-0.17.0/mongodb-binding/conf:/media/ycsb/ycsb-0.17.0/conf:/media/ycsb/ycsb-0.17.0/lib/core-0.17.0.jar:/media/ycsb/ycsb-0.17.0/lib/htrace-core4-4.1.0-incubating.jar:/media/ycsb/ycsb-0.17.0/lib/jackson-mapper-asl-1.9.4.jar:/media/ycsb/ycsb-0.17.0/lib/jackson-core-asl-1.9.4.jar:/media/ycsb/ycsb-0.17.0/lib/HdrHistogram-2.1.4.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongo-java-driver-3.8.0.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/logback-classic-1.1.2.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/slf4j-api-1.7.25.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongodb-async-driver-2.0.1.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/snappy-java-1.1.7.1.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/logback-core-1.1.2.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongodb-binding-0.17.0.jar site.ycsb.Client -db site.ycsb.db.MongoDbClient -s -P workloads/workloada_100000 -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin -load Command line: -db site.ycsb.db.MongoDbClient -s -P workloads/workloada_100000 -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin -load YCSB Client 0.17.0 Loading workload... Starting test. 2020-09-10 15:16:19:871 0 sec: 0 operations; est completion in 106751991167300 days 15 hours mongo client connection created with mongodb://root:root1122@localhost:9999/ycsb?authSource=admin DBWrapper: report latency for each error is false and specific error codes to track for latency are: [] 2020-09-10 15:16:29:851 10 sec: 58140 operations; 5814 current ops/sec; est completion in 8 second [INSERT: Count=58173, Max=146175, Min=120, Avg=161.82, 90=189, 99=430, 99.9=859, 99.99=5167] 2020-09-10 15:16:35:711 15 sec: 100000 operations; 7140.91 current ops/sec; [CLEANUP: Count=1, Max=3025, Min=3024, Avg=3025, 90=3025, 99=3025, 99.9=3025, 99.99=3025] [INSERT: Count=41827, Max=7331, Min=117, Avg=137.75, 90=155, 99=195, 99.9=321, 99.99=700] [OVERALL], RunTime(ms), 15863 [OVERALL], Throughput(ops/sec), 6303.977809998109 [TOTAL_GCS_PS_Scavenge], Count, 5 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 64 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.4034545798398789 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 5 [TOTAL_GC_TIME], Time(ms), 64 [TOTAL_GC_TIME_%], Time(%), 0.4034545798398789 [CLEANUP], Operations, 1 [CLEANUP], AverageLatency(us), 3025.0 [CLEANUP], MinLatency(us), 3024 [CLEANUP], MaxLatency(us), 3025 [CLEANUP], 95thPercentileLatency(us), 3025 [CLEANUP], 99thPercentileLatency(us), 3025 [INSERT], Operations, 100000 [INSERT], AverageLatency(us), 151.75476 [INSERT], MinLatency(us), 117 [INSERT], MaxLatency(us), 146175 [INSERT], 95thPercentileLatency(us), 195 [INSERT], 99thPercentileLatency(us), 279 [INSERT], Return=OK, 100000 |
[root@pgmongo ycsb-0.17.0]# ./bin/ycsb run mongodb -s -P workloads/workloada_100000 -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin java -cp /media/ycsb/ycsb-0.17.0/mongodb-binding/conf:/media/ycsb/ycsb-0.17.0/conf:/media/ycsb/ycsb-0.17.0/lib/core-0.17.0.jar:/media/ycsb/ycsb-0.17.0/lib/htrace-core4-4.1.0-incubating.jar:/media/ycsb/ycsb-0.17.0/lib/jackson-mapper-asl-1.9.4.jar:/media/ycsb/ycsb-0.17.0/lib/jackson-core-asl-1.9.4.jar:/media/ycsb/ycsb-0.17.0/lib/HdrHistogram-2.1.4.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongo-java-driver-3.8.0.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/logback-classic-1.1.2.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/slf4j-api-1.7.25.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongodb-async-driver-2.0.1.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/snappy-java-1.1.7.1.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/logback-core-1.1.2.jar:/media/ycsb/ycsb-0.17.0/mongodb-binding/lib/mongodb-binding-0.17.0.jar site.ycsb.Client -db site.ycsb.db.MongoDbClient -s -P workloads/workloada_100000 -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin -t Command line: -db site.ycsb.db.MongoDbClient -s -P workloads/workloada_100000 -p mongodb.url=mongodb://root:root1122@localhost:9999/ycsb?authSource=admin -t YCSB Client 0.17.0 Loading workload... Starting test. 2020-09-10 15:17:28:584 0 sec: 0 operations; est completion in 0 second mongo client connection created with mongodb://root:root1122@localhost:9999/ycsb?authSource=admin DBWrapper: report latency for each error is false and specific error codes to track for latency are: [] 2020-09-10 15:17:38:555 10 sec: 49095 operations; 4909.5 current ops/sec; est completion in 11 seconds [READ: Count=24488, Max=39647, Min=137, Avg=182.8, 90=218, 99=548, 99.9=977, 99.99=6879] [UPDATE: Count=24638, Max=137855, Min=151, Avg=200.71, 90=228, 99=520, 99.9=1053, 99.99=8519] 2020-09-10 15:17:46:875 18 sec: 100000 operations; 6117.65 current ops/sec; [READ: Count=25465, Max=8471, Min=130, Avg=154.23, 90=172, 99=208, 99.9=287, 99.99=1328] [CLEANUP: Count=1, Max=2343, Min=2342, Avg=2343, 90=2343, 99=2343, 99.9=2343, 99.99=2343] [UPDATE: Count=25409, Max=3313, Min=144, Avg=168.14, 90=188, 99=227, 99.9=288, 99.99=576] [OVERALL], RunTime(ms), 18321 [OVERALL], Throughput(ops/sec), 5458.217346214727 [TOTAL_GCS_PS_Scavenge], Count, 8 [TOTAL_GC_TIME_PS_Scavenge], Time(ms), 86 [TOTAL_GC_TIME_%_PS_Scavenge], Time(%), 0.4694066917744664 [TOTAL_GCS_PS_MarkSweep], Count, 0 [TOTAL_GC_TIME_PS_MarkSweep], Time(ms), 0 [TOTAL_GC_TIME_%_PS_MarkSweep], Time(%), 0.0 [TOTAL_GCs], Count, 8 [TOTAL_GC_TIME], Time(ms), 86 [TOTAL_GC_TIME_%], Time(%), 0.4694066917744664 [READ], Operations, 49953 [READ], AverageLatency(us), 168.23125738193903 [READ], MinLatency(us), 130 [READ], MaxLatency(us), 39647 [READ], 95thPercentileLatency(us), 219 [READ], 99thPercentileLatency(us), 371 [READ], Return=OK, 49953 [CLEANUP], Operations, 1 [CLEANUP], AverageLatency(us), 2343.0 [CLEANUP], MinLatency(us), 2342 [CLEANUP], MaxLatency(us), 2343 [CLEANUP], 95thPercentileLatency(us), 2343 [CLEANUP], 99thPercentileLatency(us), 2343 [UPDATE], Operations, 50047 [UPDATE], AverageLatency(us), 184.17291745758988 [UPDATE], MinLatency(us), 144 [UPDATE], MaxLatency(us), 137855 [UPDATE], 95thPercentileLatency(us), 230 [UPDATE], 99thPercentileLatency(us), 353 [UPDATE], Return=OK, 50047 |