sysbench 压测试 atlas中间件问题

弘恩 2016-09-09 11:12:13
环境
sysbench 0.5 ,mysql 5.7.14 ,atlas Atlas-2.2.1.el6.x86_64.rpm
3台虚拟机 M 143 ,S145 , Atlas149
用atlas中间件 对mysql进行读写分离

目标:
用sysbench 对atlas 进行压测试,检查在使atlas中间件读写分离后的mysql集群整体的性能吞吐情况
过程:
1. sysbench 直接对主库加压,命令如下
#sysbench --mysql-table-engine=innodb --oltp-table-size=10000 --debug=on --num-threads=3 --mysql-db=db1 --mysql-user=root --mysql-host=192.168.186.143 --mysql-password=123456 --port=3306 --test=/usr/local/sysbench/sysbench/tests/db/oltp.lua --oltp_tables_count=3 prepare


sysbench 0.5: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating secondary indexes on 'sbtest1'...
Creating table 'sbtest2'...
Inserting 10000 records into 'sbtest2'
Creating secondary indexes on 'sbtest2'...
Creating table 'sbtest3'...
Inserting 10000 records into 'sbtest3'
Creating secondary indexes on 'sbtest3'...
[root@localhost /usr/local/sysbench-0.5/bin]
#sysbench --mysql-table-engine=innodb --oltp-table-size=10000 --debug=on --num-threads=3 --mysql-db=db1 --mysql-user=root --mysql-host=192.168.186.143 --mysql-password=123456 --port=3306 --test=/usr/local/sysbench/sysbench/tests/db/oltp.lua --oltp_tables_count=3 run
sysbench 0.5: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 3
Debug mode enabled.

Random number generator seed is 0 and will be ignored


Initializing worker threads...

