Jitter Worth The Name
A node holding 40,000 WebSocket clients is restarted. Every client runs this reconnect loop, and the surviving nodes still fall over.
let attempt = 0;
function connect() {
const ws = new WebSocket(URL);
ws.onopen = () => { attempt = 0; };
ws.onclose = () => {
const delay = Math.min(30000, 250 * 2 ** attempt);
attempt += 1;
setTimeout(connect, delay + Math.random() * 100);
};
}
Which change actually spreads the redial load?
Sign in to answer questions and track your progress
Sign In