OB4.0刚刚发布 ,大家都非常关心OB4.0带来哪些性能提升,以及OB4.0和其他db的性能对比。
下面我带大家看一下如何针对OB4.0做性能测试。
一、服务器规格和版本
确定服务器的规格和软件的版本,例如
40核心256G内存 SSD硬盘 5千万数据
采用sysbench-1.0.20压测 oltp_write_only脚本。
OB 4.0单机版本
二、OB4.0配置说明
因为是压力测试,不采用 obd demo模式安装,而采用 obd cluster 安装。具体的配置文件如下。
cat ob.yaml
user:
username: obadmin #ssh 账户
password: obadmin #ssh密码
port: 22
oceanbase-ce:
servers:
- name: server1
ip: XXX.XXX.XXX.XXX
global:
devname: eth0 #如果是band的网卡类型,bond0.104@bond0 需要写 bond0.104 即可,否则部署会失败,获取不到ip,无法监听
cluster_id: 1
memory_limit: 128G # The maximum running memory for an observer
system_memory: 30G # The reserved system memory. system_memory is reserved for general tenants. The default value is 30G.
datafile_size: 500G # Size of the data file.
log_disk_size: 540G # The size of disk space used by the clog files.
cpu_count: 40
production_mode: true
syslog_level: INFO # System log level. The default value is INFO.
enable_syslog_wf: false # Print system logs whose levels are higher than WARNING to a separate log file. The default value is true.
enable_syslog_recycle: true # Enable auto system log recycling or not. The default value is false.
max_syslog_file_count: 4 # The maximum number of reserved log files before enabling auto recycling. The default value is 0.
server1:
mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
home_path: /data/ob/observer
data_dir: /data/ob/data
zone: zone1
obproxy-ce:
depends:
- oceanbase-ce
servers:
- XXX.XXX.XXX.XXX
global:
listen_port: 2883 # External port. The default value is 2883.
prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.
home_path: /data/ob/obproxy
enable_cluster_checkout: false
skip_proxy_sys_private_check: true
enable_strict_kernel_release: false
obagent:
depends:
- oceanbase-ce
servers:
- name: server1
ip: XXX.XXX.XXX.XXX
global:
home_path: /data/ob/obagent
ob_monitor_status: active
prometheus:
depends:
- obagent
servers:
- XXX.XXX.XXX.XXX
global:
home_path: /data/ob/prometheus
grafana:
depends:
- prometheus
servers:
- XXX.XXX.XXX.XXX
global:
home_path: /data/ob/grafana
login_password: oceanbase
三、开始部署OB
obd cluster deploy obtest1 -c ob.yaml #根据配置文件开始部署OB
obd cluster start obtest1 #启动OB 集群名称为obtest1
obd cluster display oobtest1 #查看集群
租户信息以及资源配置
create resource unit u4
-> memory_size='100g',
-> log_disk_size='100g',
-> min_cpu=36,max_cpu=36,
-> max_iops=102400,min_iops=102400;
obclient [oceanbase]> create resource pool p1 unit 'u4',unit_num=1,zone_list=('zone1');
obclient [oceanbase]> create tenant test1 resource_pool_list=('p1') ,zone_list=('zone1');
四、sysbench的配置信息
和其他DB相比,OB有了租户的概念,默认的租户cpu和内存偏低,需要在sysbench的配置文件里面指定租户信息。
安装sysbench和压测MySQL的一致即可。
mysql-host=
mysql-port=2881
mysql-user=admin@test1 #这里是用户@租户
mysql-password=admin
mysql-db=sbtest
time=600
threads=16
report-interval=10
db-driver=mysql
五、开始压测
OB压测数据
sysbench --config-file=config oltp_point_select --tables=10 --table-size=50000000 prepare
sysbench --config-file=config oltp_write_only --tables=10 --table-size=50000000 run
Number of threads: 16
16 threads 压测OB
[ 10s ] thds: 16 tps: 5610.15 qps: 33667.48 (r/w/o: 0.00/22360.81/11306.68) lat (ms,95%): 4.25 err/s: 0.00 reconn/s: 0.00
[ 300s ] thds: 16 tps: 7143.21 qps: 42859.48 (r/w/o: 0.00/28501.96/14357.53) lat (ms,95%): 3.19 err/s: 0.00 reconn/s: 0.00
[ 600s ] thds: 16 tps: 6090.52 qps: 36546.40 (r/w/o: 0.00/24322.17/12224.23) lat (ms,95%): 5.28 err/s: 0.00 reconn/s: 0.00
Number of threads: 32
32 threads 压测OB
[ 10s ] thds: 32 tps: 9495.03 qps: 56981.30 (r/w/o: 0.00/37922.05/19059.25) lat (ms,95%): 5.37 err/s: 0.00 reconn/s: 0.00
[ 300s ] thds: 32 tps: 14167.38 qps: 85001.95 (r/w/o: 0.00/56610.70/28391.25) lat (ms,95%): 3.19 err/s: 0.00 reconn/s: 0.00
[ 600s ] thds: 32 tps: 13866.32 qps: 83194.19 (r/w/o: 0.00/55425.76/27768.43) lat (ms,95%): 3.19 err/s: 0.00 reconn/s: 0.00
Number of threads: 256
256 threads 压测OB
[ 10s ] thds: 256 tps: 21802.78 qps: 130894.14 (r/w/o: 0.00/87212.51/43681.63) lat (ms,95%): 22.28 err/s: 0.00 reconn/s: 0.00
[ 300s ] thds: 256 tps: 17846.85 qps: 107071.50 (r/w/o: 0.00/71347.50/35724.00) lat (ms,95%): 27.66 err/s: 0.00 reconn/s: 0.00
[ 600s ] thds: 256 tps: 21874.88 qps: 131220.66 (r/w/o: 0.00/87451.50/43769.15) lat (ms,95%): 21.89 err/s: 0.00 reconn/s: 0.00
Number of threads: 512
512 threads 压测OB
[ 10s ] thds: 512 tps: 22525.59 qps: 135288.93 (r/w/o: 0.00/90160.84/45128.09) lat (ms,95%): 40.37 err/s: 0.00 reconn/s: 0.00
[ 300s ] thds: 512 tps: 21071.44 qps: 126372.42 (r/w/o: 0.00/84216.75/42155.67) lat (ms,95%): 44.17 err/s: 0.00 reconn/s: 0.00
[ 600s ] thds: 512 tps: 20608.58 qps: 123644.97 (r/w/o: 0.00/82416.51/41228.46) lat (ms,95%): 46.63 err/s: 0.00 reconn/s: 0.00
六、在压测OB的时候遇到的一些问题
- sys 租户资源分配过小,需要额外创建租户。
- 由于网卡是bond0,网卡名称是“bond0.104@bond0”,配置需要写bond0.104,如果写全,则会报获取不到,无法创建监听端口的问题。
七、最后
OB4.0对高并发场景做了很多优化,随着threads的增长,OB4.0的性能有增长。