mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 10:59:32 +08:00
Fix DDL rate limit unit, and improve log (#19504)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com> Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
parent
9dcee37e1c
commit
5405dedd2e
@ -403,8 +403,8 @@ quotaAndLimits:
|
|||||||
dql:
|
dql:
|
||||||
enabled: false
|
enabled: false
|
||||||
searchRate:
|
searchRate:
|
||||||
max: # vps, default no limit
|
max: # vps (vectors per second), default no limit
|
||||||
min: # vps, default 0
|
min: # vps (vectors per second), default 0
|
||||||
queryRate:
|
queryRate:
|
||||||
max: # qps, default no limit
|
max: # qps, default no limit
|
||||||
min: # qps, default 0
|
min: # qps, default 0
|
||||||
|
@ -124,7 +124,7 @@ func (rl *rateLimiter) registerLimiters() {
|
|||||||
}
|
}
|
||||||
log.Info("RateLimiter register for rateType",
|
log.Info("RateLimiter register for rateType",
|
||||||
zap.String("rateType", internalpb.RateType_name[rt]),
|
zap.String("rateType", internalpb.RateType_name[rt]),
|
||||||
zap.Float64("rate", r))
|
zap.String("rate", ratelimitutil.Limit(r).String()))
|
||||||
limit := ratelimitutil.Limit(r)
|
limit := ratelimitutil.Limit(r)
|
||||||
if limit < 0 {
|
if limit < 0 {
|
||||||
limit = ratelimitutil.Inf
|
limit = ratelimitutil.Inf
|
||||||
|
@ -35,6 +35,9 @@ const (
|
|||||||
defaultLowWaterLevel = float64(0.8)
|
defaultLowWaterLevel = float64(0.8)
|
||||||
// defaultHighWaterLevel is the default memory low water level.
|
// defaultHighWaterLevel is the default memory low water level.
|
||||||
defaultHighWaterLevel = float64(0.9)
|
defaultHighWaterLevel = float64(0.9)
|
||||||
|
|
||||||
|
// secondsPerMinute is used to convert minutes to seconds.
|
||||||
|
secondsPerMinute = 60.0
|
||||||
)
|
)
|
||||||
|
|
||||||
// quotaConfig is configuration for quota and limitations.
|
// quotaConfig is configuration for quota and limitations.
|
||||||
@ -164,6 +167,7 @@ func (p *quotaConfig) initDDLCollectionRate() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.DDLCollectionRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.collectionRate", defaultMax)
|
p.DDLCollectionRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.collectionRate", defaultMax)
|
||||||
|
p.DDLCollectionRate /= secondsPerMinute
|
||||||
// [0 ~ Inf)
|
// [0 ~ Inf)
|
||||||
if p.DDLCollectionRate < 0 {
|
if p.DDLCollectionRate < 0 {
|
||||||
p.DDLCollectionRate = defaultMax
|
p.DDLCollectionRate = defaultMax
|
||||||
@ -176,6 +180,7 @@ func (p *quotaConfig) initDDLPartitionRate() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.DDLPartitionRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.partitionRate", defaultMax)
|
p.DDLPartitionRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.partitionRate", defaultMax)
|
||||||
|
p.DDLPartitionRate /= secondsPerMinute
|
||||||
// [0 ~ Inf)
|
// [0 ~ Inf)
|
||||||
if p.DDLPartitionRate < 0 {
|
if p.DDLPartitionRate < 0 {
|
||||||
p.DDLPartitionRate = defaultMax
|
p.DDLPartitionRate = defaultMax
|
||||||
@ -188,6 +193,7 @@ func (p *quotaConfig) initDDLIndexRate() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.DDLIndexRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.indexRate", defaultMax)
|
p.DDLIndexRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.indexRate", defaultMax)
|
||||||
|
p.DDLIndexRate /= secondsPerMinute
|
||||||
// [0 ~ Inf)
|
// [0 ~ Inf)
|
||||||
if p.DDLIndexRate < 0 {
|
if p.DDLIndexRate < 0 {
|
||||||
p.DDLIndexRate = defaultMax
|
p.DDLIndexRate = defaultMax
|
||||||
@ -200,6 +206,7 @@ func (p *quotaConfig) initDDLFlushRate() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.DDLFlushRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.flushRate", defaultMax)
|
p.DDLFlushRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.flushRate", defaultMax)
|
||||||
|
p.DDLFlushRate /= secondsPerMinute
|
||||||
// [0 ~ Inf)
|
// [0 ~ Inf)
|
||||||
if p.DDLFlushRate < 0 {
|
if p.DDLFlushRate < 0 {
|
||||||
p.DDLFlushRate = defaultMax
|
p.DDLFlushRate = defaultMax
|
||||||
@ -212,6 +219,7 @@ func (p *quotaConfig) initDDLCompactionRate() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.DDLCompactionRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.compactionRate", defaultMax)
|
p.DDLCompactionRate = p.Base.ParseFloatWithDefault("quotaAndLimits.ddl.compactionRate", defaultMax)
|
||||||
|
p.DDLCompactionRate /= secondsPerMinute
|
||||||
// [0 ~ Inf)
|
// [0 ~ Inf)
|
||||||
if p.DDLCompactionRate < 0 {
|
if p.DDLCompactionRate < 0 {
|
||||||
p.DDLCompactionRate = defaultMax
|
p.DDLCompactionRate = defaultMax
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package ratelimitutil
|
package ratelimitutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -132,6 +133,14 @@ func (lim *Limiter) advance(now time.Time) (newNow time.Time, newLast time.Time,
|
|||||||
return now, last, tokens
|
return now, last, tokens
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns string of Limit.
|
||||||
|
func (limit Limit) String() string {
|
||||||
|
if limit == Inf {
|
||||||
|
return "+inf"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%.4f", limit)
|
||||||
|
}
|
||||||
|
|
||||||
// tokensFromDuration is a unit conversion function from a time duration to the number of tokens
|
// tokensFromDuration is a unit conversion function from a time duration to the number of tokens
|
||||||
// which could be accumulated during that duration at a rate of limit tokens per second.
|
// which could be accumulated during that duration at a rate of limit tokens per second.
|
||||||
func (limit Limit) tokensFromDuration(d time.Duration) float64 {
|
func (limit Limit) tokensFromDuration(d time.Duration) float64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user