Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
105b64de
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
260
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
105b64de
编写于
9月 27, 2020
作者:
B
bigsheeper
提交者:
yefu.chen
9月 27, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add write node benchmark
Signed-off-by:
N
bigsheeper
<
yihao.dai@zilliz.com
>
上级
a84bafd1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
14 deletion
+23
-14
writer/main.go
writer/main.go
+17
-13
writer/write_node/writer_node.go
writer/write_node/writer_node.go
+6
-1
未找到文件。
writer/main.go
浏览文件 @
105b64de
...
...
@@ -45,11 +45,12 @@ func main() {
}
const
Debug
=
true
const
CountMsgNum
=
1000
*
1000
const
MB
=
1024
*
1024
const
timeInterval
=
time
.
Second
*
5
const
CountMsgNum
=
10000
*
10
if
Debug
{
var
printFlag
=
true
var
startTime
=
true
var
shouldBenchmark
=
false
var
start
time
.
Time
for
{
...
...
@@ -57,22 +58,25 @@ func main() {
break
}
msgLength
:=
wn
.
MessageClient
.
PrepareBatchMsg
()
// wait until first 100,000 rows are successfully wrote
if
wn
.
MsgCounter
.
InsertCounter
>=
CountMsgNum
{
shouldBenchmark
=
true
start
=
time
.
Now
()
}
if
msgLength
>
0
{
if
startTime
{
fmt
.
Println
(
"============> Start Test <============"
)
startTime
=
false
start
=
time
.
Now
()
}
wn
.
DoWriteNode
(
ctx
,
&
wg
)
fmt
.
Println
(
"write node do a batch message, storage len: "
,
msgLength
)
}
// Test insert time
if
printFlag
&&
wn
.
MsgCounter
.
InsertCounter
>=
CountMsgNum
{
printFlag
=
false
// ignore if less than 1000 records per time interval
if
shouldBenchmark
&&
wn
.
MsgCounter
.
InsertCounter
>
1000
{
timeSince
:=
time
.
Since
(
start
)
fmt
.
Println
(
"============> Do"
,
wn
.
MsgCounter
.
InsertCounter
,
"Insert in"
,
timeSince
,
"<============"
)
if
timeSince
>=
timeInterval
{
speed
:=
wn
.
MsgCounter
.
InsertedRecordSize
/
timeInterval
.
Seconds
()
/
MB
fmt
.
Println
(
"============> Insert"
,
wn
.
MsgCounter
.
InsertCounter
,
"records, cost:"
,
timeSince
,
"speed:"
,
speed
,
"M/s"
,
"<============"
)
wn
.
MsgCounter
.
InsertCounter
=
0
start
=
time
.
Now
()
}
}
}
}
...
...
writer/write_node/writer_node.go
浏览文件 @
105b64de
...
...
@@ -19,6 +19,7 @@ type SegmentIdInfo struct {
type
MsgCounter
struct
{
InsertCounter
int64
InsertedRecordSize
float64
DeleteCounter
int64
}
...
...
@@ -43,6 +44,7 @@ func NewWriteNode(ctx context.Context,
msgCounter
:=
MsgCounter
{
InsertCounter
:
0
,
DeleteCounter
:
0
,
InsertedRecordSize
:
0
,
}
return
&
WriteNode
{
...
...
@@ -71,7 +73,10 @@ func (wn *WriteNode) InsertBatchData(ctx context.Context, data []*msgpb.InsertOr
}
wn
.
MsgCounter
.
InsertCounter
+=
int64
(
len
(
timeStamp
))
if
len
(
timeStamp
)
>
0
{
// assume each record is same size
wn
.
MsgCounter
.
InsertedRecordSize
+=
float64
(
len
(
timeStamp
)
*
len
(
data
[
0
]
.
RowsData
.
Blob
))
}
error
:=
(
*
wn
.
KvStore
)
.
PutRows
(
ctx
,
prefixKeys
,
binaryData
,
suffixKeys
,
timeStamp
)
if
error
!=
nil
{
fmt
.
Println
(
"Can't insert data!"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录