OB 4.0VS MySQL5.7 看看谁的性能更好。

昨天发布了OB4.0 ,OB4.0有许多新特性,让我们看看OB4.0和MySQL5.7性能对比。
一、服务器规格和版本
40核心256G内存 SSD硬盘 5千万数据 采用sysbench-1.0.20压测 oltp_write_only脚本。
OB 4.0单机版本 MySQL5.7.40

二、OB4.0和MySQL5.7配置说明

因为是压力测试,不采用 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
    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');

MySQL的配置信息


[mysqld]
user=mysql
basedir=/usr/local/src/mysql
datadir=/data/mysql
server_id=6
innodb_buffer_pool_size=100G
port=3306
socket=/tmp/mysql.sock
log-error = error.log
innodb_io_capacity = 8000
innodb_io_capacity_max = 16000
innodb_open_files = 65535
innodb_log_file_size=2G
innodb_thread_concurrency=40

[mysql]
socket=/tmp/mysql.sock

三、开始压测
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

MySQL压测数据

可以把并发数加大,ob并发数可以上到2000