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

memberlist gossip #1389

Merged
merged 6 commits into from
Jun 8, 2018
Merged

memberlist gossip #1389

merged 6 commits into from
Jun 8, 2018

Conversation

stuartnelson3
Copy link
Contributor

meant to address #1387

one current issue is that it seems peer0 has a few notifications queued, but hasn't cleared them in over an hour. Some way of clearing old messages is probably needed.

The method for choosing RetransmitMulti is also something to be discussed. It's an important value, but I'm wary of exposing too many configuration options in alertmanager to alter memberlist. I think we need to come up with a "smart" value that also doesn't overwhelm the transmit queues .

Copy link
Member

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

Do we want to re-gossip new/updated silences too?

@@ -107,7 +107,7 @@ func Join(
readyc: make(chan struct{}),
logger: l,
}
p.delegate = newDelegate(l, reg, p)
p.delegate = newDelegate(l, reg, p, len(knownPeers)/2)
Copy link
Member

Choose a reason for hiding this comment

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

nit but I would do the computation here rather than add a new argument to newDelegate().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean setting RetransmitMulti on p.delegate?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for being inaccurate. I meant:

retransmit := len(knownPeers)/2
if restransmit < 3 {
    retransmit = 3
}
p.delegate = newDelegate(l, reg, p, retransmit)

@stuartnelson3
Copy link
Contributor Author

Do we want to re-gossip new/updated silences too?

Yeah, that would make sense

@stuartnelson3
Copy link
Contributor Author

Updated.

When running this branch at SC with only nflog entries being further gossiped, we were seeing messages queued up. Newer messages are sent preferentially by memberlist, but it's still an issue that we have an unbounded queue. Ideally, the queue would be able to empty itself, but that's not what I was seeing. I'll investigate this.

@mxinden
Copy link
Member

mxinden commented Jun 1, 2018

The method for choosing RetransmitMulti is also something to be discussed. It's an important value, but I'm wary of exposing too many configuration options in alertmanager to alter memberlist. I think we need to come up with a "smart" value that also doesn't overwhelm the transmit queues .

I agree with keeping the amount of configuration options small (fow now).

What is your reasoning for:

retransmit := len(knownPeers) / 2

Thanks a lot for working on this!

@stuartnelson3
Copy link
Contributor Author

Note: The probability calculation I was doing was based on changing GossipPeers, not RetransmitMult. Both are important values, and I tried to factor them both in for this.

  • RetransmitMult is how many times a message will be sent. Each send goes to one machine.
  • GossipPeers is how many machines to gossip to in a single gossip interval.

Each gossip interval will send messages to all machines picked by kRandomNodes, but it will not necessarily exhaust all retransmits of a message; the message may remain in the queue to be sent at the next gossip interval. But, if numNodes > retransmits, then a message will only be sent to the first N nodes, where N = retransmits. I imagine this is why I was seeing messages being queued -- I was instructing memberlist to send a message many times, but based on the number of peers it was sending messages to, it wouldn't hit that retransmit limit and remove the message from its internal queue. Newer gossip messages would arrive, and the older ones could never be sent.

Probability of a machine not being gossiped to during a gossip interval

Caveat: This might be wrong :)

Play along at:
https://gist.github.com/stuartnelson3/81ba1f750196e9fccaf2f7b23bdbf5ac

Tweaking the numbers available (probabilities are the chance of not receiving a message, and given as a percentage out of 100):

retransmits GossipPeers num AMs p(NoGossip) p(Gossip)
1 3 3 50.0030 25.0030
2 3 3 2.6065 0.0679
3 3 3 2.6065 0.0679
3 3 4 3.1591 0.0032
3 3 10 66.6667 2.6012
5 5 10 44.4444 0.0677

p(Gossip) is if each node is configured to gossip only newly received messages. Any message they've already seen will not be gossiped.

The testing was far from thorough given that I doubt anyone runs more than 10 instances, but it seemed like len(knownPeers) / 2 was a good place to start. If more peers join, however, maybe this value should be updated.

If a peer receives an nflog that it hasn't seen
before, queue the message and propagate it further
to other peers. This should ensure that all
peers within a cluster receive all gossip
messages.

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
For alertmanagers that are brought up with a list
of peers, set the number of message retransmits to
be half of that number. If there are no peers on
start, or there are few, continue to use the
default value of 3.

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
During a gossip, we send messages to at most
GossipNodes nodes. If possible, we only a message
to reach all nodes as soon as possible.

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
@stuartnelson3 stuartnelson3 force-pushed the stn/memberlist-gossip branch from 5f9378b to 4125ca8 Compare June 5, 2018 12:51
@stuartnelson3 stuartnelson3 mentioned this pull request Jun 5, 2018
4 tasks
@stuartnelson3 stuartnelson3 merged commit 36588c3 into master Jun 8, 2018
@stuartnelson3 stuartnelson3 deleted the stn/memberlist-gossip branch June 8, 2018 09:48
hh pushed a commit to ii/alertmanager that referenced this pull request Jul 10, 2019
These are useful as a direct indication of CPU contention and task
scheduler latency.

Handy references:
 - https://github.com/torvalds/linux/blob/master/Documentation/scheduler/sched-stats.txt
 - https://doc.opensuse.org/documentation/leap/tuning/html/book.sle.tuning/cha.tuning.taskscheduler.html

procfs is updated to pull in the enabling change:
prometheus/procfs#186

Signed-off-by: Phil Frost <phil@postmates.com>
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