Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
71f20124
M
milvus
项目概览
milvus
/
milvus
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
71f20124
编写于
5月 31, 2023
作者:
W
wei liu
提交者:
GitHub
5月 31, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable collection rate limit when only global limit set (#24452)
Signed-off-by:
N
Wei Liu
<
wei.liu@zilliz.com
>
上级
19164ea7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
65 addition
and
7 deletion
+65
-7
pkg/util/paramtable/quota_param.go
pkg/util/paramtable/quota_param.go
+7
-7
pkg/util/paramtable/quota_param_test.go
pkg/util/paramtable/quota_param_test.go
+58
-0
未找到文件。
pkg/util/paramtable/quota_param.go
浏览文件 @
71f20124
...
...
@@ -344,7 +344,7 @@ The maximum rate will not be greater than ` + "max" + `.`,
}
// [0, inf)
if
rate
<
0
{
return
max
return
p
.
DMLMaxInsertRate
.
GetValue
()
}
return
fmt
.
Sprintf
(
"%f"
,
rate
)
},
...
...
@@ -432,7 +432,7 @@ The maximum rate will not be greater than ` + "max" + `.`,
}
// [0, inf)
if
rate
<
0
{
return
max
return
p
.
DMLMaxDeleteRate
.
GetValue
()
}
return
fmt
.
Sprintf
(
"%f"
,
rate
)
},
...
...
@@ -520,7 +520,7 @@ The maximum rate will not be greater than ` + "max" + `.`,
}
// [0, inf)
if
rate
<
0
{
return
max
return
p
.
DMLMaxBulkLoadRate
.
GetValue
()
}
return
fmt
.
Sprintf
(
"%f"
,
rate
)
},
...
...
@@ -612,7 +612,7 @@ The maximum rate will not be greater than ` + "max" + `.`,
}
// [0, inf)
if
getAsFloat
(
v
)
<
0
{
return
max
return
p
.
DQLMaxSearchRate
.
GetValue
()
}
return
v
},
...
...
@@ -692,7 +692,7 @@ The maximum rate will not be greater than ` + "max" + `.`,
}
// [0, inf)
if
getAsFloat
(
v
)
<
0
{
return
max
return
p
.
DQLMaxQueryRate
.
GetValue
()
}
return
v
},
...
...
@@ -950,7 +950,7 @@ When memory usage < memoryLowWaterLevel, no action.`,
level
:=
getAsFloat
(
v
)
// (0, +inf)
if
level
<=
0
{
level
=
getAsFloat
(
quota
)
return
max
}
// megabytes to bytes
return
fmt
.
Sprintf
(
"%f"
,
megaBytes2Bytes
(
level
))
...
...
@@ -971,7 +971,7 @@ When memory usage < memoryLowWaterLevel, no action.`,
level
:=
getAsFloat
(
v
)
// (0, +inf)
if
level
<=
0
{
level
=
getAsFloat
(
quota
)
return
p
.
DiskQuota
.
GetValue
(
)
}
// megabytes to bytes
return
fmt
.
Sprintf
(
"%f"
,
megaBytes2Bytes
(
level
))
...
...
pkg/util/paramtable/quota_param_test.go
浏览文件 @
71f20124
...
...
@@ -81,6 +81,34 @@ func TestQuotaParam(t *testing.T) {
assert
.
Equal
(
t
,
float64
(
1
)
*
1024
*
1024
,
params
.
QuotaConfig
.
DMLMinDeleteRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
10
)
*
1024
*
1024
,
params
.
QuotaConfig
.
DMLMaxBulkLoadRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
1
)
*
1024
*
1024
,
params
.
QuotaConfig
.
DMLMinBulkLoadRatePerCollection
.
GetAsFloat
())
// test only set global rate limit
params
.
Save
(
params
.
QuotaConfig
.
DMLMaxInsertRatePerCollection
.
Key
,
"-1"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMinInsertRatePerCollection
.
Key
,
"-1"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMaxDeleteRatePerCollection
.
Key
,
"-1"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMinDeleteRatePerCollection
.
Key
,
"-1"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMaxBulkLoadRatePerCollection
.
Key
,
"-1"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMinBulkLoadRatePerCollection
.
Key
,
"-1"
)
assert
.
Equal
(
t
,
params
.
QuotaConfig
.
DMLMaxInsertRate
.
GetAsFloat
(),
params
.
QuotaConfig
.
DMLMaxInsertRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DMLMinInsertRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
params
.
QuotaConfig
.
DMLMaxDeleteRate
.
GetAsFloat
(),
params
.
QuotaConfig
.
DMLMaxDeleteRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DMLMinDeleteRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
params
.
QuotaConfig
.
DMLMaxBulkLoadRate
.
GetAsFloat
(),
params
.
QuotaConfig
.
DMLMaxBulkLoadRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DMLMinBulkLoadRatePerCollection
.
GetAsFloat
())
// test invalid config value
params
.
Save
(
params
.
QuotaConfig
.
DMLMaxInsertRatePerCollection
.
Key
,
"1"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMinInsertRatePerCollection
.
Key
,
"5"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMaxDeleteRatePerCollection
.
Key
,
"1"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMinDeleteRatePerCollection
.
Key
,
"5"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMaxBulkLoadRatePerCollection
.
Key
,
"1"
)
params
.
Save
(
params
.
QuotaConfig
.
DMLMinBulkLoadRatePerCollection
.
Key
,
"5"
)
assert
.
Equal
(
t
,
float64
(
1
*
1024
*
1024
),
params
.
QuotaConfig
.
DMLMaxInsertRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DMLMinInsertRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
1
*
1024
*
1024
),
params
.
QuotaConfig
.
DMLMaxDeleteRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DMLMinDeleteRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
1
*
1024
*
1024
),
params
.
QuotaConfig
.
DMLMaxBulkLoadRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DMLMinBulkLoadRatePerCollection
.
GetAsFloat
())
})
t
.
Run
(
"test dql"
,
func
(
t
*
testing
.
T
)
{
...
...
@@ -107,6 +135,26 @@ func TestQuotaParam(t *testing.T) {
assert
.
Equal
(
t
,
float64
(
1
),
params
.
QuotaConfig
.
DQLMinSearchRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
10
),
params
.
QuotaConfig
.
DQLMaxQueryRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
1
),
params
.
QuotaConfig
.
DQLMinQueryRatePerCollection
.
GetAsFloat
())
// test only config global value
params
.
Save
(
params
.
QuotaConfig
.
DQLMaxSearchRatePerCollection
.
Key
,
"-1"
)
params
.
Save
(
params
.
QuotaConfig
.
DQLMinSearchRatePerCollection
.
Key
,
"-1"
)
params
.
Save
(
params
.
QuotaConfig
.
DQLMaxQueryRatePerCollection
.
Key
,
"-1"
)
params
.
Save
(
params
.
QuotaConfig
.
DQLMinQueryRatePerCollection
.
Key
,
"-1"
)
assert
.
Equal
(
t
,
params
.
QuotaConfig
.
DQLMaxSearchRate
.
GetAsFloat
(),
params
.
QuotaConfig
.
DQLMaxSearchRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DQLMinSearchRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
params
.
QuotaConfig
.
DQLMaxQueryRate
.
GetAsFloat
(),
params
.
QuotaConfig
.
DQLMaxQueryRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DQLMinQueryRatePerCollection
.
GetAsFloat
())
// test invalid config
params
.
Save
(
params
.
QuotaConfig
.
DQLMaxSearchRatePerCollection
.
Key
,
"1"
)
params
.
Save
(
params
.
QuotaConfig
.
DQLMinSearchRatePerCollection
.
Key
,
"5"
)
params
.
Save
(
params
.
QuotaConfig
.
DQLMaxQueryRatePerCollection
.
Key
,
"1"
)
params
.
Save
(
params
.
QuotaConfig
.
DQLMinQueryRatePerCollection
.
Key
,
"5"
)
assert
.
Equal
(
t
,
float64
(
1
),
params
.
QuotaConfig
.
DQLMaxSearchRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DQLMinSearchRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
1
),
params
.
QuotaConfig
.
DQLMaxQueryRatePerCollection
.
GetAsFloat
())
assert
.
Equal
(
t
,
float64
(
0
),
params
.
QuotaConfig
.
DQLMinQueryRatePerCollection
.
GetAsFloat
())
})
t
.
Run
(
"test limits"
,
func
(
t
*
testing
.
T
)
{
...
...
@@ -139,4 +187,14 @@ func TestQuotaParam(t *testing.T) {
assert
.
Equal
(
t
,
defaultMax
,
qc
.
MaxReadResultRate
.
GetAsFloat
())
assert
.
Equal
(
t
,
0.9
,
qc
.
CoolOffSpeed
.
GetAsFloat
())
})
t
.
Run
(
"test disk quota"
,
func
(
t
*
testing
.
T
)
{
assert
.
Equal
(
t
,
defaultMax
,
qc
.
DiskQuota
.
GetAsFloat
())
assert
.
Equal
(
t
,
defaultMax
,
qc
.
DiskQuotaPerCollection
.
GetAsFloat
())
// test invalid config
params
.
Save
(
params
.
QuotaConfig
.
DiskQuotaPerCollection
.
Key
,
"-1"
)
assert
.
Equal
(
t
,
qc
.
DiskQuota
.
GetAsFloat
(),
qc
.
DiskQuotaPerCollection
.
GetAsFloat
())
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录