This repository was archived by the owner on May 3, 2022. It is now read-only.
Add simulation of accumulated connections during service startup#1397
Open
Add simulation of accumulated connections during service startup#1397
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a large service starts all workers rapidly, the first workers to advertise will receive connections from all of their relays. This simulation answers the question: "How many workers have to advertise before each additional worker receives a reasonable number of connections."
Assuming that all workers start in order, more quickly than non-affine connections can be closed, the number of connections each subsequent worker receives drops linearly.
However, if workers start in random order, the number of connections each subsequent worker receives drops off multiplicatively.
As a consequence, we should avoid starting services in order or sort them by consistent hash instead of address. We should also consider introducing connections to newly discovered affine peers gradually (to avoid slamming p workers with k connections during startup). It may be desirable to reap non-affine connections frequently enough to collect some of them over the course of a rolling deployment. A rolling start/restart should take a few minutes, so non-affine connection reaping should probably happen once or twice per minute at least. We are thinking to avoid reaping peers too frequently to prevent flapping connections for slight adjustments to the Hyperbahn ring.