Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2833603
  • 博文数量: 200
  • 博客积分: 2413
  • 博客等级: 大尉
  • 技术积分: 3067
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-01 22:07
文章分类

全部博文(200)

文章存档

2018年(2)

2017年(8)

2016年(35)

2015年(14)

2014年(20)

2013年(24)

2012年(53)

2011年(44)

分类: Mysql/postgreSQL

2016-11-04 23:57:15


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


压测结果图形:









结论:
从压测比对图可以看到,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(#请自行替换为@)

阅读(3088) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~