The Real Fullstack

The Midnight Thundering Herd

Traffic jumps 150× at 00:00:00 every night. Is it an attack?

エンジニア8 分パフォーマンスラボデバッグラボ
react-nativecronkuberneteshttp

この課題はまだ日本語に翻訳されていません。英語版を表示しています。

ミッション:Identify where the spike comes from and remove it at the source, so the system never has to absorb it.背景 · 学習目標 ▾

Fernpost's mobile app schedules its daily sync at midnight device time. Every night the API sees a wall of requests, returns 503, and clients retry exactly one second later. The autoscaler reacts four minutes after the spike is over.

ミッション: Identify where the spike comes from and remove it at the source, so the system never has to absorb it.

学習目標

  • Recognise synchronised clients as a self-inflicted load spike.
  • Spread scheduled work with jitter.
  • Combine exponential backoff with jitter and server-side 429 + Retry-After.
シミュレーションシミュレーション値
1.2 M app installsload balancersync APIdatabase
シミュレーションを実行
// spread the daily sync over 3 hours, stable per deviceconst offsetMinutes = hash(installationId) % 180;scheduleDailySync({ hour: 0, minute: 0, delayMinutes: offsetMinutes });// on 429/503: exponential backoff with full jitter, honour Retry-Afterfunction retryDelayMs(attempt: number, retryAfterS?: number): number {  if (retryAfterS) return retryAfterS * 1000;  return Math.random() * Math.min(CAP_MS, BASE_MS * 2 ** attempt);}

簡略化

Three symptoms with deterministic fixes. Real traffic also varies by time zone. 教育用モデルです。数値は挙動を示すためのもので、ベンチマークではありません。

コンセプト

関連する課題

参考資料