适用于 AWS Redshift 的 TPC-DS 基准测试
简体中文 | English
日期:2021年08月24日
作者:何志明(自编辑&整理)
1. 组件环境
Redshift | TPC-DS |
---|---|
dc2.large | 3 nodes | 480 GB | v3.2.0rc1 |
1.1 什么是TPC-DS?
- 什么是TPC?
TPC (事务处理性能测试委员会),有两个主要职责:一是制定计算机事务处理能力测试标准,二是监督其执行。其总部位于美国,绝大多数会员都是美、日、西欧的大公司。
目前支持数据库三个方向的Benchmark测试,如下图:
- TPC-H vs TPC-DS
数据类型:
TPC-H: 关系模型第三范式
TPC-DS: 关系模型,星型模型,雪花模型
性能分析:
TPC-H:严重依赖于索引,容易被hack
TPC-DS:健壮性好,能够比较客观的反映系统的真实性能
1.2 TPC-DS的特性
- 数据真实,数据量大,且含数据倾斜。
- 测试案例SQL比较复杂,几乎所有案例都有很高的IO负载和CPU计算需求
- 测试案例中包含各种业务模型(如分析报告型,迭代式的联机分析型,数据挖掘型等),并且每一个SQL查询测试都是真实的业务需求
- TPC-DS v2&v3版本: 性价比计算方式变化
1.3 TPC-DS 基准测试维度
-
Power测试:是用于评测数据库对单个查询流的处理能力;
- 99个SQL查询流只执行一次;
-
Throughput测试:是用于测试DBMS 对多个查询流并发查询和操作的处理能力;
- 数据查询执行两次,每次执行至少20 个以上的并行查询流;
- 数据查询执行两次,每次执行至少20 个以上的并行查询流;
-
评价指标:
- Performance (QphDS@SF):反映每秒的有效查询数据量的性能指标,越大越好;
- Cost Performance (Price/QphDS@SF):反映每秒每查询数据量的性价比指标,值越小说明性价比越高;
1.4 TPC-DS 测试表数据详情
- TPC-DS v3.2.0 | Scale: 100 (GB) | Total bytes: 102462037125 | Total: 102.47 GB
No. | Table Name | Bytes | GiB | Row Count Estimate | Bytes/Row | Dimension/Fact Table | Notes |
---|---|---|---|---|---|---|---|
1 | store_sales | 40671627884 | 37.88GiB | 28795080 | 1412 | Fact Table | 通过Store渠道销售商品的订单信息 |
2 | catalog_sales | 30872465193 | 28.75GiB | 143997072 | 214 | Fact Table | 通过Catalog渠道销售商品的订单信息 |
3 | inventory | 8226939134 | 7.66 GiB | 399329984 | 21 | Fact Table | 仓储相关信息 |
4 | web_sales | 15391511849 | 14.33GiB | 72001240 | 214 | Fact Table | 通过Catalog渠道销售商品的订单信息 |
5 | store_returns | 3455072075 | 3.22GiB | 287997024 | 12 | Fact Table | 通过Store渠道销售商品的退货信息 |
6 | catalog_returns | 2264820940 | 2.11GiB | 14404374 | 157 | Fact Table | 通过Catalog渠道销售商品的退货信息 |
7 | web_returns | 1046331434 | 0.97GiB | 7197670 | 145 | Fact Table | 通过web渠道销售商品的退货信息 |
8 | customer_demographics | 78739296 | 1920800 | 41 | Dimension Table | 客户基本信用情况 | |
9 | customer | 267515941 | 2000000 | 134 | Dimension Table | 客户相关信息 | |
10 | item | 58162791 | 204000 | 285 | Dimension Table | 商品信息 | |
11 | customer_address | 110154196 | 1000000 | 110 | Dimension Table | 客户地址信息 | |
12 | date_dim | 10244389 | 73049 | 140 | Dimension Table | 时间(日历)维度信息 | |
13 | time_dim | 5021380 | 86400 | 58 | Dimension Table | 时间维度信息 | |
14 | catalog_page | 2837522 | 20400 | 139 | Dimension Table | 商品目录相关信息 | |
15 | household_demographics | 144453 | 7200 | 20 | Dimension Table | 家庭基本信用信息 | |
16 | promotion | 123973 | 1000 | 124 | Dimension Table | 商品促销信息 | |
17 | store | 106418 | 402 | 265 | Dimension Table | 商户信息 | |
18 | web_page | 197009 | 2040 | 97 | Dimension Table | 商品网页基本信息 | |
19 | web_site | 6850 | 24 | 285 | Dimension Table | 商品网站基本信息 | |
20 | call_center | 9326 | 30 | 311 | Dimension Table | 客户服务中心相关信息 | |
21 | reason | 1904 | 55 | 35 | Dimension Table | 用户退货原因 | |
22 | warehouse | 1767 | 15 | 118 | Dimension Table | 仓库基本信息 | |
23 | ship_mode | 1093 | 20 | 55 | Dimension Table | 商品快递信息 | |
24 | income_band | 308 | 20 | 15 | Dimension Table | 收入信息 |
2. 测试流程
2.1 申请TPC官方Benchmark工具包及文档
- 官网下载地址:TPC Download Current Specs/Source
- 注意事项:申请测试包需要切换到外网环境,否则无法弹出官网的人机验证,如下图 Figure 1;
- 官方介绍文档不用切换网络环境,可以下载,内容涉及工具包的更新log,查询SQL反馈的实际业务目的,ER图等等…
- 如果没有外网条件或嫌麻烦,可以下载在此v3.2.0rc1版本TPC-DS工具包:阿里云盘分享
2.2 安装TPC-DS工具包 (base on Linux)
- 要安装依赖;
yum -y install gcc gcc-c++ libstdc++-devel bison byacc flex
- 解压缩zip工具包;
unzip tpc-ds-3.2.0rc1-tool.zip
- 进入tools目录,执行Makefile编译(无报错,表示执行成功,如 下图Figure 2);
2.3 修改建表语句,使其符合 AWS Redshift 标准的DDL
- tools目录下的 tpcds.sql 文件即TPC提供的标准建表语句,但其并不适用于Redshift;
- 此步骤可参考AWS官方实践的Benchmark所提供DDL文件(GitHub);
—— Cloud-DWB-Derived-from-TPCDS - 官方提供的DDL.sql文件已对于每张测试表都调整好了分布键和排序键,能较好的发挥性能;
- 但其基于的是TPC-DS v2.13,仍需要修改DDL.sql部分字段;
- 可参考这里我提供的基于AWS 官方DDL.sql修改后的建表文件;
—— TPCDS_for_redshift_DDL
2.4 构建测试数据集
- 创建测试数据集文件存放的目录;
mkdir data100g
- 在tools目录下,构建测试数据集;
./dsdgen -SCALE 100 -DIR ./data100g -SUFFIX .csv -TERMINATE N
- ./dsdgen命令参数说明;
[admin@cdp-wh-163 ~]$ ./dsdgen -help
dsdgen Population Generator (Version 3.2.0)
Copyright Transaction Processing Performance Council (TPC) 2001 - 2021
USAGE: dsdgen [options]
Note: When defined in a parameter file (using -p), par