一、评测结果
- 64核256g内存的机器上,在ssb1000g数据集下,翰云数据库(cloudwave)在维度表与事实表之间做多表联合join时,查询耗时几乎为零,CPU占用几乎为零。
备注:
数据库 | CPU | 数据集 | SQL1响应时间(ms) | SQL2响应时间(ms) | SQL1 CPU 最大占用率 | SQL2 CPU 最大占用率 |
---|---|---|---|---|---|---|
翰云数据库(cloudwave) | 龙芯(loongson) | ssb1000 | 32 | 41 | 0.31%(20%/6400%) | 0.42%(27.4%/6400%) |
二、评测环境
- 硬件环境:4台 64核256g 龙芯服务器(组成4节点的集群),3.5TB nvme 固态硬盘
-
软件环境:
-
操作系统:Loongnix-Server Linux release 8.4.0
内核版本
-
各个服务器节点ssh互信任
-
openjdk17(龙芯cpu支持的最高推荐jdk,支持 vector api)、hadoop 3.2.2(作为cloudwave 的分布式存储,副本数=3)
-
- 软件版本:Cloudwave 4.0(最新版在2023年5月份发版)
- 评测数据集:ssb1000
表名 | 行数 | 说明 |
---|---|---|
lineorder | 60 亿 | SSB 商品订单表 |
customer | 3000 万 | SSB 客户表 |
part | 200 万 | SSB 零部件表 |
supplier | 200 万 | SSB 供应商表 |
dates | 2556 | 日期表 |
三、评测SQL
- 评测SQL1:select count(*) from lineorder,customer where lo_custkey = c_custkey;
- 评测SQL2:select count(*) from lineorder,customer,supplier where lo_custkey = c_custkey and lo_suppkey = s_suppkey;
第1条SQL是将lineorder这张事实表与customer这张维度表join,加count()是迫使数据库必须把所有的记录都join上。
第2条SQL是将lineorder这张事实表与customer、supplier 这两张维度join,加count()同样是迫使数据库必须把所有的记录都join上。
三、评测方法
- 执行100轮SQL1和SQL2的测试脚本,获得sql的平均耗时
- 观察最大CPU占用
四、开始评测
-
启动并导入ssb1000数据 到cloudwave
-
执行SQL1测试
./test_join1.sh
## 脚本内容见附录
- 可以看到cloudwave CPU最大占用是20%
-
分析SQL结果
./query_result.sh
- 可以看到cloudwave SQL1的耗时0.032秒左右。(天呐!lineorder(数据量60亿),join customer(数据量3000万),竟然只需要0.032秒)
-
执行SQL2测试
./test_join2.sh
## 脚本内容见附录
- 可以看到CPU最大占用是27.4%
-
分析SQL结果
./query_result.sh
- 可以看到cloudwave SQL2 的耗时也是0.041秒左右。(天呐!!!lineorder(数据量60亿),join customer(数据量3000万),再join supplier(数据量200万)竟然也只需要0.041秒。简直像开了挂——官方说:我们对于事实表与维度表多表联合join的时间应该为零)
[附录]
- test_join1.sh脚本
#!/bin/bash
# Program:
# test ssb
# History:
# 2023/03/17 junfenghe.cloud@qq.com version:0.0.1
for ((i=1; i<30; i++))
do
cat sql_join_1.sql |./cplus.sh > n${i}.txt
done
#cat sql_ssb.sql |./cplus.sh > n1.txt
- test_join2.sh脚本
#!/bin/bash
# Program:
# test ssb
# History:
# 2023/03/17 junfenghe.cloud@qq.com version:0.0.1
for ((i=1; i<30; i++))
do
cat sql_join_2.sql |./cplus.sh > n${i}.txt
done
#cat sql_ssb.sql |./cplus.sh > n1.txt
- sql_join_1.sql文件内容
use ssb1000;
select count(*) from lineorder,customer where lo_custkey = c_custkey;
- sql_join_2.sql文件内容
select count(*) from lineorder,customer,supplier where lo_custkey = c_custkey and lo_suppkey = s_suppkey;
- query_result.sh脚本内容
#!/bin/bash
# Program:
# list query time
# History:
# 2023/05/12 junfenghe.cloud@qq.com version:0.0.1
path=/bin:/sbinz:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export path
./analysis.sh cloudwave "$(ls n*txt)" + > query_time.txt
echo "desc history;" | ./cplus.sh > jobinfo.txt
- analysis.sh脚本内容
#!/bin/bash
#Program:
# analysis cloudwave/starrocks logs of base compute
#History:
#2023/02/20 junfenghe.cloud@qq.com version:0.0.1
path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:~/bin
export path
suff="(s)#####"
if [ -z "${1}" ]
then
echo "Please input database'name"
exit -1
fi
if [ -z "$2" ]
then
echo "Please input times of scanner"
exit -f
fi
if [ -n "${3}" ]
then
suff=${3}
fi
for current in ${2}
do
result_time=""
if [ "${1}" == "starrocks" ]
then
for time in $( cat ${current} | grep sec | awk -F '(' '{print $2}' | awk -F ' ' '{print $1}' )
do
result_time="${result_time}${time}${suff}"
done
elif [ "${1}" == "cloudwave" ]
then
for time in $( cat ${current} | grep Elapsed | awk '{print $2}'| sed 's/:/*60+/g'| sed 's/+00\*60//g ; s/+0\*60//g ; s/^0\*60+//g' )
do
result_time="${result_time}${time}${suff}"
done
fi
echo ${result_time%${suff}*}
done
exit 0
# echo $1
# echo $#
# echo $?
# echo $!
# echo $0
网友评论