1. Redis(使用fastredisclient)redis-shard 10鏈接
redis
cpu 7-8% 9-12%
root@gleasy cloudredis]# bin/redis-benchmark -t get -h 192.168.0.11 -p 6680 -d 15 -l 60 -c 200 -b shard
成功:5740491
失敗:0
總時間:11999368
最長用時:42
最短用時:0
平均用時:2.090303425264494
min tps:0
max tps:131439
avg tps:94106
cpu 9-12%
sql
[root@gleasy cloudredis]# bin/redis-benchmark -t set -h 192.168.0.11 -p 6680 -d 15 -l 60 -c 200 -b shard
成功:5730516
失敗:0
總時間:11999536
最長用時:205
最短用時:0
平均用時:2.093971293335539
min tps:0
max tps:109213
avg tps:93942
2. MysqlMysql 插入 1000線程 7000/s
mongodb
target/benchtest/bin/TestMysql insert 1000 1000000 0
線程總時間:131320984;平均:131.320984
實際總時間:134504; 平均:0.134504
Mysql ibatis 插入 1000線程 5000/s
數據庫
target/benchtest/bin/TestMysql insert 1000 1000000 0
線程總時間:131320984;平均:131.320984
實際總時間:134504; 平均:0.204504
Mysql 查詢 1000線程 7000/s
性能
target/benchtest/bin/TestMysql query 1000 200000 600000
線程總時間:27869248;平均:139.34624
實際總時間:29117; 平均:0.145585
Mysql ibatis 查詢 1000線程 5000/s
測試
target/benchtest/bin/TestMysql query 1000 200000 600000
線程總時間:27869248;平均:139.34624
實際總時間:29117; 平均:0.195585
Mysql 批量插入 500線程(50000/s)
線程
target/benchtest/bin/TestMysql minsert 500 10000*100
線程總時間:10759531;平均:10.759531
實際總時間:22256; 平均:0.022256
3. Zookeeper單結點:
設計
set: tps 7500
get: tps 8700
del: tps 8400
4. Mongodb寫操做
code
200(線程數) 50000(記錄數) add(操做) nbso online casino reviews writeConcern=normal
線程總時間:304881 最長用時:1928/250=7.712 最短用時:562/250=2.248 平均:6.09762
實際總時間:1933 平均: 1933/50000=0.03866 tps:25866.52871184687
200 50000 add writeConcern=safe (爲保證數據正確,目前採用該方式)
線程總時間:1660848 最長用時:8580/250=34.32 最短用時:7401/250=29.604 平均:33.21696
實際總時間:8586 平均: 8586/50000=0.17172 tps:5823.433496389471
500 1000000 add writeConcern=normal
orm
線程總時間:43969426 最長用時:108885/2000=54.4425 最短用時:61483/2000=30.7415 平均:43.969426
實際總時間:109016 平均: 109016/1000000=0.109016 tps:9172.965436266235
500 1000000 add writeConcern=safe
線程總時間:63972303 最長用時:129511/2000=64.7555 最短用時:122266/2000=61.133 平均:63.972303
實際總時間:129521 平均: 129521/1000000=0.129521 tps:7720.755707568657
1000 50000 add writeConcern=normal
線程總時間:2956438 最長用時:4276/50=85.52 最短用時:338/50=6.76 平均:59.12876
實際總時間:4303 平均: 4303/50000=0.08606 tps:11619.800139437602
1000 50000 add writeConcern=safe
線程總時間:7937768 最長用時:9196/50=183.92 最短用時:5995/50=119.9 平均:158.93826
實際總時間:9208 平均: 9208/50000=0.18416 tps:5430.060816681147
讀操做
200 1000000 read
線程總時間:275106 最長用時:2116/5000=0.4232 最短用時:199/5000=0.0398 平均:0.275106
實際總時間:2137 平均: 2137/1000000=0.002137 tps:467945.7182966776
500 1000000 read
線程總時間:2205097 最長用時:5552/2000=2.776 最短用時:225/2000=0.1125 平均:2.205097
實際總時間:5576 平均: 5576/1000000=0.005576 tps:179340.0286944046
5.總結
在相同的硬件環境下,筆者測試的結果,redis在讀和寫性能都達到接近100K,性能表現最爲優秀;MongoDB讀寫性能嚴重不均衡,讀能夠達到100K以上,寫卻只有5-6K,相差15倍之巨;Zookeeper在結點狀況下,TPS接近8K,性能表現不俗,但不太適合用於關鍵性能場合;Mysql在讀寫性能大概介於5K-10K之間,批量操做性能優秀。性能僅僅是衡量數據庫優劣的其中一項指標,在具體的業務場景下,須要綜合選取最優秀的存儲方案或方案的組合,以達到最優設計。