Course contentsShow
← System Design
Lesson 92 of 1,9193. Load BalancingFree lesson

Least Response Time Algorithm

Routes to server with lowest response time and fewest active connections, optimizing for performance.

What You'll Learn

You'll learn how the Least Response Time algorithm routes traffic to the server that can respond fastest, combining both response speed and active load.


The Core Idea

The Least Response Time algorithm is a smart load balancing strategy that picks the server with the lowest response time multiplied by (or combined with) the fewest active connections. Unlike simpler algorithms like Round Robin (which ignores server performance) or Least Connections (which ignores response speed), this approach considers both how busy a server is and how quickly it's responding.

Think of it like choosing a checkout line at a grocery store. You don't just count people in each line (Least Connections)—you also notice which cashiers are faster. The best line combines few customers with a speedy cashier.


How It Works

The load balancer monitors:

  1. Response time: How quickly each server answers requests (milliseconds per request)
  2. Active connections: How many requests each server is currently handling

The algorithm calculates a score for each server—often response_time × active_connections—and routes new requests to the server with the lowest score.


Why This Matters

This algorithm optimizes for user experience by adapting to real-time performance. If one server slows down (due to memory pressure, slow disk, or other issues), it automatically receives fewer requests. It's particularly valuable when servers have different hardware capabilities or varying workloads.


Key Takeaway: Least Response Time routes traffic to the server with the best combination of speed and availability, making it ideal when server performance varies or when user experience depends on low latency.