ELS: a latency-based load balancer, part 2

Lukáš Poláček
7 min readadvanced
--
View Original

Overview

This article discusses the metrics and methodologies for measuring and optimizing latency in load balancing systems, specifically focusing on the ELS (Elastic Load Balancer) at Spotify. It covers essential metrics like success latency, failure latency, and the importance of parallelism, along with advanced techniques for calculating expected latency from a user's perspective.

What You'll Learn

1

How to measure success latency and failure latency in load balancers

2

Why parallelism is crucial for optimizing load balancing performance

3

How to calculate expected latency based on success and failure rates

Prerequisites & Requirements

  • Understanding of load balancing concepts and latency metrics

Key Questions Answered

What metrics should be measured by a load balancer?
The key metrics include success latency (ℓ), success rate (s), number of outstanding requests (q), and failure latency (f). These metrics help in assessing the performance of each machine and optimizing the load balancing process.
How is expected latency calculated from a user's perspective?
Expected latency is calculated using the formula L = ℓ + (f + 800)(1 / s - 1) ms, which accounts for both success and failure latencies, including the round-trip time for retries. This helps in understanding the total wait time for a successful response.
What is the impact of time bias on latency measurements?
Setting the time bias too low results in noisy measurements, while setting it too high delays the detection of increased latency. An adaptive time bias based on traffic rate can help maintain accurate latency measurements.
How does the load balancer convert expected latency to weight?
The load balancer assigns weights based on the formula 1 / E, where E is the expected latency. This means machines with lower latencies receive higher weights, increasing their chances of receiving requests.

Key Statistics & Figures

Weight calculation based on expected latency
1 / E
Where E is calculated as E = L * (q + 1
Time bias impact on measurement
63.2%
When the time bias is set to 1 minute, 63.2% of the value comes from the last minute measurements.

Key Actionable Insights

1
Regularly measure success and failure latencies to ensure optimal load balancing performance.
Monitoring these metrics allows for timely adjustments to the load balancing strategy, improving overall system responsiveness and user experience.
2
Implement an adaptive time bias for latency measurements to enhance accuracy.
By adjusting the time bias according to current traffic rates, the load balancer can more effectively respond to changes in system performance.
3
Utilize the formula 1 / L / (q + 1)³ to improve tail latency.
This approach penalizes machines with excessive outstanding requests, leading to better performance in high-load situations.

Common Pitfalls

1
Setting the time bias too low can lead to noisy latency measurements.
This happens because too few requests in each time bias window cause the success rate to fluctuate significantly, making it difficult to gauge true performance.
2
Relying solely on the number of processors for parallelism can be misleading.
Processors may be occupied by other processes, so it's crucial to measure actual parallelism to ensure accurate load balancing.