atlas 不稳定 mysql_Atlas与直连MySQL性能比对

atlas是奇虎360推出的中间件。使用atlas,无需更改应用,就能实现读写分发的功能。

为了查看atlas的效率,对其做了压测,并与直连主库的压测结果做了比对。

环境版本:

MySQL :5.5.48一主两从,开启半同步复制。

Atlas:2.2.1

OS:虚拟机,单核,4G内存。

压测脚本及结果:

--准备

sysbench --test=/root/sysbench-0.4.12-1.1/sysbench/tests/db/oltp.lua --db-driver=mysql --mysql-engine-trx=yes --mysql-table-engine=innodb --mysql-host=10.9.15.120 --mysql-port=1234 --mysql-user=sbtest --mysql-password=sbpass --oltp_tables_count=10 --oltp-table-size=100000 --rand-init=on prepare

--Atlas

sysbench --mysql-host=10.9.15.120 --mysql-port=1234 --mysql-user=sbtest --mysql-password=sbpass --test=/root/sysbench-0.4.12-1.1/sysbench/tests/db/oltp.lua --oltp_tables_count=10 --oltp-table-size=10000000 --num-threads=8 --oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=3600  --max-requests=0 --percentile=99 run

Threads started!

[  10s] threads: 8, tps: 289.49, reads/s: 4061.43, writes/s: 1160.35, response time: 56.88ms (99%)

[  20s] threads: 8, tps: 7.30, reads/s: 104.80, writes/s: 30.00, response time: 2890.51ms (99%)

[  30s] threads: 8, tps: 22.30, reads/s: 312.20, writes/s: 89.20, response time: 3367.25ms (99%)

[  40s] threads: 8, tps: 54.30, reads/s: 760.20, writes/s: 216.90, response time: 2255.30ms (99%)

[  50s] threads: 8, tps: 5.30, reads/s: 72.50, writes/s: 20.30, response time: 2894.84ms (99%)

[  60s] threads: 8, tps: 6.00, reads/s: 78.70, writes/s: 23.20, response time: 3393.56ms (99%)

[  70s] threads: 8, tps: 152.60, reads/s: 2142.00, writes/s: 612.00, response time: 758.35ms (99%)

[  80s] threads: 8, tps: 5.10, reads/s: 72.80, writes/s: 20.80, response time: 2673.28ms (99%)

[  90s] threads: 8, tps: 3.30, reads/s: 46.20, writes/s: 13.20, response time: 5018.42ms (99%)

[ 100s] threads: 8, tps: 5.40, reads/s: 74.00, writes/s: 20.40, response time: 5904.15ms (99%)

[ 110s] threads: 8, tps: 248.10, reads/s: 3472.41, writes/s: 992.80, response time: 180.95ms (99%)

[ 120s] threads: 8, tps: 18.80, reads/s: 265.80, writes/s: 75.50, response time: 5084.95ms (99%)

OLTP test statistics:

queries performed:

read:                            114562

write:                           32732

other:                           16366

total:                           163660

transactions:                        8183   (65.66 per sec.)

deadlocks:                           0      (0.00 per sec.)

read/write requests:                 147294 (1181.88 per sec.)

other operations:                    16366  (131.32 per sec.)

General statistics:

total time:                          124.6273s

total number of events:              8183

total time taken by event execution: 980.4868s

response time:

min:                                 10.71ms

avg:                                119.82ms

max:                               5965.81ms

approx.  99 percentile:            2247.88ms

Threads fairness:

events (avg/stddev):           1022.8750/27.42

execution time (avg/stddev):   122.5609/1.30

--MySQL直连

sysbench --mysql-host=10.9.15.29 --mysql-port=3306 --mysql-user=sbtest --mysql-password=sbpass --test=/root/sysbench-0.4.12-1.1/sysbench/tests/db/oltp.lua --oltp_tables_count=10 --oltp-table-size=10000000 --num-threads=8 --oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=120  --max-requests=0 --percentile=99 run

Threads started!

[  10s] threads: 8, tps: 378.09, reads/s: 5301.81, writes/s: 1514.35, response time: 47.90ms (99%)

[  20s] threads: 8, tps: 36.60, reads/s: 509.80, writes/s: 145.20, response time: 800.81ms (99%)

[  30s] threads: 8, tps: 6.00, reads/s: 89.20, writes/s: 26.40, response time: 3190.62ms (99%)

[  40s] threads: 8, tps: 142.90, reads/s: 2000.42, writes/s: 571.21, response time: 1049.98ms (99%)

[  50s] threads: 8, tps: 155.00, reads/s: 2170.17, writes/s: 620.39, response time: 183.40ms (99%)

[  60s] threads: 8, tps: 3.80, reads/s: 52.60, writes/s: 14.70, response time: 6116.43ms (99%)

[  70s] threads: 8, tps: 4.50, reads/s: 63.60, writes/s: 18.50, response time: 4430.84ms (99%)

[  80s] threads: 8, tps: 275.10, reads/s: 3851.42, writes/s: 1100.41, response time: 224.40ms (99%)

[  90s] threads: 8, tps: 6.80, reads/s: 95.20, writes/s: 27.20, response time: 3853.95ms (99%)

[ 100s] threads: 8, tps: 8.80, reads/s: 123.20, writes/s: 35.20, response time: 2651.76ms (99%)

[ 110s] threads: 8, tps: 153.20, reads/s: 2144.78, writes/s: 612.80, response time: 392.17ms (99%)

[ 120s] threads: 8, tps: 7.60, reads/s: 106.40, writes/s: 30.40, response time: 2790.19ms (99%)

OLTP test statistics:

queries performed:

read:                            165088

write:                           47168

other:                           23584

total:                           235840

transactions:                        11792  (96.45 per sec.)

deadlocks:                           0      (0.00 per sec.)

read/write requests:                 212256 (1736.07 per sec.)

other operations:                    23584  (192.90 per sec.)

General statistics:

total time:                          122.2622s

total number of events:              11792

total time taken by event execution: 964.6983s

response time:

min:                                  5.33ms

avg:                                 81.81ms

max:                               6116.17ms

approx.  99 percentile:            1859.31ms

Threads fairness:

events (avg/stddev):           1474.0000/39.49

execution time (avg/stddev):   120.5873/0.73

压测结果图形:

0f9e43b4e7620274d0e7284490591c08.png

a5eb7dc636f69f3226ee54296d53ca3a.png

a5f8659d503ef1d15a77bee0e004bafd.png

28c7d2cf4b58cefb637f2ae530096195.png结论:

从压测比对图可以看到,TPS、每秒读、每秒写的指标,直连MySQL都优于通过atlas的性能。

直连MySQL的响应时间要比atlas快速。

在相同的压测条件下,atlas完成的事务数是8183   (65.66 per sec.);MySQL直连完成的事务数是11792  (96.45 per sec.)。依然是MySQL直连由于atlas。

不过,atlas损失一部分性能,换来的是不用修改应用程序,对于开发技术薄弱,或需要短时间内需要读写分离的情况,altas依然不失是一种好的选择。

转载请注明:

十字螺丝钉

http://blog.chinaunix.net/uid/23284114.html

QQ:463725310

E-MAIL:houora#gmail.com(#请自行替换为@)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值