Make timeTickInterval of Proxy configurable (#14515)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
This commit is contained in:
Jiquan Long 2021-12-30 10:29:47 +08:00 committed by GitHub
parent 9d0bc136e0
commit c0b7f52036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -111,7 +111,7 @@ func (ticker *channelsTimeTickerImpl) tick() error {
} else {
if stat.minTs > current {
ticker.minTsStatistics[pchan] = stat.minTs - 1
next := now + Timestamp(sendTimeTickMsgInterval)
next := now + Timestamp(Params.ProxyCfg.TimeTickInterval)
if next > stat.maxTs {
next = stat.maxTs
}

View File

@ -48,8 +48,8 @@ type UniqueID = typeutil.UniqueID
// Timestamp is alias of typeutil.Timestamp
type Timestamp = typeutil.Timestamp
const sendTimeTickMsgInterval = 200 * time.Millisecond
const channelMgrTickerInterval = 100 * time.Millisecond
// const sendTimeTickMsgInterval = 200 * time.Millisecond
// const channelMgrTickerInterval = 100 * time.Millisecond
// make sure Proxy implements types.Proxy
var _ types.Proxy = (*Proxy)(nil)
@ -238,8 +238,10 @@ func (node *Proxy) Init() error {
}
log.Debug("create task scheduler done", zap.String("role", typeutil.ProxyRole))
log.Debug("create channels time ticker", zap.String("role", typeutil.ProxyRole))
node.chTicker = newChannelsTimeTicker(node.ctx, channelMgrTickerInterval, []string{}, node.sched.getPChanStatistics, tsoAllocator)
syncTimeTickInterval := Params.ProxyCfg.TimeTickInterval / 2
log.Debug("create channels time ticker",
zap.String("role", typeutil.ProxyRole), zap.Duration("syncTimeTickInterval", syncTimeTickInterval))
node.chTicker = newChannelsTimeTicker(node.ctx, Params.ProxyCfg.TimeTickInterval/2, []string{}, node.sched.getPChanStatistics, tsoAllocator)
log.Debug("create channels time ticker done", zap.String("role", typeutil.ProxyRole))
log.Debug("create metrics cache manager", zap.String("role", typeutil.ProxyRole))
@ -262,12 +264,12 @@ func (node *Proxy) sendChannelsTimeTickLoop() {
go func() {
defer node.wg.Done()
// TODO(dragondriver): read this from config
timer := time.NewTicker(sendTimeTickMsgInterval)
timer := time.NewTicker(Params.ProxyCfg.TimeTickInterval)
for {
select {
case <-node.ctx.Done():
log.Info("send channels time tick loop exit")
return
case <-timer.C:
stats, ts, err := node.chTicker.getMinTsStatistics()