文档

列存索引TPC-H测试

更新时间:

本文详细介绍了PolarDB-X列存索引的TPC-H测试设计、测试过程和测试结果。

背景信息

TPC-H是业界常用的一套Benchmark,由TPC委员会制定发布,用于评测数据库的分析型查询能力。TPC-H查询包含8张数据表、22条复杂的SQL查询,大多数查询包含若干表Join、子查询和Group-by聚合等。

说明

本文的TPC-H的实现基于TPC-H的基准测试,并不能与已发布的TPC-H基准测试结果相比较,本文中的测试并不符合TPC-H基准测试的所有要求。

测试设计

测试数据量

测试基于100 GB数据量(Scalar Factor=100),其中主要表数据量如下:

  • LINEITEM约6亿行

  • ORDERS 1.5亿行

  • PART_SUPP 8000万行

测试所用实例规格

节点规格

节点数

8c32g

2/4

16c64g

2/3/4/6

测试所用压力机规格

ecs.g7.4xlarge(16 vCPU,64 GB内存)

测试方法

步骤1:准备压力机ECS

需准备一个ECS,后续操作步骤中涉及的数据导入、运行压测等使用的都是这台ECS机器。

说明
  • 请将测试所用的ECS部署在VPC网络内,并记住该VPC的名称和ID,后续的所有实例都将部署在该VPC内。

  • 建议ECS的操作系统为CentOS,并开放公网IP。

步骤2:准备压测所用PolarDB-X实例

创建PolarDB-X实例,具体步骤请参见创建实例

说明
  • 需保证实例和压力机ECS在同一个VPC中。

  • PolarDB-X实例的白名单添加压力机ECS的内网地址。

步骤3:调整实例参数

说明

为了在压测场景下达到最佳性能,需要调整PolarDB-X计算层实例参数。

  1. 修改参数XPROTO_MAX_DN_CONCURRENT的值为4000,具体步骤请参见参数设置

  2. 通过命令行连接到PolarDB-X实例,在同一会话内执行如下SQL语句,关闭日志记录、CPU采样统计与统计信息自动采集。

    set global RECORD_SQL = false;
    set global MPP_METRIC_LEVEL = 0;
    set global ENABLE_CPU_PROFILE = false;
    set global ENABLE_BACKGROUND_STATISTIC_COLLECTION=false;
    set global ENABLE_STATISTIC_FEEDBACK=false;

步骤4:安装BenchmarkBoot压测工具

  1. 为压力机ECS安全组开放4121端口,具体步骤请参见添加安全组规则

  2. 登录压力机ECS,执行bash -c "$(curl -fsSL https://benchmark-boot.oss-cn-hangzhou.aliyuncs.com/setup.sh)"安装BenchmarkBoot压测工具,具体步骤请参见BenchmarkBoot下载安装

  3. 在浏览器上打开http://{压力机公网IP}:4121,出现BenchmarkBoot首页代表安装成功。