No DB drivers specified, using mysql
DEBUG: Worker thread (#2) started!
DEBUG: Worker thread (#1) started!
DEBUG: Worker thread (#0) started!
Threads started!

DEBUG: Ignoring error 1213 Deadlock found when trying to get lock; try restarting transaction,
DEBUG: Ignored error encountered, restarting transaction
DEBUG: Ignoring error 1213 Deadlock found when trying to get lock; try restarting transaction,
DEBUG: Ignored error encountered, restarting transaction
DEBUG: Ignoring error 1213 Deadlock found when trying to get lock; try restarting transaction,
DEBUG: Ignored error encountered, restarting transaction
DEBUG: Ignoring error 1213 Deadlock found when trying to get lock; try restarting transaction,
DEBUG: Ignored error encountered, restarting transaction
DEBUG: Ignoring error 1213 Deadlock found when trying to get lock; try restarting transaction,
DEBUG: Ignored error encountered, restarting transaction
DEBUG: Ignoring error 1213 Deadlock found when trying to get lock; try restarting transaction,
DEBUG: Ignored error encountered, restarting transaction
DEBUG: Ignoring error 1213 Deadlock found when trying to get lock; try restarting transaction,
DEBUG: Ignored error encountered, restarting transaction
Done.

OLTP test statistics:
queries performed:
read: 140098
write: 40007
other: 20007
total: 200112
transactions: 10000 (39.26 per sec.)
read/write requests: 180105 (707.04 per sec.)
other operations: 20007 (78.54 per sec.)
ignored errors: 7 (0.03 per sec.)
reconnects: 0 (0.00 per sec.)

General statistics:
total time: 254.7299s
total number of events: 10000
total time taken by event execution: 764.0871s
response time:
min: 27.57ms
avg: 76.41ms
max: 539.19ms
approx. 95 percentile: 246.52ms

Threads fairness:
events (avg/stddev): 3333.3333/5.56
execution time (avg/stddev): 254.6957/0.01

DEBUG: Verbose per-thread statistics:

DEBUG: thread # 0: min: 0.0280s avg: 0.0765s max: 0.5086s events: 3328
DEBUG: total time taken by even execution: 254.6939s
DEBUG: thread # 1: min: 0.0321s avg: 0.0765s max: 0.4619s events: 3331
DEBUG: total time taken by even execution: 254.7094s
DEBUG: thread # 2: min: 0.0276s avg: 0.0762s max: 0.5392s events: 3341
DEBUG: total time taken by even execution: 254.6837s

2 sysbench 连接Atlas代理进行加压,命令如下
#sysbench --mysql-table-engine=innodb --oltp-table-size=10000 --debug=on --num-threads=3 --mysql-db=db1 --mysql-user=root --mysql-host=192.168.186.149 --mysql-password=123456 --port=1234 --test=/usr/local/sysbench/sysbench/tests/db/oltp.lua --oltp_tables_count=3 prepare
sysbench 0.5: multi-threaded system evaluation benchmark

No DB drivers specified, using mysql
FATAL: unable to connect to MySQL server, aborting...
FATAL: error 2003: Can't connect to MySQL server on '192.168.186.149' (111)
FATAL: failed to execute function `prepare': /usr/local/sysbench/sysbench/tests/db/common.lua:103: Failed to connect to the database


...全文
3263 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
四叶草-Clover 2016-09-09
  • 打赏
  • 举报
回复
sysbench --mysql-table-engine=innodb --oltp-table-size=10000 --debug=on --num-threads=3 --mysql-db=db1 --mysql-user=root --mysql-host=192.168.186.149 --mysql-password=123456 --port=1234 --test=/usr/local/sysbench/sysbench/tests/db/oltp.lua --oltp_tables_count=3 prepare 这个lua是要写库的。又做了读写分离。写不进去,可能出错。 ---by 闫
弘恩 2016-09-09
  • 打赏
  • 举报
回复
以下是atlas中间件的配置情况 1 [mysql-proxy] 2 3 #Atlas加载的模块名称,不需要改 4 plugins = admin, proxy 5 6 #管理接口的用户名 7 admin-username = atroot 8 9 #管理接口的密码 10 admin-password = at123456 11 12 #实现管理接口的Lua脚本所在路径 13 admin-lua-script = /usr/local/mysql-proxy/lib/mysql-proxy/lua/admin.lua 14 15 #Atlas后端连接的MySQL主库的IP和端口,可设置多项,用逗号分隔 16 proxy-backend-addresses = 192.168.186.143:3306 17 19 proxy-read-only-backend-addresses = 192.168.186.145:3306@1 22 daemon = true 24 keepalive = true 25 26 pwds = root:/iZxz+0GRoA= 27 28 31 32 #日志级别,分为message、warning、critical、error、debug五个级别 33 log-level = message 34 35 36 sql-log = REALTIME 37 38 #日志存放的路径 39 log-path = /usr/local/mysql-proxy/log 40 41 #实例名称,用于同一台机器上多个Atlas实例间的区分 42 instance = test 43 44 #Atlas监听的工作接口IP和端口 45 proxy-address = 0.0.0.0:1234 46 47 #Atlas监听的管理接口IP和端口 48 admin-address = 0.0.0.0:2345 49 #连接池的最小空闲连接数,应设为event-threads的整数倍,可根据业务请求量大小适当调大或调小 50 min-idle-connections = 8 51 52 #分表设置,此例中person为库名,mt为表名,id为分表字段,3为子表数量,可设置多项,以逗号分隔,若不分表则不需要> 设置该项 53 #tables = person.mt.id.3 54 55 #用户名与其对应的加密过的MySQL密码,密码使用PREFIX/bin目录下的加密程序encrypt加密,此设置项用于多个用户名同时 访问同一个Atlas实例的情况,若只有一个用户名>则不需要设置该项 56 #pwds = user1:+jKsgB3YAG8=, user2:GS+tr4TPgqc= 57 58 #默认字符集,若不设置该项,则默认字符集为latin1 59 charset = utf8 60 61 #允许连接Atlas的客户端的IP,可以是精确IP,也可以是IP段,以逗号分隔,若不设置该项则允许所有IP连接,否则只允许> 列表中的IP连接 62 #client-ips = 127.0.0.1, 192.168.1 63 64 #Atlas前面挂接的LVS的物理网卡的IP(注意不是虚IP),若有LVS且设置了client-ips则此项必须设置,否则可以不设置 65 #lvs-ips = 192.168.1.1
奇虎360公司开源的Atlas是优秀的数据库中间件,美团点评DBA团队针对公司内部需求,在其上做了很多改进工作,形成了新的高可靠、高可用企业级数据库中间件DBProxy,已在公司内部生产环境广泛使用,较为成熟、稳定。 DBProxy的优点 支持多语言MySQL客户端 读写分离 负载均衡 Slave故障感知与摘除(Master需要MHA等其他联动) 后端连接池 自定义SQL拦截与过滤 流量分组与控制 丰富的监控状态 支持分表(分库版本正在内测中) Client IP限制 DBProxy对Atlas的改进 新增功能点 新增参数 backend-max-thread-running用于指定每个MySQL后台的最大thread running数 thread-running-sleep-delay用于指定在thread running数超过backend-max-thread-running时,客户端连接等待的时间 添加到黑名单中需要满足两个条件:SQL执行的时间和频率 提供了查看、修改、添加、删除黑名单的功能 黑名单管理提供了将黑名单保存到文件以及从文件中Load到内存中的功能 在手动添加黑名单时,只需要将用户的SQL语句输入,在内部自动转化成过滤条件,手动添加时是否生效由参数 manual-filter-flag 来控制,OFF:不生效,ON:立即生效 手动添加与自动添加两种情况下的过滤条件是否生效是分别由不同参数控制,这个要区分清楚。另外,也可以使用 admin 的命令来设置是否开启/关闭某个过滤条件 SQL执行的时间 由参数 query-filter-time-threshold 来指定,如果SQL执行时间超过此值,则满足条件 SQL执行频率 由参数 query-filter-frequent-threshold 来指定,如果SQL执行频率超过此值,则满足条件 频率就是在时间窗口内执行的次数。时间窗口则是由频率阈值和最小执行次数来计算出来的,当时间窗口小于60s时,扩展到60s 参数 access-num-per-time-window 用来指定在时间窗口内的最小执行次数,添加此参数是考虑到执行时间长的SQL在计算频率时同时参考其执行的次数,只有执行一定次数时才去计算其频率。当执行时间与执行频率都满足时条件时,会自动将查询作为过滤项放到黑名单中,加入到黑名单中是否生效由参数 auto-filter-flag 来控制,OFF:不生效,ON:立即生效 黑名单的管理 从库流量配置 指定查询发送到某个从库 参数动态设置(完善show proxy status/variables) 支持save config,动态增加、删除分表 响应时间percentile统计 统计最近时间段DBProxy的响应时间 kill session 支持DBProxy的admin接口kill session操作 backend平滑上下线 支持平滑的backend上下线 DBProxy非root用户启动 使用非root用户启动 admin账号的安全限制 admin账号密码的动态修改及host限制 增加异步刷日志的功能 增加日志线程、异步刷日志,提高响应时间 支持DBProxy平滑重启功能 支持SQL过滤的黑名单功能 支持对于MySQL后台的thread running限制功能 该功能通过在DBProxy内限制每个后台MySQL的并发查询,来控制对应MySQL的thread running数 当发向某个MySQL后台的的并发查询超过某个阈值时,会进行超时等待,直到有可用的连接,其中阈值与超时等待的时间都已经参数化,可以动态配置 set backend offline不再显示节点状态 支持set transaction isolation level 支持use db 支持set option语句 支持set session级系统变量 支持建立连接时指定连接属性 改进连接池的连接管理,增加超时释放机制。当连接池中的空闲连接闲置超过一定时

1,220

社区成员

发帖
与我相关
我的任务
社区描述
企业软件 中间件技术
社区管理员
  • 中间件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