一、前言
OceanBase 一直以"攻坚大型场景"被大家所熟知,而4.0 版本开启了 OceanBase 的小型化进程。官方介绍4.0 版本在内核能力、兼容性、性能、运维能力等方面都有大幅提升。因为工作接触的联机型交易比较多,所以很好奇OB4.0与3.x 在TPCC上性能到底提升多少,本篇就以此出发,评测一下OB4.O 小鱼的TPCC性能。
二、基础概念
TPC-C
TPC-C Benchmark是一个对OLTP(联机交易处理)系统进行测试的规范,使用一个商品销售模型对OLTP系统进行测试,其中包含五类事务:
- NewOrder –新订单的生成;
- Payment –订单付款;
- OrderStatus –最近订单查询;
- Delivery –配送;
- StockLevel –库存缺货状态分析。
详细信息,参考 TPC-C中文简介
二、环境工具准备
2.1 软件资源
- JDK:建议使用 1.8u131 及以上版本。
- JDBC:建议使用 mysql-connector-java-5.1.47 版本,其他版本可能存在语法兼容性问题。
- OBD:自动化部署软件。参考安装部署工具 OBD 。本次主要用于集群部署,test tpcc等。
2.2 服务器列表
服务器IP | 操作系统 | 服务器配置 | 角色 | 备注 |
---|---|---|---|---|
192.168.33.216 | Alibaba Cloud Linux (Aliyun Linux) | 2C4G | OBD | 中控机,自动化部署软件 |
192.168.33.220 | Alibaba Cloud Linux (Aliyun Linux) | 8C64G | OBServer | OceanBase 数据库 zone1 |
三、测试方案
1、测试目标版本:OCEANBASE 4.0 和 3.1.4
1、本次测试需要用到2台机器,OBD单独部署在一台机器上,该机器作为中控机,用于集群部署启停,同时又作为客户端的压力机器。本次评测的OceanBase单实例的性能,所以OBD是远程单实例部署,只有zone1,同时为了屏蔽ODP对性能的影响,此次未部署ODP,而是采用直连租户的方式进行压测。
首先 [root@iZuf6dw4vhnx1k9k76m83fZ ~]# obd cluster edit-config obcluster
编辑启动文件
## Only need to configure when remote login is required
user:
username: root
password: xxx
# key_file: your ssh-key file path if need
# port: your ssh port, default 22
# timeout: ssh connection timeout (second), default 30
oceanbase-ce:
# version: 3.1.4 **(调整版本时需要用到,默认时最新版)**
servers:
# Please don't use hostname, only IP can be supported
- 192.168.44.220
global:
# The working directory for OceanBase Database. OceanBase Database is started under this directory. This is a required field.
home_path: /data1/observer
# The directory for data storage. The default value is $home_path/store.
# data_dir: /data
# The directory for clog, ilog, and slog. The default value is the same as the data_dir value.
# redo_dir: /redo
# Please set devname as the network adaptor's name whose ip is in the setting of severs.
# if set severs as "127.0.0.1", please set devname as "lo"
# if current ip is 192.168.1.10, and the ip's network adaptor's name is "eth0", please use "eth0"
devname: eth0
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.
zone: zone1 # if current hardware's memory capacity is smaller than 50G, please use the setting of "mini-single-example.yaml" and do a small adjustment.
memory_limit: 32G # The maximum running memory for an observer
# The reserved system memory. system_memory is reserved for general tenants. The default value is 30G.
system_memory: 3G
datafile_size: 192G # Size of the data file.
log_disk_size: 192G # The size of disk space used by the clog files.
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: 20 # The maximum number of reserved log files before enabling auto recycling. The default value is 0.
# observer cluster name, consistent with obproxy's cluster_name
appname: obcluster
root_password: ob_FC123#
proxyro_password: ob_FC123#
然后部署集群 [root@iZuf6dw4vhnx1k9k76m83fZ ~]# obd cluster deploy obcluster
Download oceanbase-ce-3.1.4-102000012022120715.el8.x86_64.rpm (47.34 M): 100% [#################################################################] Time: 0:01:10 708.97 kB/s
Package oceanbase-ce-3.1.4-102000012022120715.el8 is available.
Download obproxy-ce-4.0.0-5.el8.x86_64.rpm (10.16 M): 100% [####################################################################################] Time: 0:00:13 797.59 kB/s
install oceanbase-ce-3.1.4 for local ok
install obproxy-ce-4.0.0 for local ok
+--------------------------------------------------------------------------------------------+
| Packages |
+--------------+---------+------------------------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+------------------------+------------------------------------------+
| oceanbase-ce | 3.1.4 | 102000012022120715.el8 | 128684fab6b50bc63e279f8ab412a3d6ffe95667 |
| obproxy-ce | 4.0.0 | 5.el8 | 40f89a588fce542760ecb83d68ee4821b3819d98 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Cluster status check ok
Initializes observer work home ok
Initializes obproxy work home ok
Remote oceanbase-ce-3.1.4-102000012022120715.el8-128684fab6b50bc63e279f8ab412a3d6ffe95667 repository install ok
Remote oceanbase-ce-3.1.4-102000012022120715.el8-128684fab6b50bc63e279f8ab412a3d6ffe95667 repository lib check !!
Remote obproxy-ce-4.0.0-5.el8-40f89a588fce542760ecb83d68ee4821b3819d98 repository install ok
Remote obproxy-ce-4.0.0-5.el8-40f89a588fce542760ecb83d68ee4821b3819d98 repository lib check ok
Try to get lib-repository
Download oceanbase-ce-libs-4.0.0.0-103000022023011215.el8.x86_64.rpm (159.34 K): 100% [#########################################################] Time: 0:00:00 614.02 kB/s
install oceanbase-ce-libs-4.0.0.0 for local ok
Remote oceanbase-ce-libs-4.0.0.0-103000022023011215.el8-a8fbc85f87979276deb5659c80d7723fd58e42e2 repository install ok
Remote oceanbase-ce-3.1.4-102000012022120715.el8-128684fab6b50bc63e279f8ab412a3d6ffe95667 repository lib check ok
obcluster deployed
+--------------------------------------------------+
| observer |
+----------------+---------+------+-------+--------+
| ip | version | port | zone | status |
+----------------+---------+------+-------+--------+
| 192.168.44.222 | 3.1.4 | 2881 | zone1 | active |
+----------------+---------+------+-------+--------+
obclient -h192.168.44.222 -P2881 -uroot -pob_FC123# -Doceanbase -A
2、部署成功后,通过 obd cluster tenant create 新建执行 TPC-C 测试的租户及用户
[root@iZuf6dw4vhnx1k9k76m83fZ ~]# obd cluster tenant create obcluster -n obmysql --max-cpu=2 --memory-size=16G --log-disk-size=100G --max-iops=100000 --iops-weight=2 --unit-num=1 --charset=utf8 --mode=mysql
Get local repositories and plugins ok
Open ssh connection ok
Connect to observer ok
Create tenant obmysql ok
3、压测方式采用OBD一键测试 obd test tpcc 。
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
sudo yum install obtpcc java
nohup obd test tpcc obcluster --tenant=obmysql --warehouses 100 --terminals=50 --load-workers=10 --run-mins 5 & (为避免客户端线程下线,本次均采用后台执行)
含义:
--warehouses 100 :100仓,
--terminals=50 :交易并行度50,
--load-workers=10 :导入并发10,
--run-mins 5 :压测5分钟
四、测试案例
本次测试案例分为四个:
1、OceanBase4.0 warehouses=10
2、OceanBase4.0 warehouses=100
3、OceanBase3.1.4 warehouses=10
4、OceanBase3.1.4 warehouses=100
基本步骤均为:(详细过程如 三、测试方案)
1、部署指定版本集群
2、新建测试租户
3、一键测试
4.1 OceanBase4.0 warehouses=10
4.1.1 obd一键执行
nohup obd test tpcc obcluster --tenant=obmysql --warehouses 10 --terminals=50 --load-workers=10 --run-mins 5 &
4.1.2 TPC-C Result
Measured tpmC (NewOrders) : 37842.69
Measured tpmTOTAL : 83986.33
Session Start : 2023-03-11 11:10:11
Session End : 2023-03-11 11:15:11
Transaction Count : 420247
4.2 OceanBase4.0 warehouses=100
4.2.1 obd一键执行
nohup obd test tpcc obcluster --tenant=obmysql --warehouses 100 --terminals=50 --load-workers=10 --run-mins 5 &
4.2.2 TPC-C Result
Measured tpmC (NewOrders) : 40114.97
Measured tpmTOTAL : 89014.79
Session Start : 2023-03-11 11:35:32
Session End : 2023-03-11 11:40:32
Transaction Count : 445162
4.3 OceanBase3.1.4 warehouses=10
4.3.1 obd一键执行
nohup obd test tpcc obcluster --tenant=obmysql --warehouses 10 --terminals=50 --load-workers=10 --run-mins 5 &
4.3.2 TPC-C Result
Measured tpmC (NewOrders) : 27894.5
Measured tpmTOTAL : 62126.97
Session Start : 2023-03-10 14:06:36
Session End : 2023-03-10 14:11:37
Transaction Count : 310871
4.4 OceanBase3.1.4 warehouses=100
4.4.1 obd一键执行
nohup obd test tpcc obcluster --tenant=obmysql --warehouses 100 --terminals=50 --load-workers=10 --run-mins 5 &
4.4.2 TPC-C Result
Measured tpmC (NewOrders) : 30006.09
Measured tpmTOTAL : 66771.75
Session Start : 2023-03-10 14:35:57
Session End : 2023-03-10 14:40:57
Transaction Count : 333919
五、结果对比
以下是租户规格2C16G,单unit时的测试数据。资源规格较小,且单zone无法利用多节点性能,所以不代表OB的实际性能,但通过OB4.0和3.1.4版本的测试数据对比来看,也足以体现OB4.0性能提升是显著的。
terminals=50,warehouses=? | OB4.0 tpmC | OB3.1.4 tpmC | OB4.0提升 |
---|---|---|---|
10 | 37842.69 | 27894.5 | +36% |
100 | 40114.97 | 30006.09 | +34% |
六、总结
1、Oceanbase 4.0小鱼 较 3.x TPCC性能得到显著提升。相信加上分布式多节点计算能力和DML并行能力的加持,OB4.0能在联机事务场景下得到更广泛的应用,受到更多开发或企业用户的青睐。
2、OBD自动化部署软件用起来越来越得心应手,功能也在不断丰富。本次的测试中,OBD自动化完成了表结构创建,集群合并,数据装载,集群参数调优/恢复,TPCC测试等。是值得推荐和并加以利用的一款工具,感觉围绕它能构建自定义的OB运维平台。