0Pricing
System Design Basics for Backend Developers · 강의

서킷 브레이커와 우아한 성능 저하

서킷 브레이커가 연쇄 장애를 방지하고, 의존성이 실패한 상황에서도 우아한 성능 저하로 시스템의 유용성을 유지하는 방법을 학습해 보세요.

서킷 브레이커와 우아한 성능 저하은(는) CoddyKit의 무료 System Design Basics for Backend Developers 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 System Design Basics for Backend Developers 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. System Design Basics for Backend Developers 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

The Cascading Failure Problem

In a system of dependent services, one slow service can drag down everything that calls it. Threads pile up waiting, queues fill, and the failure cascades across the whole system.

High availability means containing failures, not just preventing them.

What a Circuit Breaker Does

A circuit breaker wraps calls to a dependency. When failures cross a threshold, it opens and fails fast instead of waiting on a dead service.

  • Stops wasting threads on doomed calls
  • Gives the failing service time to recover

The Three States

A circuit breaker has three states:

  • Closed: calls flow normally, failures are counted
  • Open: calls fail immediately without hitting the dependency
  • Half-open: a few trial calls test whether the dependency recovered
CLOSED --(too many failures)--> OPEN
OPEN --(timeout elapsed)--> HALF_OPEN
HALF_OPEN --(trial succeeds)--> CLOSED
HALF_OPEN --(trial fails)--> OPEN

A Simple Breaker in Code

Here is the core idea: count failures, trip when a threshold is reached, and refuse calls while open.

class Breaker:
    def __init__(self, limit):
        self.fails = 0
        self.limit = limit
        self.open = False
    def call(self, ok):
        if self.open:
            return 'rejected'
        if ok:
            self.fails = 0
            return 'success'
        self.fails += 1
        if self.fails >= self.limit:
            self.open = True
        return 'failure'

b = Breaker(3)
for ok in [False, False, False, True]:
    print(b.call(ok))

Timeouts Are Essential

A breaker only helps if calls have timeouts. Without a timeout, a hung dependency holds a thread forever and failures are never counted. Always set aggressive, explicit timeouts on remote calls.

Retries and Backoff

Retries can help with transient errors but can also amplify an overload. Use exponential backoff with jitter and cap the retry count. Combine with a circuit breaker so retries stop entirely when the circuit is open.

import random
delay = 1
for attempt in range(4):
    wait = delay + random.uniform(0, delay)
    print('attempt', attempt, 'wait', round(wait, 2))
    delay *= 2

Graceful Degradation

Graceful degradation means the system still does something useful when a dependency is down, instead of returning an error.

  • Serve stale cached data
  • Hide a non-critical feature
  • Return a sensible default

Fallbacks

When the breaker is open, route to a fallback. For a product page, if the recommendations service is down, show a generic best-sellers list instead of failing the whole page.

def get_recommendations(breaker):
    if breaker.open:
        return ['bestseller-1', 'bestseller-2']
    return ['personalized-1', 'personalized-2']

Bulkheads

The bulkhead pattern isolates resources so one failing dependency cannot consume all threads or connections. Give each downstream dependency its own bounded pool — like watertight compartments in a ship.

Load Shedding

Under extreme load, it is better to reject some requests quickly than to slow down for everyone. Load shedding drops low-priority traffic to protect critical paths and keep latency bounded.

Putting It Together

Resilient services layer these patterns: tight timeouts, circuit breakers, bulkheads to isolate, fallbacks for degradation, and load shedding under pressure. Together they turn a potential outage into a minor, contained blip.

Quick Check

Test your understanding of circuit breakers.

Recap

You learned to contain failures for high availability:

  • Circuit breakers fail fast and cycle through closed, open, and half-open
  • Timeouts and capped backoff retries prevent overload amplification
  • Graceful degradation and fallbacks keep the system useful
  • Bulkheads and load shedding isolate and protect critical paths

자주 묻는 질문

“서킷 브레이커와 우아한 성능 저하” 강의는 무료인가요?

네 — “서킷 브레이커와 우아한 성능 저하” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 System Design Basics for Backend Developers 강의 전체를 잠금 해제할 수 있습니다. System Design Basics for Backend Developers 강의에는 총 4개의 강의가 포함되어 있습니다.

“서킷 브레이커와 우아한 성능 저하”에서 뭘 배우나요?

서킷 브레이커가 연쇄 장애를 방지하고, 의존성이 실패한 상황에서도 우아한 성능 저하로 시스템의 유용성을 유지하는 방법을 학습해 보세요. 브라우저에서 직접 실행하는 실습 코드로 System Design Basics for Backend Developers을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

System Design Basics for Backend Developers을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 System Design Basics for Backend Developers은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“서킷 브레이커와 우아한 성능 저하” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 System Design Basics for Backend Developers 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 System Design Basics for Backend Developers 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 중복성과 장애 조치 메커니즘
  2. 재해 복구 계획
  3. 모니터링, 경보 및 로깅
  4. 서킷 브레이커와 우아한 성능 저하
← System Design Basics for Backend Developers(으)로 돌아가기