打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Mysql 性能 zookeeper redis mongodb

声明
本文为Gleasy原创文章,转载请指明引自Gleasy团队博客

1. Redis(使用fastredisclient)

redis-shard 10连接
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%
[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. Mysql

Mysql 插入 1000线程 7000/s
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

写操作
200(线程数) 50000(记录数) add(操作) 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
线程总时间: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之间,批量操作性能优秀。
性能仅仅是衡量数据库优劣的其中一项指标,在具体的业务场景下,需要综合选取最优秀的存储方案或方案的组合,以达到最优设计。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
2019最新 BAT、TMD等公司技术面试题及其答案
使用开源项目的正确姿势,都是血和泪的总结!
金三银四跳槽季,Java面试大纲
收藏了800道Java后端经典面试题,分享给大家,希望你找到自己理想的Offer呀~
200 道 Java 最常见的面试题
秒杀场景下如何保证数据一致性?就这个问题我给出了最详细的方案
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服