BeginnerCoder

Lesson 20 — Circuit breaker

Stop calling what is broken

If a service you depend on is down, waiting for each call to time out makes your service slow too. A circuit breaker counts failures; after max failures in a row it opens and fails fast without calling at all. (The name comes from the electrical switch that cuts power to protect a circuit.)

Note: real DevOps tools (CI servers, load balancers, Docker, Kubernetes) cannot run in your browser, so this exercise is a small plain-JS simulation of the logic those tools use. ok stands for whether the real call would have succeeded.

Why it matters: it stops one broken service from dragging down everything that calls it.

Want it another way?
Task

When a call fails, add 1 to fails and open the breaker once fails reaches max.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.

Keep going with DevOps Foundations

Ready for more? Optional paid resources that pick up where this lesson leaves off.

Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.