‣ ‣ ‣ ‣ ‣
初步定位是 libmysqlclient(mariadb-devel) 这个包的问题导致的,应该是Alibaba cloud linux 3 的依赖是有问题的,理论上我们在centos安装相应的 libmysqlclient 编译一下也能复现。
docker run --net=host --name centos-sysbench --privileged -it centos:8 bash
# 换成阿里linxu3的源
rm -rf /etc/yum.repos.d/*
cat > /etc/yum.repos.d/all.repo <<EOF
[alinux3-module]
name=alinux3-module
baseurl=http://mirrors.aliyun.com/alinux/3/module/x86_64/
<http://mirrors.aliyun.com/alinux/3/module/x86_64/>
gpgkey=http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3
<http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3>
enabled=1
gpgcheck=1
# alinux3-os.repo
#
[alinux3-os]
name=alinux3-os
baseurl=http://mirrors.aliyun.com/alinux/3/os/x86_64/
<http://mirrors.aliyun.com/alinux/3/os/x86_64/>
gpgkey=http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3
<http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3>
enabled=1
gpgcheck=1
# alinux3-os.repo
#
[alinux3-plus]
name=alinux3-plus
baseurl=http://mirrors.aliyun.com/alinux/3/plus/x86_64/
<http://mirrors.aliyun.com/alinux/3/plus/x86_64/>
gpgkey=http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3
<http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3>
enabled=1
gpgcheck=1
# alinux3-powertools.repo
#
[alinux3-powertools]
name=alinux3-powertools
baseurl=http://mirrors.aliyun.com/alinux/3/powertools/x86_64/
<http://mirrors.aliyun.com/alinux/3/powertools/x86_64/>
gpgkey=http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3
<http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3>
enabled=1
gpgcheck=1
# alinux3-updates.repo
#
[alinux3-updates]
name=alinux3-updates
baseurl=http://mirrors.aliyun.com/alinux/3/updates/x86_64/
<http://mirrors.aliyun.com/alinux/3/updates/x86_64/>
gpgkey=http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3
<http://mirrors.aliyun.com/alinux/3/RPM-GPG-KEY-ALINUX-3>
enabled=1
gpgcheck=1
[epel]
name=Extra Packages for Enterprise Linux 8 - x86_64
baseurl=http://mirrors.aliyun.com/epel/8/Everything/x86_64
<http://mirrors.aliyun.com/epel/8/Everything/x86_64>
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8
<http://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8>
[epel-module]
name=Extra Packages for Enterprise Linux 8 - x86_64
baseurl=http://mirrors.aliyun.com/epel/8/Modular/x86_64
<http://mirrors.aliyun.com/epel/8/Modular/x86_64>
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8
<http://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8>
EOF
yum install git perf -y
yum -y install make automake libtool pkgconfig libaio-devel
# 注意这里安装的是 mariadb-devel
yum -y install mariadb-devel openssl-devel
git clone <https://github.com/akopytov/sysbench.git>
cd sysbench
sed -i 's/SQL_OPT_COMPRESSION_ALGORITHMS/SQL_OPT_COMPRESS/g' src/drivers/mysql/drv_mysql.c
./autogen.sh
./configure
make install
# 查看依赖
objdump -x /usr/local/bin/sysbench |grep libmysqlclient
0x0f735338 0x00 06 libmysqlclient_18
0000000000000000 F *UND* 0000000000000000 mysql_get_ssl_cipher@@libmysqlclient_18
... 省略若干
0000000000000000 F *UND* 0000000000000000 mysql_free_result@@libmysqlclient_18
尝试压测
/usr/local/bin/sysbench --mysql-user='root' --mysql-password='123' --mysql-db='test' --mysql-host='127.0.0.1' --mysql-port='3306' --tables='16' --table-size='10000' --range-size='5' --db-ps-mode='disable' --skip-trx='on' --mysql-ignore-errors='all' --time='1180' --report-interval='1' --histogram='on' --threads=1 oltp_read_only run
mysql 终端执行如下命令
mysql> show processlist;
+---------+------+-----------------+------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+------+-----------------+------+---------+------+----------+------------------+
| 18 | root | 127.0.0.1:44732 | test | Query | 0 | starting | show processlist |
| 4224894 | root | 127.0.0.1:33238 | test | Sleep | 0 | NULL | NULL |
+---------+------+-----------------+------+---------+------+----------+------------------+
2 rows in set (0.00 sec)
mysql> kill 4224894;
Query OK, 0 rows affected (0.00 sec)
mysql> show processlist;
+---------+----------------------+-----------------+------+---------+------+-----------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+----------------------+-----------------+------+---------+------+-----------------------+------------------+
| 18 | root | 127.0.0.1:44732 | test | Query | 0 | starting | show processlist |
| 4224894 | root | 127.0.0.1:33238 | test | Killed | 2 | | NULL |
| 4224895 | unauthenticated user | 127.0.0.1:46110 | NULL | Connect | 2 | Receiving from client | NULL |
| 4224896 | unauthenticated user | 127.0.0.1:46116 | NULL | Connect | 2 | Receiving from client | NULL |
... 省略若干
| 4224898 | unauthenticated user | 127.0.0.1:46142 | NULL | Connect | 2 | Receiving from client | NULL |
+---------+----------------------+-----------------+------+---------+------+-----------------------+------------------+
另一终端进入sysbench 的容器
docker exec -it centos-sysbench bash
perf 查看下
perf top -p
sysbench 终端
ss 看下