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

Uploader has insufficient jitter for large deployments. #619

Open
ghstwhl opened this issue Feb 24, 2025 · 0 comments
Open

Uploader has insufficient jitter for large deployments. #619

ghstwhl opened this issue Feb 24, 2025 · 0 comments

Comments

@ghstwhl
Copy link

ghstwhl commented Feb 24, 2025

While jitter was added to the uploader in 2.3.136.0, the jitter window is only 30 seconds. We are seeing spikes of errors every 30 minutes as our deployment exhausts the PutInventory API quota. If increasing the jitter would increase a window of inaccessibility for the agent, perhaps a random time offset could be applied to the initial scheduling, so that the inventory upload events are not scheduled for x:00 and X:30.

// Get one random jitter time before calling PutInventory API to prevent huge number of request come to
// the backend service in the same time.
// Use current Time stamp + Hashcode of instance ID as random key
// The jitter window is in 0-30 seconds.
func getRandomBackOffTime(context context.T, instanceID string) (sleepTime int) {
log := context.Log()
hash := fnv.New32a()
hash.Write([]byte(instanceID))
rand.Seed(time.Now().Unix() + int64(hash.Sum32()))
sleepTime = rand.Intn(Max_Time_TO_Back_Off)
log.Debugf("Random back off: %v seconds before call put inventory", sleepTime)
return sleepTime
}

Image

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

No branches or pull requests

1 participant