Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
d5adb474
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d5adb474
编写于
8月 04, 2021
作者:
H
Hui Li
提交者:
GitHub
8月 04, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7154 from taosdata/xiaoping/test_case
[TD-5730]<test>: update performance test script
上级
f6757b00
45be5de3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
143 addition
and
109 deletion
+143
-109
tests/perftest-scripts/perftest-query.sh
tests/perftest-scripts/perftest-query.sh
+32
-41
tests/pytest/insert/insertFromCSVPerformance.py
tests/pytest/insert/insertFromCSVPerformance.py
+35
-27
tests/pytest/query/queryPerformance.py
tests/pytest/query/queryPerformance.py
+44
-22
tests/pytest/tools/taosdemoPerformance.py
tests/pytest/tools/taosdemoPerformance.py
+32
-19
未找到文件。
tests/perftest-scripts/perftest-query.sh
浏览文件 @
d5adb474
#!/bin/bash
branch
=
if
[
x
$1
!=
x
]
;
then
branch
=
$1
...
...
@@ -8,17 +9,19 @@ else
echo
"Please enter branch name as a parameter"
exit
1
fi
jemalloc
=
type
=
if
[
x
$2
!=
x
]
;
then
jemalloc
=
jemalloc
type
=
jemalloc
echo
"Building TDengine using jemalloc"
else
type
=
glibc
echo
"Building TDengine using glibc"
fi
today
=
`
date
+
"%Y%m%d"
`
WORK_DIR
=
/
home/ubuntu
/pxiao
PERFORMANCE_TEST_REPORT
=
$WORK_DIR
/TDengine/tests/performance-
test-report
-
$today
.log
WORK_DIR
=
/
root
/pxiao
PERFORMANCE_TEST_REPORT
=
$WORK_DIR
/TDengine/tests/performance-
report-
$branch
-
$type
-
$today
.log
# Coloured Echoes #
function
red_echo
{
echo
-e
"
\0
33[31m
$@
\0
33[0m"
;
}
#
...
...
@@ -64,52 +67,41 @@ function buildTDengine {
echo
"REMOTE:
$REMOTE_COMMIT
"
if
[
"
$LOCAL_COMMIT
"
==
"
$REMOTE_COMMIT
"
]
;
then
echo
"repo up-to-date"
fi
git pull
>
/dev/null 2>&1
if
[
$type
=
"jemalloc"
]
;
then
echo
"git submodule update --init --recursive"
git submodule update
--init
--recursive
fi
LOCAL_COMMIT
=
`
git rev-parse
--short
@
`
cd
debug
rm
-rf
*
if
[
$type
=
"jemalloc"
]
;
then
echo
"cmake .. -DJEMALLOC_ENABLED=true > /dev/null"
cmake ..
-DJEMALLOC_ENABLED
=
true
>
/dev/null
else
echo
"repo need to pull"
git pull
>
/dev/null 2>&1
LOCAL_COMMIT
=
`
git rev-parse
--short
@
`
if
[
$jemalloc
=
"jemalloc"
]
;
then
echo
"git submodule update --init --recursive"
git submodule update
--init
--recursive
fi
cd
debug
rm
-rf
*
if
[
$jemalloc
=
"jemalloc"
]
;
then
echo
"cmake .. -DJEMALLOC_ENABLED=true > /dev/null"
cmake ..
-DJEMALLOC_ENABLED
=
true
>
/dev/null
else
cmake ..
>
/dev/null
fi
make
&&
make
install
>
/dev/null
cmake ..
>
/dev/null
fi
make
>
/dev/null 2>&1
make
install
>
/dev/null 2>&1
echo
"Build TDengine on remote server"
ssh perftest
"./buildTDengine.sh
$branch
> /dev/null"
}
function
runQueryPerfTest
{
[
-f
$PERFORMANCE_TEST_REPORT
]
&&
rm
$PERFORMANCE_TEST_REPORT
nohup
$WORK_DIR
/TDengine/debug/build/bin/taosd
-c
/etc/
taos
perf/
>
/dev/null 2>&1 &
nohup
$WORK_DIR
/TDengine/debug/build/bin/taosd
-c
/etc/perf/
>
/dev/null 2>&1 &
echoInfo
"Wait TDengine to start"
sleep
60
echoInfo
"Run Performance Test"
cd
$WORK_DIR
/TDengine/tests/pytest
python3 query/queryPerformance.py
-c
$LOCAL_COMMIT
|
tee
-a
$PERFORMANCE_TEST_REPORT
cd
$WORK_DIR
/TDengine/tests/pytest
mkdir
-p
/var/lib/perf/
mkdir
-p
/var/log/perf/
rm
-rf
/var/lib/perf/
*
rm
-rf
/var/log/perf/
*
nohup
$WORK_DIR
/TDengine/debug/build/bin/taosd
-c
/etc/perf/
>
/dev/null 2>&1 &
echoInfo
"Wait TDengine to start"
sleep
10
echoInfo
"Run Performance Test"
cd
$WORK_DIR
/TDengine/tests/pytest
python3 query/queryPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 insert/insertFromCSVPerformance.py
-c
$LOCAL_COMMIT
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 insert/insertFromCSVPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 tools/taosdemoPerformance.py
-c
$LOCAL_COMMIT
|
tee
-a
$PERFORMANCE_TEST_REPORT
python3 tools/taosdemoPerformance.py
-c
$LOCAL_COMMIT
-b
$branch
-T
$type
|
tee
-a
$PERFORMANCE_TEST_REPORT
}
...
...
@@ -122,8 +114,7 @@ function sendReport {
sed
-i
's/\x1b\[[0-9;]*m//g'
$PERFORMANCE_TEST_REPORT
BODY_CONTENT
=
`
cat
$PERFORMANCE_TEST_REPORT
`
echo
-e
"From: <support@taosdata.com>
\n
to:
${
receiver
}
\n
subject: Query Performace Report
${
branch
}
${
jemalloc
}
${
today
}
, commit ID:
${
LOCAL_COMMIT
}
\n\n
${
today
}
:
\n
${
BODY_CONTENT
}
"
|
\
echo
-e
"From: <support@taosdata.com>
\n
to:
${
receiver
}
\n
subject: Query Performace Report
${
branch
}
${
jemalloc
}
commit ID:
${
LOCAL_COMMIT
}
\n\n
${
today
}
:
\n
${
BODY_CONTENT
}
"
|
\
(
cat
-
&&
uuencode
$PERFORMANCE_TEST_REPORT
performance-test-report-
$today
.log
)
|
\
/usr/sbin/ssmtp
"
${
receiver
}
"
&&
echo
"Report Sent!"
}
...
...
@@ -136,4 +127,4 @@ stopTaosd
echoInfo
"Send Report"
sendReport
echoInfo
"End of Test"
echoInfo
"End of Test"
\ No newline at end of file
tests/pytest/insert/insertFromCSVPerformance.py
浏览文件 @
d5adb474
...
...
@@ -22,11 +22,12 @@ import argparse
import
os.path
class
insertFromCSVPerformace
:
def
__init__
(
self
,
commitID
,
dbName
,
stbName
,
branchNam
e
):
def
__init__
(
self
,
commitID
,
dbName
,
tbName
,
branchName
,
buildTyp
e
):
self
.
commitID
=
commitID
self
.
dbName
=
dbName
self
.
stbName
=
s
tbName
self
.
tbName
=
tbName
self
.
branchName
=
branchName
self
.
type
=
buildType
self
.
ts
=
1500074556514
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
...
...
@@ -35,9 +36,15 @@ class insertFromCSVPerformace:
self
.
conn
=
taos
.
connect
(
self
.
host
,
self
.
user
,
self
.
password
,
self
.
password
,
self
.
config
)
self
.
host2
=
"192.168.1.179"
self
.
conn2
=
taos
.
connect
(
host
=
self
.
host2
,
user
=
self
.
user
,
password
=
self
.
password
,
config
=
self
.
config
)
def
writeCSV
(
self
):
with
open
(
'test3.csv'
,
'w'
,
encoding
=
'utf-8'
,
newline
=
''
)
as
csvFile
:
writer
=
csv
.
writer
(
csvFile
,
dialect
=
'excel'
)
...
...
@@ -52,47 +59,43 @@ class insertFromCSVPerformace:
data
=
data
.
drop
([
0
])
data
.
to_csv
(
"ordered.csv"
,
header
=
False
,
index
=
False
)
def
createTables
(
self
):
cursor
=
self
.
conn
.
cursor
()
cursor
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor
.
execute
(
"use %s"
%
self
.
dbName
)
cursor
.
execute
(
"create table if not exists %s(ts timestamp, in_order_time float, out_of_order_time float, commit_id binary(50)) tags(branch binary(50))"
%
self
.
stbName
)
cursor
.
execute
(
"create table if not exists %s using %s tags('%s')"
%
(
self
.
branchName
,
self
.
stbName
,
self
.
branchName
))
cursor
.
execute
(
"create table if not exists t1(ts timestamp, c1 int, c2 float, c3 int, c4 int)"
)
cursor
.
execute
(
"create table if not exists t2(ts timestamp, c1 int, c2 float, c3 int, c4 int)"
)
cursor
.
close
()
def
run
(
self
):
cursor
=
self
.
conn
.
cursor
()
cursor
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor
.
execute
(
"use %s"
%
self
.
dbName
)
print
(
"==================== CSV insert performance ===================="
)
totalTime
=
0
for
i
in
range
(
10
):
cursor
.
execute
(
"drop table if exists t1"
)
cursor
.
execute
(
"create table if not exists t1(ts timestamp, c1 int, c2 float, c3 int, c4 int)"
)
startTime
=
time
.
time
()
cursor
.
execute
(
"insert into t1 file 'outoforder.csv'"
)
totalTime
+=
time
.
time
()
-
startTime
cursor
.
execute
(
"drop table if exists t1"
)
totalTime
+=
time
.
time
()
-
startTime
out_of_order_time
=
(
float
)
(
totalTime
/
10
)
print
(
"Out of Order - Insert time: %f"
%
out_of_order_time
)
totalTime
=
0
for
i
in
range
(
10
):
cursor
.
execute
(
"drop table if exists t2"
)
cursor
.
execute
(
"create table if not exists t2(ts timestamp, c1 int, c2 float, c3 int, c4 int)"
)
startTime
=
time
.
time
()
cursor
.
execute
(
"insert into t2 file 'ordered.csv'"
)
totalTime
+=
time
.
time
()
-
startTime
cursor
.
execute
(
"drop table if exists t2"
)
totalTime
+=
time
.
time
()
-
startTime
in_order_time
=
(
float
)
(
totalTime
/
10
)
print
(
"In order - Insert time: %f"
%
in_order_time
)
cursor
.
execute
(
"insert into %s values(now, %f, %f, '%s')"
%
(
self
.
branchName
,
in_order_time
,
out_of_order_time
,
self
.
commitID
))
cursor
.
close
()
cursor2
=
self
.
conn2
.
cursor
()
cursor2
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor2
.
execute
(
"use %s"
%
self
.
dbName
)
cursor2
.
execute
(
"create table if not exists %s(ts timestamp, in_order_time float, out_of_order_time float, commit_id binary(50), branch binary(50), type binary(20))"
%
self
.
tbName
)
cursor2
.
execute
(
"insert into %s values(now, %f, %f, '%s', '%s', '%s')"
%
(
self
.
tbName
,
in_order_time
,
out_of_order_time
,
self
.
commitID
,
self
.
branchName
,
self
.
type
))
cursor2
.
close
()
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
...
...
@@ -111,7 +114,7 @@ if __name__ == '__main__':
help
=
'Database name to be created (default: perf)'
)
parser
.
add_argument
(
'-t'
,
'--
s
table-name'
,
'--table-name'
,
action
=
'store'
,
default
=
'csv_insert'
,
type
=
str
,
...
...
@@ -123,9 +126,14 @@ if __name__ == '__main__':
default
=
'develop'
,
type
=
str
,
help
=
'branch name (default: develop)'
)
parser
.
add_argument
(
'-T'
,
'--build-type'
,
action
=
'store'
,
default
=
'glibc'
,
type
=
str
,
help
=
'build type (default: glibc)'
)
args
=
parser
.
parse_args
()
perftest
=
insertFromCSVPerformace
(
args
.
commit_id
,
args
.
database_name
,
args
.
stable_name
,
args
.
branch_name
)
perftest
.
createTables
()
perftest
=
insertFromCSVPerformace
(
args
.
commit_id
,
args
.
database_name
,
args
.
table_name
,
args
.
branch_name
,
args
.
build_type
)
perftest
.
run
()
\ No newline at end of file
tests/pytest/query/queryPerformance.py
浏览文件 @
d5adb474
...
...
@@ -20,12 +20,14 @@ import argparse
class
taosdemoQueryPerformace
:
def
__init__
(
self
,
clearCache
,
commitID
,
dbName
,
stbName
,
tbPerfix
):
def
__init__
(
self
,
clearCache
,
commitID
,
dbName
,
stbName
,
tbPerfix
,
branch
,
type
):
self
.
clearCache
=
clearCache
self
.
commitID
=
commitID
self
.
dbName
=
dbName
self
.
stbName
=
stbName
self
.
tbPerfix
=
tbPerfix
self
.
branch
=
branch
self
.
type
=
type
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
self
.
password
=
"taosdata"
...
...
@@ -35,50 +37,56 @@ class taosdemoQueryPerformace:
self
.
user
,
self
.
password
,
self
.
config
)
self
.
host2
=
"192.168.1.179"
self
.
conn2
=
taos
.
connect
(
host
=
self
.
host2
,
user
=
self
.
user
,
password
=
self
.
password
,
config
=
self
.
config
)
def
createPerfTables
(
self
):
cursor
=
self
.
conn
.
cursor
()
cursor
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor
.
execute
(
"use %s"
%
self
.
dbName
)
cursor
.
execute
(
"create table if not exists %s(ts timestamp, query_time float, commit_id binary(5
0)) tags(query_id int, query_sql binary(300))"
%
self
.
stbName
)
cursor
2
=
self
.
conn2
.
cursor
()
cursor
2
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor
2
.
execute
(
"use %s"
%
self
.
dbName
)
cursor
2
.
execute
(
"create table if not exists %s(ts timestamp, query_time float, commit_id binary(50), branch binary(50), type binary(2
0)) tags(query_id int, query_sql binary(300))"
%
self
.
stbName
)
sql
=
"select count(*) from test.meters"
tableid
=
1
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select avg(f1), max(f2), min(f3) from test.meters"
tableid
=
2
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select count(*) from test.meters where loc='beijing'"
tableid
=
3
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d,
\"
%s
\"
)"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d,
\"
%s
\"
)"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select avg(f1), max(f2), min(f3) from test.meters where areaid=10"
tableid
=
4
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select avg(f1), max(f2), min(f3) from test.t10 interval(10s)"
tableid
=
5
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select last_row(*) from meters"
tableid
=
6
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select * from meters"
tableid
=
7
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select avg(f1), max(f2), min(f3) from meters where ts <= '2017-07-15 10:40:01.000' and ts <= '2017-07-15 14:00:40.000'"
tableid
=
8
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d,
\"
%s
\"
)"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d,
\"
%s
\"
)"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
sql
=
"select last(*) from meters"
tableid
=
9
cursor
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
2
.
execute
(
"create table if not exists %s%d using %s tags(%d, '%s')"
%
(
self
.
tbPerfix
,
tableid
,
self
.
stbName
,
tableid
,
sql
))
cursor
.
close
()
cursor
2
.
close
()
def
query
(
self
):
cursor
=
self
.
conn
.
cursor
()
...
...
@@ -100,20 +108,20 @@ class taosdemoQueryPerformace:
# root permission is required
os
.
system
(
"echo 3 > /proc/sys/vm/drop_caches"
)
startTime
=
time
.
time
()
startTime
=
time
.
time
()
cursor2
.
execute
(
sql
)
totalTime
+=
time
.
time
()
-
startTime
cursor2
.
close
()
cursor2
.
close
()
print
(
"query time for: %s %f seconds"
%
(
sql
,
totalTime
/
100
))
cursor3
=
self
.
conn
.
cursor
()
cursor3
.
execute
(
"insert into %s.%s values(now, %f, '%s'
)"
%
(
self
.
dbName
,
table_name
,
totalTime
/
100
,
self
.
commitID
))
cursor3
=
self
.
conn
2
.
cursor
()
cursor3
.
execute
(
"insert into %s.%s values(now, %f, '%s'
, '%s', '%s')"
%
(
self
.
dbName
,
table_name
,
totalTime
/
100
,
self
.
commitID
,
self
.
branch
,
self
.
type
))
cursor3
.
close
()
cursor
.
close
()
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-r'
,
'--remove-cache'
,
...
...
@@ -148,8 +156,22 @@ if __name__ == '__main__':
default
=
'q'
,
type
=
str
,
help
=
'table name perfix (default: q)'
)
parser
.
add_argument
(
'-b'
,
'--git-branch'
,
action
=
'store'
,
default
=
'master'
,
type
=
str
,
help
=
'git branch (default: master)'
)
parser
.
add_argument
(
'-T'
,
'--build-type'
,
action
=
'store'
,
default
=
'glibc'
,
type
=
str
,
help
=
'build type (default: glibc)'
)
args
=
parser
.
parse_args
()
perftest
=
taosdemoQueryPerformace
(
args
.
remove_cache
,
args
.
commit_id
,
args
.
database_name
,
args
.
stable_name
,
args
.
table_perfix
)
perftest
=
taosdemoQueryPerformace
(
args
.
remove_cache
,
args
.
commit_id
,
args
.
database_name
,
args
.
stable_name
,
args
.
table_perfix
,
args
.
git_branch
,
args
.
build_type
)
perftest
.
createPerfTables
()
perftest
.
query
()
tests/pytest/tools/taosdemoPerformance.py
浏览文件 @
d5adb474
...
...
@@ -20,9 +20,11 @@ from util.log import tdLog
from
util.sql
import
tdSql
class
taosdemoPerformace
:
def
__init__
(
self
,
commitID
,
dbName
):
def
__init__
(
self
,
commitID
,
dbName
,
branch
,
type
):
self
.
commitID
=
commitID
self
.
dbName
=
dbName
self
.
branch
=
branch
self
.
type
=
type
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
self
.
password
=
"taosdata"
...
...
@@ -33,6 +35,12 @@ class taosdemoPerformace:
self
.
password
,
self
.
config
)
self
.
insertDB
=
"insertDB"
self
.
host2
=
"192.168.1.179"
self
.
conn2
=
taos
.
connect
(
host
=
self
.
host2
,
user
=
self
.
user
,
password
=
self
.
password
,
config
=
self
.
config
)
def
generateJson
(
self
):
db
=
{
...
...
@@ -122,12 +130,9 @@ class taosdemoPerformace:
return
buildPath
def
insertData
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosdemo not found!"
)
else
:
tdLog
.
info
(
"taosdemo found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
...
...
@@ -153,11 +158,11 @@ class taosdemoPerformace:
os
.
system
(
"[ -f taosdemoperf.txt ] && rm taosdemoperf.txt"
)
def
createTablesAndStoreData
(
self
):
cursor
=
self
.
conn
.
cursor
()
cursor
=
self
.
conn
2
.
cursor
()
cursor
.
execute
(
"create database if not exists %s"
%
self
.
dbName
)
cursor
.
execute
(
"use %s"
%
self
.
dbName
)
cursor
.
execute
(
"create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float)"
)
cursor
.
execute
(
"create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float
, branch binary(50), type binary(20)
)"
)
print
(
"==================== taosdemo performance ===================="
)
print
(
"create tables time: %f"
%
float
(
self
.
createTableTime
))
print
(
"insert records time: %f"
%
float
(
self
.
insertRecordsTime
))
...
...
@@ -165,19 +170,14 @@ class taosdemoPerformace:
print
(
"avg delay: %f"
%
float
(
self
.
avgDelay
))
print
(
"max delay: %f"
%
float
(
self
.
maxDelay
))
print
(
"min delay: %f"
%
float
(
self
.
minDelay
))
cursor
.
execute
(
"insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f)"
%
(
float
(
self
.
createTableTime
),
float
(
self
.
insertRecordsTime
),
float
(
self
.
recordsPerSecond
),
self
.
commitID
,
float
(
self
.
avgDelay
),
float
(
self
.
maxDelay
),
float
(
self
.
minDelay
)))
cursor
.
execute
(
"drop database if exists %s"
%
self
.
insertDB
)
cursor
.
execute
(
"insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f, '%s', '%s')"
%
(
float
(
self
.
createTableTime
),
float
(
self
.
insertRecordsTime
),
float
(
self
.
recordsPerSecond
),
self
.
commitID
,
float
(
self
.
avgDelay
),
float
(
self
.
maxDelay
),
float
(
self
.
minDelay
),
self
.
branch
,
self
.
type
))
cursor
.
close
()
cursor1
=
self
.
conn
.
cursor
()
cursor1
.
execute
(
"drop database if exists %s"
%
self
.
insertDB
)
cursor1
.
close
()
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
()
...
...
@@ -194,9 +194,22 @@ if __name__ == '__main__':
default
=
'perf'
,
type
=
str
,
help
=
'Database name to be created (default: perf)'
)
parser
.
add_argument
(
'-b'
,
'--git-branch'
,
action
=
'store'
,
default
=
'master'
,
type
=
str
,
help
=
'git branch (default: master)'
)
parser
.
add_argument
(
'-T'
,
'--build-type'
,
action
=
'store'
,
default
=
'glibc'
,
type
=
str
,
help
=
'build type (default: glibc)'
)
args
=
parser
.
parse_args
()
perftest
=
taosdemoPerformace
(
args
.
commit_id
,
args
.
database_name
)
perftest
=
taosdemoPerformace
(
args
.
commit_id
,
args
.
database_name
,
args
.
git_branch
,
args
.
build_type
)
perftest
.
insertData
()
perftest
.
createTablesAndStoreData
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录