暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

实战OceanBase社区版性能测试探索- sysbench篇之haproxy负载均衡

原创 大数据模型 2022-04-26
1109

前文

紧接上文 OceanBase社区版性能测试探索- sysbench篇之物理建模优化,笔者把OB集群重装,三个节点都有OB PROXY,而不是只有一个OBPROXY,然后在上面加一个haproxy,笔者想像,通过haproxy提高了连接的宽度,从而提高了sysbench的处理性能。

原架构

image.png

新架构

image.png

安装haproxy

1. 下载haproxy 的安装包
wget http://pkgs.fedoraproject.org/repo/pkgs/haproxy/haproxy-1.7.9.tar.gz/sha512/d1ed791bc9607dbeabcfc6a1853cf258e28b3a079923b63d3bf97504dd59e64a5f5f44f9da968c23c12b4279e8d45ff3bd39418942ca6f00d9d548c9a0ccfd73/haproxy-1.7.9.tar.gz

2. 解压
tar xzvf haproxy*

3.进入解压目录:

cd haproxy*

4.源码编译
make TARGET=linux2628 PREFIX=/usr/local/haproxy

注意的是大小写,若改成小写,编译不通过或没有编译到指定路径下

5.安装
make install PREFIX=/usr/local/haproxy

6.配置

haproxy.cfg.1


global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 655350
daemon
stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------

# common defaults that all the 'listen' and 'backend' sections will

# use if not designated in their block

#---------------------------------------------------------------------

defaults
mode tcp
log global
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 655350
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend mysql
bind *:22883
log global
mode tcp
default_backend mysqlsrvs
backend mysqlsrvs
balance roundrobin
server ob1 XXXX:2883 check
server ob2 XXX:2883 check
server ob3 XXXX:2883 check


6.运行

**/usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/haproxy.cfg.1
**
7.连接测试

[root@hdp2 ~]# obclient -h XXX -P22883 -uhenley@tenanttpcc#obcluster -p -c -A sysbench Enter password: Welcome to the OceanBase. Commands end with ; or \g. Your MySQL connection id is 475 Server version: 5.6.25 OceanBase 3.1.3 (r10100032022041510-a09d3134c10665f03fd56d7f8bdd413b2b771977) (Built Apr 15 2022 02:16:22) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [sysbench]>

测试结果

重新很艰难的通过echo 3> /proc/sys/vm/drop_cache生成了100万数据,用的是原始表结构,运行以下脚本

[root@hdp1 lua]# cat runsysbench22883.sh #!/bin/sh /root/sysbench-1.0/src/sysbench oltp_point_select.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=32 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_point_select.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=64 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_point_select.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=128 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_point_select.lua --mysql-host=XX--mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=256 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_point_select.lua --mysql-host=XX--mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=512 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_point_select.lua --mysql-host=XX--mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=1024 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_only.lua --mysql-host=XX--mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=32 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_only.lua --mysql-host=XX--mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=64 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_only.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=128 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_only.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=256 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_only.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=512 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_only.lua --mysql-host=XXX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=1024 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_write_only.lua --mysql-host=XXX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=32 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_write_only.lua --mysql-host=XXX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=64 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_write_only.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=128 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_write_only.lua --mysql-host=XXX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=256 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_write_only.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=512 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_write_only.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=1024 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_write.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=32 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_write.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=64 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_write.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=128 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_write.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=256 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_write.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=512 --report-interval=10 --time=60 --db-ps-mode=disable run /root/sysbench-1.0/src/sysbench oltp_read_write.lua --mysql-host=XX --mysql-port=22883 --mysql-db=sysbench --mysql-user=henley@tenanttpcc#obcluster --mysql-password=henley --table-size=1000000 --tables=30 --threads=1024 --report-interval=10 --time=60 --db-ps-mode=disable run

第一段针对2883端口,原表结构,生成相关数据。
第二段对对22883,22883分散到三个节点的2883,原表结构,生成相关数据
为了精确比较,针对第一段重新运行一遍,原表结构,生成相关数据

image.png

测试总结

  • 外置haproxy对Oceanbase性能有影响,我这破机器提升的性能很少
  • 查看三个节点的CPU状态,依然是有很空闲,网络和硬盘IO也没有打满,依然有提升的空间,我这个粗粒度的观察,细粒度观察 的要通过OB的监控了解详细数据对象的内部工作状态、包括合并、归档、类似AWR这些。
  • 晚上听听OB大神的性能调研课,参考官方的性能最佳调优参数,到时候haproxy加上物理模型加上OB大神建义和官方建议 ,加上关键核心指标的量化监控最后走一回,机器太 破了。
最后修改时间:2022-04-28 11:30:35
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论