NextGen Sarkari

Study material for government exam preparation across Punjab and India.

Home/Study Material/Networking & Technical/Load Balancers and High Availability
High Availability study guide

Load Balancers and High Availability

A load balancer presents a virtual service to clients and distributes requests across healthy backend servers. It improves availability and scale only when health checks, persistence, capacity, return paths and application behaviour are designed correctly.

High AvailabilityIntermediate40 min readUpdated 2026-08-06

Core load-balancer components

ComponentPurpose
Virtual IP / virtual serverClient-facing address, port and protocol.
PoolLogical collection of backend members.
Pool memberServer address and service port.
Health monitorTests whether a member or application is safe to receive traffic.
Profile/policyControls TCP, HTTP, TLS, persistence, logging and transformations.
PersistenceAttempts to send related client requests to the same backend.

Layer 4 versus Layer 7 balancing

ModeDecision dataExamples
Layer 4IP addresses, protocol and ports; often connection-oriented.Generic TCP/UDP services, high-throughput pass-through.
Layer 7Application data such as HTTP host, URI, header or cookie.Content routing, redirects, header insertion, WAF integration.

Layer 7 features normally require the load balancer to proxy or terminate the client-side connection. This gives application visibility but increases processing and creates separate client-side and server-side connection behaviour.

Distribution algorithms

  • Round robin: cycles through healthy members.
  • Least connections: prefers a member with fewer active connections.
  • Weighted methods: send more traffic to higher-capacity servers.
  • Hash-based: uses client/source or other fields for deterministic distribution.
  • Observed/predictive methods: use measured response or platform-specific metrics.

No algorithm fixes an unhealthy application. Choose based on connection duration, request cost, server capacity and whether the load balancer can see application transactions.

Health checks

A basic TCP monitor proves only that a port accepted a connection. An application monitor can send an HTTP request, validate status and search for expected content. The best check is deep enough to detect real service failure but light enough not to overload the backend.

False healthy: A login page can return HTTP 200 while its database is unavailable. False unhealthy: An overly strict response string or short timeout can remove healthy servers.
  • Use interval and timeout values that avoid flapping.
  • Consider rise/fall counters before state changes.
  • Monitor dependencies or a purpose-built readiness endpoint.
  • Use graceful draining before maintenance.

Persistence and application state

Persistence may use source address, cookies, TLS/session identifiers or application tokens. It is needed when session state is stored only on one backend. Excessive persistence can produce uneven load or keep clients pinned to a degraded node.

More scalable applications externalise session state or use stateless tokens so any healthy backend can serve a request. Even then, long-lived TCP, WebSocket or streaming connections remain naturally attached to a selected member.

TLS termination and client identity

A load balancer can terminate TLS, inspect HTTP and establish a new server-side TLS connection. Certificates, protocol versions, cipher policy, SNI, trust validation and re-encryption must all be maintained.

Because the backend may see the load balancer's address as the source, preserve client identity using mechanisms such as X-Forwarded-For, the standardized Forwarded header, PROXY protocol or transparent/DSR designs. The backend must trust these values only from approved proxies.

High availability and traffic flow

Appliance or virtual load balancers are often deployed as an HA pair. Failover may move a floating address, update upstream routing or rely on anycast. Configuration and persistence/session state can be synchronised, but in-flight recovery depends on platform and protocol.

Clients
VIP / HA pair
Pool A
Pool B
Pool C

Troubleshooting workflow

  1. Test the VIP and the backend directly from appropriate locations.
  2. Check virtual server, pool and member state.
  3. Compare health-monitor request/response with the real application.
  4. Inspect connection tables and client-side/server-side resets.
  5. Verify SNAT/DSR design and symmetric return path.
  6. Check persistence records and uneven member utilisation.
  7. Validate Host header, SNI, certificate chain and backend TLS trust.
  8. Inspect HTTP status, response time and application logs.
  9. Check port exhaustion, connection limits, CPU, memory and SSL capacity.

Interview focus

Use these points to practise concise, operations-focused answers. Explain the concept first, then give a verification or troubleshooting example.

  • What is a VIP? The client-facing virtual IP/service presented by the load balancer.
  • Why can a TCP health check be insufficient? The port may accept connections while the application or a dependency is unusable.
  • What is persistence? A mechanism that attempts to keep related client traffic on the same backend.
  • What is TLS offload? The load balancer terminates client TLS so backends do less cryptographic work or receive re-encrypted/plain traffic according to policy.
  • Why is symmetric return routing important? Proxy/NAT and stateful processing often require response traffic to return through the load balancer.

Quick self-check

1. What is a VIP?
Answer: The client-facing virtual IP/service presented by the load balancer.
2. Why can a TCP health check be insufficient?
Answer: The port may accept connections while the application or a dependency is unusable.
3. What is persistence?
Answer: A mechanism that attempts to keep related client traffic on the same backend.
4. What is TLS offload?
Answer: The load balancer terminates client TLS so backends do less cryptographic work or receive re-encrypted/plain traffic according to policy.
5. Why is symmetric return routing important?
Answer: Proxy/NAT and stateful processing often require response traffic to return through the load balancer.

Frequently asked questions

1. Does a load balancer automatically make an application highly available?
Answer: No. Backends, dependencies, health checks, state, DNS and the load-balancer tier itself must all be resilient.
2. Can a load balancer preserve the client IP?
Answer: Yes, through headers, PROXY protocol, transparent modes or specific routing designs.
3. What causes uneven traffic distribution?
Answer: Persistence, a small number of long flows, weights, health state, hash inputs or backend response behaviour.

Standards and further reading

Editorial note: Standards explain protocol behaviour, while commands and defaults can differ by vendor, platform and software release. Verify production changes against current vendor documentation.

Continue learning