The Real Fullstack

The Missing Timeout

Only checkout calls the fraud vendor. Why is the product page returning 503 too?

エンジニア9 分デバッグラボフローシミュレーター
spring-bootresttemplatenoderesilience4j

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

ミッション:Read the thread dump, name the root cause, and make a slow dependency fail fast without taking unrelated features down with it.背景 · 学習目標 ▾

Hollow Basket's monolith calls an external fraud-scoring API during checkout. The vendor started answering in 60–120 seconds. Within three minutes every request thread was busy and the whole site was down, even pages that never talk to the vendor.

ミッション: Read the thread dump, name the root cause, and make a slow dependency fail fast without taking unrelated features down with it.

学習目標

  • Recognise unbounded waits on remote calls as resource leaks.
  • Set connect/read timeouts that fit the caller's budget.
  • Contain failures with circuit breakers and bulkheads.
シミュレーションシミュレーション値
shoppersshop monolithfraud vendor APIPostgreSQL
シミュレーションを実行
var factory = new SimpleClientHttpRequestFactory();factory.setConnectTimeout(Duration.ofMillis(500));factory.setReadTimeout(Duration.ofSeconds(2));       // checkout budget: 3 s end to endRestTemplate rest = new RestTemplate(factory);@CircuitBreaker(name = "fraud", fallbackMethod = "manualReview")   // stop calling a failing vendor@Bulkhead(name = "fraud")                                          // max 20 concurrent callsboolean check(Order o) { ... }boolean manualReview(Order o, Throwable t) { queue.holdForReview(o); return true; }

簡略化

Three symptoms with deterministic fixes. Real timeout values come from latency percentiles and end-to-end budgets. 教育用モデルです。数値は挙動を示すためのもので、ベンチマークではありません。

コンセプト

関連する課題

参考資料