রিডান্ডেন্সি ও ফেইলওভার
active-passive/active-active, quorum, health check আর graceful degradation।
Start with the production incident, then the design decision that fixes it.
চলো-র প্রথম architecture-এ একটাই load balancer ছিল। রবিবার সন্ধ্যায় সেটার process OOM-এ মারা গেল—পেছনের ৬টা API সার্ভার সব সুস্থ, কিন্তু কোনো traffic পৌঁছাল না। ২৫ মিনিট outage। মাহিন বলল, "তোমার redundancy শুধু app tier-এ ছিল; entry door-টা single point of failure।"
Redundancy মানে প্রতিটা critical component-এর বিকল্প; failover মানে একটা মরলে traffic অন্যটায় যাওয়া। কিন্তু শুধু দুটো instance রাখলেই redundancy হয় না—health check, shared state, quorum, failover automation আর blast radius সব লাগে। দুটো instance একই rack/power/region-এ থাকলে সেটা redundancy নয়, মিথ্যানিরাপত্তা।
Active-passive। একটাই traffic নেয়, অন্যটা standby; heartbeat fail হলে VIP/DNS switch। সহজ, কিন্তু standby idle cost; failover time।
Active-active। দুটোই traffic নেয়, LB ভাগ করে; capacity বেশি, কিন্তু shared state/consistency জটিল। Stateless app + replicated DB-তে ভালো।
Health check। শুধু process নয়, dependency (DB/Redis/queue) দেখে; deep vs shallow। Fail threshold/debounce; flap এড়াও।
Quorum। ৩/৫ node majority; split brain আটকায়। Stateful service-এ quorum ছাড়া active-active নয়।
Blast radius। Rack/AZ/region আলাদা করো; একই power/network switch/DB-তে দুটো replica রাখলে redundancy নেই। Cell-based architecture-ও ভাবো।
Graceful degradation। Recommendation service down হলে feed চলুক without it; payment down হলে queue/retry, read-only mode। প্রায়ই "সব বা কিছু না" এর চেয়ে আংশিক ভালো।
| ধরণ | Failover | Cost | Consistency |
|---|---|---|---|
| Active-passive | switch | standby idle | সহজ |
| Active-active | automatic | capacity efficient | কঠিন |
| Quorum | election | ৩/৫ node | strong-ish |
| Degraded | feature off | কম | আংশিক |
Health-check + failover-এর সরল pseudo:
def healthy(node):
try:
r = requests.get(f"http://{node}/health", timeout=1)
return r.status_code == 200 and r.json().get("db") is True
except Exception:
return False
def pick():
for node in sorted(nodes, key=lambda n: n.priority):
if healthy(node):
return node
raise Unavailable("no healthy node")
# nginx active-passive upstream
upstream api {
server 10.0.0.11:3000 max_fails=3 fail_timeout=10s;
server 10.0.0.12:3000 backup;
}
backup শুধু primary ব্যর্থ হলে traffic পায়; health check dependency দেখলে ভুয়া 200 এড়ানো যায়।
১. SPOF তালিকা করো। LB, DNS, DB primary, Redis, queue, object storage, auth—প্রতিটা কীভাবে fail করে?
২. Failure domain আলাদা করো। Rack/AZ/region; একই host-এ দুই replica নয়। Power/network independent।
৩. Health/failover। Deep health, threshold, debounce; active-passive switch test; DNS TTL কম।
৪. State/consistency। Stateless app, replicated DB, quorum; failover-এ split brain নয়।
৫. Degradation drill। Recommendation/payment/email বন্ধ করে দেখো app কী করে; read-only fallback।
একটা request path আঁকো: DNS → LB → app → Redis → DB → queue। প্রতিটা component-এর পাশে লেখো: replica আছে? কোন AZ? failover automatic? একই rack? যে তিনটার উত্তর "না", সেগুলোই প্রথম কাজ।
Failover rehearsal না করলে automation বিশ্বাস করো না; মাসে একবার primary kill করে দেখো। DNS failover TTL/health propagation সময় ধরো। Active-active-তে conflict resolution লিখো; নাহলে split brain-এ data দুই দিকে যাবে।
See the mental model first — the animation and the steps below it say the same thing.
Concept visual
active-passive-এ standby অপেক্ষা করে, active-active-এ দুই দিকই কাজ নেয়—দুটোতেই প্রাণ health check।
Write a short design on paper or in a note, then compare it with the rubric. This is not a judge submission.
Design practice
এক LB, ৬ API; LB OOM-এ ২৫ মিনিট outage।
One timed attempt. Solve every problem to earn the module badge.
Final checkpoint
Ready to prove this module?
Ask questions, share an approach or leave a study tip for this lesson.
Was this lesson helpful?
Your reaction helps other learners judge these notes.
0 comments
Sign in to ask a question or share an approach.
Sign in to commentNo comments yet
Be the first to ask a question or leave a study tip.
| প্রশ্ন | উত্তর |
|---|
| LB redundant? | active-passive/managed |
| Health? | deep + threshold |
| State? | replicated/quorum |
| AZ? | independent |
| Degrade? | feature off |