1 sysbench 测试tidb单节点集群

wget https://github.com/akopytov/sysbench/archive/refs/tags/1.0.14.tar.gz

tar zxvf 1.0.14.tar.gz&&cd sysbench-1.0.14

yum -y install make automake libtool pkgconfig libaio-devel

# For MySQL support, replace with mysql-devel on RHEL/CentOS 5

yum -y install mariadb-devel

# For PostgreSQL support

yum -y install postgresql-devel

./autogen.sh # Add --with-pgsql to build with PostgreSQL support ./configure

make -j && make install

cd /opt/tidb-cluster

vim topo.yaml

server_configs:
  tikv:
    log-level: "error"
    prepared-plan-cache.enabled: true
    rocksdb.defaultcf.block-cache-size: "24GB"
    rocksdb.writecf.block-cache-size: "6GB"
    storage.block-cache.capacity: "30GB"

tiup cluster reload tidb-cluster

mkdir -p /opt/tidb-sysbench-test && cd /opt/tidb-sysbench-test

vim config

mysql-host=127.0.0.1
mysql-port=4000
mysql-user=root
mysql-password=
mysql-db=sbtest
time=600
threads=16
report-interval=10
db-driver=mysql

mysql --host 192.168.100.110 --port 4000 -u root -p

set global tidb_disable_txn_auto_retry = off;

然后退出客户端。

重新启动 MySQL 客户端执行以下 SQL 语句,创建数据库 sbtest:

mysql --host 192.168.100.110 --port 4000 -u root -p

create database sbtest;

rm -rf /usr/local/share/sysbench/oltp_common.lua

cd /usr/local/share/sysbench

wget https://raw.githubusercontent.com/pingcap/tidb-bench/master/sysbench/sysbench-patch/oltp_common.lua

cd /opt/tidb-sysbench-test

sysbench --config-file=config oltp_point_select --tables=16 --table-size=10000000 prepare

mysql --host 192.168.100.110 --port 4000 -u root -p

>use sbtest;

>SELECT COUNT(pad) FROM sbtest7 USE INDEX (k_7);

>ANALYZE TABLE sbtest7;

退出

cd /opt/tidb-sysbench-test

Point select 测试命令

sysbench --config-file=config oltp_point_select --tables=16 --table-size=10000000 run

SQL statistics:
    queries performed:
        read:                            6885256
        write:                           0
        other:                           0
        total:                           6885256
    transactions:                        6885256 (11475.11 per sec.)
    queries:                             6885256 (11475.11 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          600.0122s
    total number of events:              6885256

Latency (ms):
         min:                                    0.27
         avg:                                    1.39
         max:                                   66.22
         95th percentile:                        2.39
         sum:                              9584624.81

Threads fairness:
    events (avg/stddev):           430328.5000/206.31
    execution time (avg/stddev):   599.0391/0.00

Update index 测试命令

sysbench --config-file=config oltp_update_index --tables=16 --table-size=10000000 run

SQL statistics:
    queries performed:
        read:                            0
        write:                           485
        other:                           3765517
        total:                           3766002
    transactions:                        3766002 (6276.50 per sec.)
    queries:                             3766002 (6276.50 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          600.0122s
    total number of events:              3766002

Latency (ms):
         min:                                    0.53
         avg:                                    2.55
         max:                                  169.66
         95th percentile:                        3.82
         sum:                              9590963.16

Threads fairness:
    events (avg/stddev):           235375.1250/224.34
    execution time (avg/stddev):   599.4352/0.00

Read-only 测试命令

sysbench --config-file=config oltp_read_only --tables=16 --table-size=10000000 run

SQL statistics:
    queries performed:
        read:                            4602836
        write:                           0
        other:                           657548
        total:                           5260384
    transactions:                        328774 (547.94 per sec.)
    queries:                             5260384 (8766.97 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          600.0215s
    total number of events:              328774

Latency (ms):
         min:                                   11.01
         avg:                                   29.19
         max:                                  123.01
         95th percentile:                       41.85
         sum:                              9598292.96

Threads fairness:
    events (avg/stddev):           20548.3750/21.06
    execution time (avg/stddev):   599.8933/0.01

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值