vitess sysbench性能测试

参考资料:

1、sysbench的使用: https://blog.51cto.com/u_15739244/5781745


 

1、 安装和部署

1.1 、安装sysbench

git clonehttps://github.com/akopytov/sysbench.git

cd sysbench

git checkout 0.5

yum -y install make automake libtool pkgconfig libaio-devel

yum -y install mariadb-devel ./autogen.sh

./configure

make -j

make install

1.2 配置vtgate的ddl权限

标红处"vschema_ddl_authorized_users=%"

vtgate --topo_implementation etcd2 --topo_global_server_address localhost:2379 --topo_global_root /vitess/global --log_dir /home/vitess/my-vitess-example/examples/local/vtdataroot/tmp --log_queries_to_file /home/vitess/my-vitess-example/examples/local/vtdataroot/tmp/vtgate_querylog.txt --port 15001 --grpc_port 15991 --mysql_server_port 15306 --mysql_server_socket_path /tmp/mysql.sock --cell zone1 --cells_to_watch zone1 --tablet_types_to_wait PRIMARY,REPLICA --service_map grpc-vtgateservice --pid_file /home/vitess/my-vitess-example/examples/local/vtdataroot/tmp/vtgate.pid --mysql_auth_server_impl none --vschema_ddl_authorized_users=%


 

备注:默认2PC模式

vtgate --topo_implementation etcd2 --topo_global_server_address localhost:2379 --topo_global_root /vitess/global --log_dir /home/vitess/my-vitess-example/examples/local/vtdataroot/tmp --log_queries_to_file /home/vitess/my-vitess-example/examples/local/vtdataroot/tmp/vtgate_querylog.txt --port 15001 --grpc_port 15991 --mysql_server_port 15306 --mysql_server_socket_path /tmp/mysql.sock --cell zone1 --cells_to_watch zone1 --tablet_types_to_wait PRIMARY,REPLICA --service_map grpc-vtgateservice --pid_file /home/vitess/my-vitess-example/examples/local/vtdataroot/tmp/vtgate.pid --mysql_auth_server_impl none --vschema_ddl_authorized_users=% --transaction_mode twopc

1.3、手动执行DDL配置

a) 将/usr/local/share/sysbench/common.lua 中相关的表的ddl执行注解掉,把创建表函数注释掉


 

b) 初始化

CREATE TABLE customer.sbtest1 (id bigint NOT NULL, k int(10) unsigned NOT NULL DEFAULT '0',c char(120) NOT NULL DEFAULT '',pad char(60) NOT NULL DEFAULT '',PRIMARY KEY(id),KEY `k_1` (`k`));
 

alter vschema on customer.sbtest1 add vindex hash(id) using hash;


 

create table commerce.sbtest1_seq(id bigint, next_id bigint, cache bigint, primary key(id)) comment 'vitess_sequence';

insert into commerce.sbtest1_seq(id, next_id, cache) values(0, 1000000000, 1000000000);


 

alter vschema on customer.sbtest1_seq add vindex hash(id) using hash;

alter vschema add sequence commerce.sbtest1_seq;
alter vschema on customer.sbtest1 add auto_increment id using commerce.sbtest1_seq;


 

清理动作(重新执行时清理):

drop table commerce.sbtest1_seq;

alter vschema on sbtest1 drop vindex hash;

drop table sbtest1 ;


 

2 、测试方法


 

2.1 数据准备(预热1w条)
sysbench --test='/usr/local/share/sysbench2/oltp.lua' --oltp-tables-count=1 --report-interval=10 --oltp-table-size=10000 --mysql-user=vt_allprivs --mysql-password=123 --mysql-table-engine=innodb --rand-init=on --mysql-host=127.0.0.1 --mysql-port=15306 --mysql-db=customer --max-time=300 --max-requests=0 --oltp_skip_trx=off --oltp_auto_inc=1 --oltp_secondary=0 --oltp_range_size=5 --num-threads=5 prepare


2.2 数据测试 (执行10w条)
sysbench --test='/usr/local/share/sysbench/oltp.lua' --oltp-tables-count=1 --report-interval=10 --oltp-table-size=100000 --mysql-user=vt_allprivs --mysql-password=123 --mysql-table-engine=innodb --rand-init=on --mysql-host=127.0.0.1 --mysql-port=15306 --mysql-db=customer --max-time=300 --max-requests=0 --oltp_skip_trx=off --oltp_auto_inc=1 --oltp_secondary=0 --oltp_range_size=5 --num-threads=5 run


2.3 数据清理
sysbench --test='/usr/local/share/sysbench/oltp.lua' --oltp-tables-count=1 --report-interval=10--oltp-table-size=100000 --mysql-user=vt_allprivs --mysql-password=123 --mysql-table-engine=innodb --rand-init=on --mysql-host=127.0.0.1 --mysql-port=15306 --mysql-db=customer --max-time=300 --max-requests=0 --oltp_skip_trx=off --oltp_auto_inc=1 --oltp_secondary=0 --oltp_range_size=5 --num-threads=5 cleanup

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浩澜大大

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值