⚖️
API Gateway & Service Discovery

Load Balancing

Distributing Traffic
💡 Load, balancer, EK, "TRAFFIC, POLICE" jaisa, hai, EK, TOLL, PLAZA, PAR — MULTIPLE, LANES, (service, instances) ke, BEECH, INCOMING, CARS, (requests) ko, EVENLY, DISTRIBUTE, karta hai, EK, LANE, ko, OVERLOADED, hone, se, ROKТE, hue.

Load, balancing, ALGORITHMS, — Round, Robin, (turn-by-turn, distribution), Least, Connections, (SABSE, KAM, BUSY, instance, ko, request), aur, Weighted, (POWERFUL, instances, ko, ZYAADA, traffic).

Load, balancers, HEALTH, CHECKS, bhi, karte, HAIN — UNHEALTHY, instances, ko, AUTOMATICALLY, ROTATION, se, HATA, dete, HAIN, jab, tak, WOH, WAAPAS, HEALTHY, na, ho, jaayein.

// Round robin — HAR, request, agla, instance, PAR:
// Request 1 → instance-A
// Request 2 → instance-B
// Request 3 → instance-C
// Request 4 → instance-A (cycle, wapas)
⚖️
Load, balancer, EK, "TRAFFIC, POLICE" jaisa, hai, EK, TOLL, PLAZA, PAR — MULTIPLE, LANES, (service, instances) ke, BEECH, INCOMING, CARS, (requests) ko, EVENLY, DISTRIBUTE, karta hai, EK, LANE, ko, OVERLOADED, hone, se, ROKТE, hue.
1 / 2
⚡ Quick Recap
  • Load balancer = traffic, ko, multiple, instances, mein, evenly, distribute, karta, hai
  • Algorithms: Round Robin, Least Connections, Weighted
  • Health, checks, se, unhealthy, instances, automatically, hataye, jaate, hain
Is page mein (2 subtopics)

Consistent, hashing, EK, load, balancing, TECHNIQUE, hai, JISME, SAME, "KEY" (jaise, SAME, user, ID) HAMESHA, SAME, instance, PAR, ROUTE, hoti hai — WebSocket, connections, YA, IN-MEMORY, caching, jaise, use-cases, ke, liye, useful, hai.

// Consistent hashing — SAME, userId, HAMESHA, SAME, instance, PAR:
const instance = hash(userId) % totalInstances;

Layer, 4, (TCP-level) load, balancing, FASTER, hai, LEKIN, LESS, SMART, (HTTP, content, ko, dekh, NAHI, sakta). Layer, 7, (HTTP-level) load, balancing, HTTP, HEADERS/PATHS, ke, hisaab, se, INTELLIGENT, routing, kar, sakta hai (jaise, /api/v2, ko, DIFFERENT, instances, PAR, route, karna).