Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
f5b75234
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f5b75234
编写于
7月 16, 2019
作者:
A
alesapin
提交者:
GitHub
7月 16, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5899 from yandex/aku/perftest-mem
Report memory usage in performance tests.
上级
ff8ae637
8c379fb9
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
75 addition
and
9 deletion
+75
-9
dbms/programs/performance-test/ConfigPreprocessor.cpp
dbms/programs/performance-test/ConfigPreprocessor.cpp
+8
-3
dbms/programs/performance-test/PerformanceTest.cpp
dbms/programs/performance-test/PerformanceTest.cpp
+42
-0
dbms/programs/performance-test/PerformanceTestSuite.cpp
dbms/programs/performance-test/PerformanceTestSuite.cpp
+3
-4
dbms/programs/performance-test/ReportBuilder.cpp
dbms/programs/performance-test/ReportBuilder.cpp
+2
-0
dbms/programs/performance-test/TestStats.h
dbms/programs/performance-test/TestStats.h
+3
-0
dbms/programs/performance-test/executeQuery.cpp
dbms/programs/performance-test/executeQuery.cpp
+10
-1
dbms/src/DataStreams/RemoteBlockInputStream.cpp
dbms/src/DataStreams/RemoteBlockInputStream.cpp
+1
-1
dbms/src/DataStreams/RemoteBlockInputStream.h
dbms/src/DataStreams/RemoteBlockInputStream.h
+6
-0
未找到文件。
dbms/programs/performance-test/ConfigPreprocessor.cpp
浏览文件 @
f5b75234
...
...
@@ -14,10 +14,15 @@ std::vector<XMLConfigurationPtr> ConfigPreprocessor::processConfig(
{
std
::
vector
<
XMLConfigurationPtr
>
result
;
for
(
const
auto
&
path
:
paths
)
for
(
const
auto
&
path
_str
:
paths
)
{
result
.
emplace_back
(
XMLConfigurationPtr
(
new
XMLConfiguration
(
path
)));
result
.
back
()
->
setString
(
"path"
,
Poco
::
Path
(
path
).
absolute
().
toString
());
auto
test
=
XMLConfigurationPtr
(
new
XMLConfiguration
(
path_str
));
result
.
push_back
(
test
);
const
auto
path
=
Poco
::
Path
(
path_str
);
test
->
setString
(
"path"
,
path
.
absolute
().
toString
());
if
(
test
->
getString
(
"name"
,
""
)
==
""
)
test
->
setString
(
"name"
,
path
.
getBaseName
());
}
/// Leave tests:
...
...
dbms/programs/performance-test/PerformanceTest.cpp
浏览文件 @
f5b75234
...
...
@@ -3,6 +3,7 @@
#include <Core/Types.h>
#include <Common/CpuId.h>
#include <common/getMemoryAmount.h>
#include <DataStreams/RemoteBlockInputStream.h>
#include <IO/ConnectionTimeouts.h>
#include <IO/ReadBufferFromFile.h>
#include <IO/ReadHelpers.h>
...
...
@@ -296,6 +297,47 @@ void PerformanceTest::runQueries(
break
;
}
}
if
(
got_SIGINT
)
{
return
;
}
// Pull memory usage data from query log. The log is normally filled in
// background, so we have to flush it synchronously here to see all the
// previous queries.
{
RemoteBlockInputStream
flush_log
(
connection
,
"system flush logs"
,
{}
/* header */
,
context
);
flush_log
.
readPrefix
();
while
(
flush_log
.
read
());
flush_log
.
readSuffix
();
}
for
(
auto
&
statistics
:
statistics_by_run
)
{
RemoteBlockInputStream
log_reader
(
connection
,
"select memory_usage from system.query_log where type = 2 and query_id = '"
+
statistics
.
query_id
+
"'"
,
{}
/* header */
,
context
);
log_reader
.
readPrefix
();
Block
block
=
log_reader
.
read
();
if
(
block
.
columns
()
==
0
)
{
LOG_WARNING
(
log
,
"Query '"
<<
statistics
.
query_id
<<
"' is not found in query log."
);
continue
;
}
assert
(
block
.
columns
()
==
1
);
assert
(
block
.
getDataTypes
()[
0
]
->
getName
()
==
"UInt64"
);
ColumnPtr
column
=
block
.
getByPosition
(
0
).
column
;
assert
(
column
->
size
()
==
1
);
StringRef
ref
=
column
->
getDataAt
(
0
);
assert
(
ref
.
size
==
sizeof
(
UInt64
));
statistics
.
memory_usage
=
*
reinterpret_cast
<
const
UInt64
*>
(
ref
.
data
);
log_reader
.
readSuffix
();
}
}
...
...
dbms/programs/performance-test/PerformanceTestSuite.cpp
浏览文件 @
f5b75234
...
...
@@ -260,15 +260,12 @@ static std::vector<std::string> getInputFiles(const po::variables_map & options,
if
(
input_files
.
empty
())
throw
DB
::
Exception
(
"Did not find any xml files"
,
DB
::
ErrorCodes
::
BAD_ARGUMENTS
);
else
LOG_INFO
(
log
,
"Found "
<<
input_files
.
size
()
<<
" files"
);
}
else
{
input_files
=
options
[
"input-files"
].
as
<
std
::
vector
<
std
::
string
>>
();
LOG_INFO
(
log
,
"Found "
+
std
::
to_string
(
input_files
.
size
())
+
" input files"
);
std
::
vector
<
std
::
string
>
collected_files
;
std
::
vector
<
std
::
string
>
collected_files
;
for
(
const
std
::
string
&
filename
:
input_files
)
{
fs
::
path
file
(
filename
);
...
...
@@ -290,6 +287,8 @@ static std::vector<std::string> getInputFiles(const po::variables_map & options,
input_files
=
std
::
move
(
collected_files
);
}
LOG_INFO
(
log
,
"Found "
+
std
::
to_string
(
input_files
.
size
())
+
" input files"
);
std
::
sort
(
input_files
.
begin
(),
input_files
.
end
());
return
input_files
;
}
...
...
dbms/programs/performance-test/ReportBuilder.cpp
浏览文件 @
f5b75234
...
...
@@ -157,6 +157,8 @@ std::string ReportBuilder::buildFullReport(
runJSON
.
set
(
"avg_bytes_per_second"
,
statistics
.
avg_bytes_speed_value
);
}
runJSON
.
set
(
"memory_usage"
,
statistics
.
memory_usage
);
run_infos
.
push_back
(
runJSON
);
}
}
...
...
dbms/programs/performance-test/TestStats.h
浏览文件 @
f5b75234
...
...
@@ -19,6 +19,7 @@ struct TestStats
Stopwatch
avg_bytes_speed_watch
;
bool
last_query_was_cancelled
=
false
;
std
::
string
query_id
;
size_t
queries
=
0
;
...
...
@@ -49,6 +50,8 @@ struct TestStats
size_t
number_of_rows_speed_info_batches
=
0
;
size_t
number_of_bytes_speed_info_batches
=
0
;
UInt64
memory_usage
=
0
;
bool
ready
=
false
;
// check if a query wasn't interrupted by SIGINT
std
::
string
exception
;
...
...
dbms/programs/performance-test/executeQuery.cpp
浏览文件 @
f5b75234
...
...
@@ -2,9 +2,11 @@
#include <IO/Progress.h>
#include <DataStreams/RemoteBlockInputStream.h>
#include <Core/Block.h>
#include <Poco/UUIDGenerator.h>
namespace
DB
{
namespace
{
...
...
@@ -36,7 +38,7 @@ void checkFulfilledConditionsAndUpdate(
}
}
}
}
// anonymous namespace
void
executeQuery
(
Connection
&
connection
,
...
...
@@ -47,12 +49,18 @@ void executeQuery(
Context
&
context
,
const
Settings
&
settings
)
{
static
const
std
::
string
query_id_prefix
=
Poco
::
UUIDGenerator
::
defaultGenerator
().
create
().
toString
()
+
"-"
;
static
int
next_query_id
=
1
;
statistics
.
watch_per_query
.
restart
();
statistics
.
last_query_was_cancelled
=
false
;
statistics
.
last_query_rows_read
=
0
;
statistics
.
last_query_bytes_read
=
0
;
statistics
.
query_id
=
query_id_prefix
+
std
::
to_string
(
next_query_id
++
);
RemoteBlockInputStream
stream
(
connection
,
query
,
{},
context
,
&
settings
);
stream
.
setQueryId
(
statistics
.
query_id
);
stream
.
setProgressCallback
(
[
&
](
const
Progress
&
value
)
...
...
@@ -70,4 +78,5 @@ void executeQuery(
statistics
.
setTotalTime
();
}
}
dbms/src/DataStreams/RemoteBlockInputStream.cpp
浏览文件 @
f5b75234
...
...
@@ -292,7 +292,7 @@ void RemoteBlockInputStream::sendQuery()
established
=
true
;
auto
timeouts
=
ConnectionTimeouts
::
getTCPTimeoutsWithFailover
(
settings
);
multiplexed_connections
->
sendQuery
(
timeouts
,
query
,
""
,
stage
,
&
context
.
getClientInfo
(),
true
);
multiplexed_connections
->
sendQuery
(
timeouts
,
query
,
query_id
,
stage
,
&
context
.
getClientInfo
(),
true
);
established
=
false
;
sent_query
=
true
;
...
...
dbms/src/DataStreams/RemoteBlockInputStream.h
浏览文件 @
f5b75234
...
...
@@ -46,6 +46,11 @@ public:
~
RemoteBlockInputStream
()
override
;
/// Set the query_id. For now, used by performance test to later find the query
/// in the server query_log. Must be called before sending the query to the
/// server.
void
setQueryId
(
const
std
::
string
&
query_id_
)
{
assert
(
!
sent_query
);
query_id
=
query_id_
;
}
/// Specify how we allocate connections on a shard.
void
setPoolMode
(
PoolMode
pool_mode_
)
{
pool_mode
=
pool_mode_
;
}
...
...
@@ -95,6 +100,7 @@ private:
std
::
unique_ptr
<
MultiplexedConnections
>
multiplexed_connections
;
const
String
query
;
String
query_id
=
""
;
Context
context
;
/// Temporary tables needed to be sent to remote servers
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录