Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add jitter to timer / transfer / replication queue sanity scan #864

Merged
merged 7 commits into from
Jun 20, 2018

Conversation

wxing1292
Copy link
Contributor

@wxing1292 wxing1292 commented Jun 19, 2018

solve #856

@wxing1292 wxing1292 requested review from vancexu and samarabbas June 19, 2018 21:43
@@ -140,7 +140,10 @@ func (s *queueAckMgrSuite) SetupTest() {
}
s.mockShard.config.ShardUpdateMinInterval = dynamicconfig.GetDurationPropertyFn(0 * time.Second)

s.queueAckMgr = newQueueAckMgr(s.mockShard, &QueueProcessorOptions{UpdateShardTaskCount: 1, MetricScope: metrics.ReplicatorQueueProcessorScope}, s.mockProcessor, 0, s.logger)
s.queueAckMgr = newQueueAckMgr(s.mockShard, &QueueProcessorOptions{
UpdateShardTaskCount: func(opts ...dynamicconfig.FilterOption) int { return 1 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use dynamicconfig.GetIntPropertyFn() which is mock for tests.

@@ -346,7 +349,10 @@ func (s *queueFailoverAckMgrSuite) SetupTest() {
}
s.mockShard.config.ShardUpdateMinInterval = dynamicconfig.GetDurationPropertyFn(0 * time.Second)

s.queueFailoverAckMgr = newQueueFailoverAckMgr(s.mockShard, &QueueProcessorOptions{UpdateShardTaskCount: 1, MetricScope: metrics.ReplicatorQueueProcessorScope}, s.mockProcessor, 0, s.logger)
s.queueFailoverAckMgr = newQueueFailoverAckMgr(s.mockShard, &QueueProcessorOptions{
UpdateShardTaskCount: func(opts ...dynamicconfig.FilterOption) int { return 1 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use dynamicconfig.GetIntPropertyFn()

@@ -177,6 +177,8 @@ const (
TimerProcessorCompleteTimerInterval
// TimerProcessorMaxPollInterval is max poll interval for timer processor
TimerProcessorMaxPollInterval
// TimerProcessorMaxPollIntervalJitterCoefficient is the max poll interval jitter coefficient
TimerProcessorMaxPollIntervalJitterCoefficient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There new added keys also need to updated in keys map in this file.

Copy link
Contributor

@vancexu vancexu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamic config part LGTM

@@ -292,7 +296,10 @@ continueProcessor:
// Timer Fired.
case <-pollTimer.C:
// forced timer scan
pollTimer.Reset(t.config.TimerProcessorMaxPollInterval())
pollTimer.Reset(jitter.JitDuration(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep track of the last updated time and skip force timer scan if it is less then max poll interval?

@@ -156,10 +160,10 @@ processorPumpLoop:
p.processBatch(tasksCh)
case <-pollTimer.C:
p.processBatch(tasksCh)
pollTimer.Reset(p.options.MaxPollInterval)
pollTimer.Reset(jitter.JitDuration(p.options.MaxPollInterval(), p.options.MaxPollIntervalJitterCoefficient()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want same logic to skip the forced scan if already performed recently.

Copy link
Contributor

@samarabbas samarabbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall all good. You can check it in after adding the logic to skip force scan if recently updated.

@wxing1292 wxing1292 merged commit 50b5d43 into master Jun 20, 2018
@wxing1292 wxing1292 deleted the jitter branch June 20, 2018 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants