Skip to content

Add jitter for database polls to reduce 'stampeding herd' problem#3655

Merged
samsondav merged 2 commits intodevelopfrom
stampeding_hurd
Nov 18, 2020
Merged

Add jitter for database polls to reduce 'stampeding herd' problem#3655
samsondav merged 2 commits intodevelopfrom
stampeding_hurd

Conversation

@samsondav
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

topliceanu
topliceanu previously approved these changes Nov 18, 2020
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How do you feel about the name AddJitter() or WithJitter()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I "think" the bounds are tighter here:

d := 10
//jitter := mrand.Intn(int(d) / 10)
jitter := [0, 1)
// jitter = jitter - (jitter / 2)
jitter = [0, 0.5)
// return time.Duration(int(d) + jitter)
d + jitter = [10, 10.5)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, you are right!

@samsondav samsondav merged commit 896862c into develop Nov 18, 2020
@samsondav samsondav deleted the stampeding_hurd branch November 18, 2020 15:43
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.

2 participants