步骤5:数据准备

  1. 在BenchmarkBoot的运行压测 > 数据库连接 > 配置数据库连接界面中,配置PolarDB-X连接串(主机ip、端口、用户名、密码),输入TPC-H库名、建库模式选择AUTO,单击提交1701177480105-291f0406-8b6f-4a5e-a9dc-fad3a3c6e82e.png

  2. 在BenchmarkBoot的运行压测 > TPCH > 导入TPCH界面中,输入数据集规模(GB)为100,物理分片数为24,单击提交,导入TPC-H 100 GB数据到PolarDB-X主实例。EEE.png

    说明

    在数据导入完成后,BenchmarkBoot会自动执行analyze table收集统计信息。

  3. 确认上一步的TPC-H 100 GB数据集导入完成后,在PolarDB-X主实例上执行以下SQL创建列存索引,具体步骤请参见创建和使用CCI

    create clustered columnar index `nation_col_index` on nation(`n_nationkey`) partition by hash(`n_nationkey`) partitions 1;
    
    create clustered columnar index `region_col_index` on region(`r_regionkey`) partition by hash(`r_regionkey`) partitions 1;
    
    create clustered columnar index `customer_col_index` on customer(`c_custkey`) partition by hash(`c_custkey`) partitions 24;
    
    create clustered columnar index `part_col_index` on part(`p_size`) partition by hash(`p_partkey`) partitions 24;
    
    create clustered columnar index `partsupp_col_index` on partsupp(`ps_partkey`) partition by hash(`ps_partkey`) partitions 24;
    
    create clustered columnar index `supplier_col_index` on supplier(`s_suppkey`) partition by hash(`s_suppkey`) partitions 24;
    
    create clustered columnar index `orders_col_index` on orders(`o_orderdate`,`o_orderkey`) partition by hash(`o_orderkey`) partitions 24;
    
    create clustered columnar index `lineitem_col_index` on lineitem(`l_shipdate`,`l_orderkey`) partition by hash(`l_orderkey`) partitions 24;
    说明
    • 可以执行show columnar index查看当前的列存索引状态,具体步骤请参见SHOW COLUMNAR INDEX

    • 创建列存索引总耗时约为45分钟。

步骤6:添加列存只读实例

PolarDB-X主实例添加列存只读实例,具体步骤请参见添加列存只读实例

说明

PolarDB-X列存只读实例的白名单添加压力机ECS的内网地址。

步骤7:进行TPC-H测试

  1. 在BenchmarkBoot的运行压测 > 数据库连接 > 配置数据库连接界面中,配置列存只读实例连接串,输入TPC-H库名、建库模式选择自动判断,单击提交

  2. 在BenchmarkBoot的运行压测 > TPCH > 运行TPCH界面中,选择所有查询、填入任务描述,单击提交,运行TPC-H测试的22条查询语句。GGG.png

  3. 在BenchmarkBoot的压测结果 > TPCH界面中,查看最终压测结果。

    说明

    第一次运行TPC-H需要预热,建议运行多轮后,得到最终稳定的压测结果。

测试结果

以下结果的时间单位为:秒(s)

查询

8c32g *2

8c32g * 4

16c64g * 2

16c64g * 3

16c64g * 4

16c64g * 6

Q1

14.16

6.84

6.66

2.41

1.57

1.12

Q2

2.73

2.76

1.73

1.22

0.91

0.72

Q3

5.58

2.59

4.01

1.43

1.20

0.82

Q4

6.59

1.68

1.88

1.09

0.80

0.55

Q5

11.99

5.09

5.98

3.52

2.71

2.33

Q6

1.72

0.25

0.23

0.17

0.30

0.11

Q7

6.90

3.89

3.81

2.65

2.08

1.57

Q8

4.39

2.63

2.65

1.99

1.60

1.49

Q9

21.32

10.25

10.55

6.93

5.08

3.65

Q10

8.48

3.69

4.22

2.60

1.99

1.23

Q11

1.67

0.59

0.58

0.49

0.36

0.28

Q12

4.11

1.08

1.16

0.73

0.52

0.41

Q13

11.6

5.13

5.09

3.05

1.89

1.39

Q14

2.80

1.49

0.87

0.53

0.52

0.34

Q15

2.04

0.98

0.97

0.56

0.44

0.28

Q16

2.69

1.39

1.40

0.94

0.82

0.61

Q17

8.45

1.20

1.92

1.42

1.11

0.66

Q18

10.38

4.03

5.20

3.45

2.62

1.55

Q19

6.03

2.25

2.13

1.23

0.91

0.69

Q20

6.43

2.98

3.28

2.15

1.62

1.03

Q21

21.02

8.08

8.12

4.90

4.60

3.79

Q22

4.10

1.39

1.38

1.02

0.69

0.45

总时间

165.18

70.26

73.82

44.48

34.34

25.07

  • 本页导读 (0)
文档反馈