【建议收藏OceanBase 4.1 全面测评及部署流程,看这篇就够了
作者:杨家鑫 多点⾼级 DBA ,擅⻓故障分析与性能优化,喜欢探索新技术,爱好摄影。
背景
测试 OceanBase 对比 MySQL,TiDB 的性能表现,数据存储压缩,探索多点内部项目一个数据库场景落地 Oceanbase(MySQL->OceanBase)。
单机测试
准备
OBD 方式部署单机
文件准备
wget https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/7/x86_64/oceanbase-all-in-one-4.1.0.0-100120230323143519.el7.x86_64.tar.gz?Expires=1681878350&OSSAccessKeyId=LTAI5tGVLeRRycCRGerZJMNC&Signature=4E8%2FW77U1MAqq1ttNvuljadkTq0%3D
mv oceanbase-all-in-one-4.1.0.0-100120230323143519.el7.x86_64.tar.gz?Expires=1681878350 oceanbase-all-in-one-4.1.0.0-100120230323143519.el7.x86_64.tar.gz
tar -zxf oceanbase-all-in-one-4.1.0.0-100120230323143519.el7.x86_64.tar.gz -C /usr/local
安装相关包
/usr/local/oceanbase-all-in-one/bin/install.sh
.......
#####################################################################
Install Finished
=====================================================================
Setup Environment: source ~/.oceanbase-all-in-one/bin/env.sh
Start Web Service: obd web
Quick Start: obd demo
More Details: obd -h
=====================================================================
修改配置文件
包含组件:oceanbase-ce、obproxy-ce、obagent、grafana、Prometheus
cp /usr/local/oceanbase-all-in-one/obd/usr/obd/example/all-components.yaml ./
vi all-components.yaml
- memory_limit 64G observer 总内存(租户内存+系统内存)
- system_memory 30G 系统内存
- datafile_size 1500G 数据文件大小(启动就会预分配)
- log_disk_size 日志文件大小(启动就会预分配)
# all-components.yaml
oceanbase-ce:
servers:
- name: server1
ip: 127.0.0.1
global:
devname: lo
memory_limit: 64G # The maximum running memory for an observer
system_memory: 30G
datafile_size: 1500G # Size of the data file.
log_disk_size: 800G # The size of disk space used by the clog files.
.......
server1:
........
zone: zone1
obproxy-ce:
depends:
- oceanbase-ce
servers:
- 127.0.0.1
global:
......
obagent:
depends:
- oceanbase-ce
servers:
- name: server1
ip: 127.0.0.1
global:
home_path: /data/obagent1
ocp-express:
depends:
- oceanbase-ce
- obproxy-ce
- obagent
servers:
- 127.0.0.1
global:
.....
部署启动
obd cluster deploy obtest -c all-components.yaml
+--------------------------------------------------------------------------------------------+
| Packages |
+--------------+---------+------------------------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+------------------------+------------------------------------------+
| oceanbase-ce | 4.1.0.0 | 100000192023032010.el7 | 8439ecf8db5e0649bd49671b41ea9e8c85756b63 |
| obproxy-ce | 4.1.0.0 | 7.el7 | 2a9d9bf67f179dcca2a8c9e7c77373d94e7e2abe |
| obagent | 1.3.0 | 22.el7 | d57fbb4962b2fbecb6282358c59295fdfba4d6ac |
| ocp-express | 1.0.0 | 100000432023032015.el7 | 42c6fc921063f24f9e1072d75bfa7f21f42146e3 |
+--------------+---------+------------------------+------------------------------------------+
------
obd cluster start obtest
...
+---------------------------------------------+
| observer |
+-----------+---------+------+-------+--------+
| ip | version | port | zone | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.1.0.0 | 4000 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P4000 -uroot -Doceanbase -A
+---------------------------------------------+
| obproxy |
+-----------+------+-----------------+--------+
| ip | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884 | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -Doceanbase -A
+------------------------------------------------------------------+
| obagent |
+---------------+--------------------+--------------------+--------+
| ip | mgragent_http_port | monagent_http_port | status |
+---------------+--------------------+--------------------+--------+
| 10.xxxx | 8089 | 8088 | active |
+---------------+--------------------+--------------------+--------+
+------------------------------------------------------------------+
| ocp-express |
+---------------------------+----------+------------------+--------+
| url | username | default_password | status |
+---------------------------+----------+------------------+--------+
| http://10.xxxx:8180 | admin | oceanbase | active |
+---------------------------+----------+------------------+--------+
创建 MySQL 用户
create resource unit ut1 max_cpu 32,memory_size '16G';
create resource pool p1 unit 'ut1',unit_num 1;
create tenant mysql resource_pool_list=('p1') set ob_tcp_invited_nodes='%';
重要配置
OceanBase | TiDB | MySQL | |
---|---|---|---|
社区版本 | v4.1.0 | v6.1.5 | v5.7.16 |
内存配置 | 租户memory_size 16G | block_cache_size 16G | innodb_buffer_pool_size 16G |
单机器配置 | 32C RAID10 SSD | 32C RAID10 SSD | 32C RAID10 SSD |
刷盘配置 | 默认强制刷盘(无刷盘相关配置参数) | sync-log=1 | sync_binlog=1 |
并发数 | 5,10,20,30,60,120 | 5,10,20,30,60,120 | 5,10,20,30,60,120 |
测试模式 | read_write,read_only,write_only | read_write,read_only,write_only | read_write,read_only,write_only |
单次测试时间 | 300s共 18 种测试(并发数x测试模式) | 300s共18种测试(并发数x测试模式) | 300s共 18 种测试(并发数x测试模式) |
每种测试方法 | obd test sysbench(OBD 自带) 先 prepare、再 run、再 cleanup | sysbench prepare sysbench runsysbench cleanup | sysbench prepare sysbench run sysbench cleanup |
- 架构层级:
- MySQL 一层架构、OceanBase 二层架构(OBProxy + OBServer)、TiDB 三层架构(TiDB+PD+TiKV);
- 每多一层网络层面的延迟消耗会增加。
- QPS:平均延迟 OceanBase 表现相对于 MySQL 表现均可以
- QPS 延迟时间相对是 MySQL 的 1/3(最低 QPS 也过万,最低平均延迟 3ms);
- 数据压缩率(表仅 2 数值、2 字符字段)是 MySQL 的 3/5。
- sysbench 表相对简单和实践生产场景表有一定差异,本次测试作为参考
- 每种测试(每类数据库共 18 种测试)均会生成测试数据(prepare)、跑测试(run)、清理测试数据(cleanup)