The Real Fullstack

The Unavailable Service

Recommendations are a small widget at the bottom of the page. Why did the entire homepage go down with them?

Engineer9 Min.FlusssimulatorPerformance-Labor
resilience4jspring-bootkuberneteshttp

Diese Aufgabe ist noch nicht auf Deutsch übersetzt. Du liest die englische Version.

Mission:With recommendations down, keep the homepage fast and error-free, and stop hammering the failing service so it can recover.Kontext · Lernziele ▾

Fernway's homepage service calls the recommendations service on every request. Tonight recommendations is overloaded: each call takes 600 ms or more, and requests pile up until it barely answers at all. The homepage waits, its 120 threads fill up, and the site is down — over a non-critical feature.

Mission: With recommendations down, keep the homepage fast and error-free, and stop hammering the failing service so it can recover.

Lernziele

  • Identify critical vs non-critical dependencies.
  • Combine timeouts, circuit breakers and fallbacks.
  • Give a failing dependency room to recover.
Simulation
Simuliert
VisitorsHomepageRecommendations
Simulation starten
@CircuitBreaker(name = "recommendations", fallbackMethod = "popularProducts")@TimeLimiter(name = "recommendations")              // timeout-duration: 200mspublic CompletableFuture<List<Product>> recommendations(long userId) {  return CompletableFuture.supplyAsync(() -> recoClient.forUser(userId));}CompletableFuture<List<Product>> popularProducts(long userId, Throwable t) {  return CompletableFuture.completedFuture(popularCache.top(12));   // non-personalised, but the page renders}// resilience4j.circuitbreaker.instances.recommendations: failure-rate-threshold 50, wait-duration-in-open-state 30s

Vereinfachung

Steady-state queueing; an open breaker sends 5% of calls as probes. Lernmodell – die Zahlen veranschaulichen Verhalten und sind keine Benchmarks.

Konzepte

Verwandte Aufgaben

Referenzen