一、評(píng)測(cè)結(jié)果
- 64核256g內(nèi)存的機(jī)器上,在ssb1000g數(shù)據(jù)集下,翰云數(shù)據(jù)庫(cloudwave)在維度表與事實(shí)表之間做多表聯(lián)合join時(shí),查詢耗時(shí)幾乎為零,CPU占用幾乎為零。
備注:
| 數(shù)據(jù)庫 | CPU | 數(shù)據(jù)集 | SQL1響應(yīng)時(shí)間(ms) | SQL2響應(yīng)時(shí)間(ms) | SQL1 CPU 最大占用率 | SQL2 CPU 最大占用率 |
|---|---|---|---|---|---|---|
| 翰云數(shù)據(jù)庫(cloudwave) | 龍芯(loongson) | ssb1000 | 32 | 41 | 0.31%(20%/6400%) | 0.42%(27.4%/6400%) |
二、評(píng)測(cè)環(huán)境
- 硬件環(huán)境:4臺(tái) 64核256g 龍芯服務(wù)器(組成4節(jié)點(diǎn)的集群),3.5TB nvme 固態(tài)硬盤
-
軟件環(huán)境:
-
操作系統(tǒng):Loongnix-Server Linux release 8.4.0
內(nèi)核版本 各個(gè)服務(wù)器節(jié)點(diǎn)ssh互信任
openjdk17(龍芯cpu支持的最高推薦jdk,支持 vector api)、hadoop 3.2.2(作為cloudwave 的分布式存儲(chǔ),副本數(shù)=3)
-
- 軟件版本:Cloudwave 4.0(最新版在2023年5月份發(fā)版)
- 評(píng)測(cè)數(shù)據(jù)集:ssb1000
| 表名 | 行數(shù) | 說明 |
|---|---|---|
| lineorder | 60 億 | SSB 商品訂單表 |
| customer | 3000 萬 | SSB 客戶表 |
| part | 200 萬 | SSB 零部件表 |
| supplier | 200 萬 | SSB 供應(yīng)商表 |
| dates | 2556 | 日期表 |
三、評(píng)測(cè)SQL
- 評(píng)測(cè)SQL1:select count(*) from lineorder,customer where lo_custkey = c_custkey;
- 評(píng)測(cè)SQL2:select count(*) from lineorder,customer,supplier where lo_custkey = c_custkey and lo_suppkey = s_suppkey;
第1條SQL是將lineorder這張事實(shí)表與customer這張維度表join,加count()是迫使數(shù)據(jù)庫必須把所有的記錄都join上。
第2條SQL是將lineorder這張事實(shí)表與customer、supplier 這兩張維度join,加count()同樣是迫使數(shù)據(jù)庫必須把所有的記錄都join上。
三、評(píng)測(cè)方法
- 執(zhí)行100輪SQL1和SQL2的測(cè)試腳本,獲得sql的平均耗時(shí)
- 觀察最大CPU占用
四、開始評(píng)測(cè)
-
啟動(dòng)并導(dǎo)入ssb1000數(shù)據(jù) 到cloudwave
-
執(zhí)行SQL1測(cè)試
./test_join1.sh
## 腳本內(nèi)容見附錄
- 可以看到cloudwave CPU最大占用是20%
-
分析SQL結(jié)果
./query_result.sh
- 可以看到cloudwave SQL1的耗時(shí)0.032秒左右。(天吶!lineorder(數(shù)據(jù)量60億),join customer(數(shù)據(jù)量3000萬),竟然只需要0.032秒)
-
執(zhí)行SQL2測(cè)試
./test_join2.sh
## 腳本內(nèi)容見附錄
- 可以看到CPU最大占用是27.4%
-
分析SQL結(jié)果
./query_result.sh
- 可以看到cloudwave SQL2 的耗時(shí)也是0.041秒左右。(天吶!??!lineorder(數(shù)據(jù)量60億),join customer(數(shù)據(jù)量3000萬),再join supplier(數(shù)據(jù)量200萬)竟然也只需要0.041秒。簡(jiǎn)直像開了掛——官方說:我們對(duì)于事實(shí)表與維度表多表聯(lián)合join的時(shí)間應(yīng)該為零)
[附錄]
- 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文件內(nèi)容
use ssb1000;
select count(*) from lineorder,customer where lo_custkey = c_custkey;
- sql_join_2.sql文件內(nèi)容
select count(*) from lineorder,customer,supplier where lo_custkey = c_custkey and lo_suppkey = s_suppkey;
- query_result.sh腳本內(nèi)容
#!/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腳本內(nèi)容
#!/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





