sysbench手动测试OceanBase v4.2.4集群
环境:
1、ocp(sysbench节点)
192.192.103.128
2、ob集群1-1-1
observer 192.192.103.125、192.192.103.126、192.192.103.127,primary_zone:random
haproxy 192.192.103.125、192.192.103.126、192.192.103.127
一、安装sysbench(128)
源码安装:
JDK:建议使用 1.8u131 及以上版本
#yum install automake libtool autoconf make gcc -y
#tar zxvf sysbench-1.0.20.tar.gz
#cd sysbench-1.0.20
#./autogen.sh
#./configure
#make &&make install
#cd /sysbench/sysbench-1.0.20/src/lua
[root@ocp lua]# ls -ltr
total 124
-rwxrwxr-x 1 root root 2118 Apr 24 2020 select_random_ranges.lua
-rwxrwxr-x 1 root root 1919 Apr 24 2020 select_random_points.lua
-rwxrwxr-x 1 root root 1440 Apr 24 2020 oltp_write_only.lua
-rwxrwxr-x 1 root root 1127 Apr 24 2020 oltp_update_non_index.lua
-rwxrwxr-x 1 root root 1118 Apr 24 2020 oltp_update_index.lua
-rwxrwxr-x 1 root root 1824 Apr 24 2020 oltp_read_write.lua
-rwxrwxr-x 1 root root 1649 Apr 24 2020 oltp_read_only.lua
-rwxrwxr-x 1 root root 1265 Apr 24 2020 oltp_point_select.lua
-rwxrwxr-x 1 root root 2415 Apr 24 2020 oltp_insert.lua
-rwxrwxr-x 1 root root 1290 Apr 24 2020 oltp_delete.lua
-rw-rw-r-- 1 root root 14369 Apr 24 2020 oltp_common.lua
-rw-rw-r-- 1 root root 1219 Apr 24 2020 Makefile.am
-rwxrwxr-x 1 root root 1452 Apr 24 2020 bulk_insert.lua
-rw-r--r-- 1 root root 25401 Mar 6 10:53 Makefile.in
-rw-r--r-- 1 root root 25950 Mar 6 10:54 Makefile
drwxrwxr-x 2 root root 4096 Mar 6 10:55 internal
二、安装obclient(128)
rpm -ivh obclient-2.2.7-1.el7.x86_64.rpm
三、为 sysbench 测试创建 database:bench1(ob集群,任一节点登录即可)
$ obclient -h192.192.103.125 -P2883 -uroot@mytant#obs_test_cluster -D oceanbase -A -p
MySQL [oceanbase]> create database bench1;
MySQL [oceanbase]> show databases;
+--------------------+
| Database |
+--------------------+
| bench1 |
| information_schema |
| mydb |
| mysql |
| oceanbase |
| test |
+--------------------+
6 rows in set (0.01 sec)
MySQL [oceanbase]> grant all on *.* to root;
四、手动测试
#ob集群临时关闭一些参数:
MySQL [oceanbase]> altersystem SET enable_sql_audit=false;
MySQL [oceanbase]> alter system SET enable_perf_event=false;
MySQL [oceanbase]> alter system SET syslog_level='PERF';
MySQL [oceanbase]> alter system set enable_record_trace_log=false;
#测试过程(都是在OCP 128远程执行)
本次测试通过haproxy集群连接测试,端口2883。
1.初始化环境
#sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 ./oltp_read_write.lua cleanup
2.导入2张表,每张表包含1000条数据量。
sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 ./oltp_read_write.lua prepare
3.执行每一个case,执行30s
sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 ./oltp_read_write.lua run
sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 ./oltp_point_select.lua run
sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 ./oltp_read_only.lua run
sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 --rand-type=uniform ./oltp_read_write.lua run
sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 ./oltp_insert.lua run
sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 ./oltp_update_non_index.lua run
sysbench --mysql-host=192.192.103.125 --mysql-port=2883 --mysql-user=root@mytant#obs_test_cluster --mysql-db=bench1 --mysql-password=Root_1234 --report-interval=3 --time=30 --threads=4 --db-ps-mode=disable --percentile=99 --auto_inc=on --tables=2 --mysql-ignore-errors=1062 --table_size=1000 ./oltp_write_only.lua run
4、测试结果
分布式场景( primary zone = 'RANDOM' ),这里只举一例(read_write),用来说明各统计信息的含义。
SQL statistics:
queries performed:
read: 3374
write: 964
other: 482
total: 4820
transactions: 241 (8.02 per sec.)
queries: 4820 (160.35 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 30.0572s
total number of events: 241
Latency (ms):
min: 126.70
avg: 498.80
max: 1546.92
99th percentile: 1149.76
sum: 120210.83
Threads fairness:
events (avg/stddev): 60.2500/3.56
execution time (avg/stddev): 30.0527/0.00