Log10 Loadshare Online
Here is a reusable function to compute loadshare imbalance scores:
import math
import numpy as np
def log10_loadshare(raw_rates):
"""Convert a list of raw request rates to log10 loadshare values."""
return [math.log10(r + 1) for r in raw_rates]
def imbalance_score(raw_rates):
"""
Returns a score between 0 (perfect balance) and 1 (severe imbalance).
Uses log10 scale to normalize across magnitudes.
"""
log_vals = log10_loadshare(raw_rates)
max_log = max(log_vals)
min_log = min(log_vals)
# Theoretical maximum delta in log10 space for typical systems is ~5
return (max_log - min_log) / 5.0
A common DevOps pain point is comparing load across clusters with different capacities. One Kubernetes cluster might handle 50 RPS per pod; another handles 5,000 RPS per pod. You cannot overlay their raw metrics on the same graph. log10 loadshare
But log10 loadshare scales universally. Both clusters will show values between 1.7 (50 RPS) and 3.7 (5,000 RPS). You can now create a single global SLO dashboard for all clusters.
In parallel outlet systems (e.g., multiple intakes on a dam), engineers must calculate the Log10 loadshare for each intake to ensure no single intake is overloaded or starved of water as the reservoir level fluctuates.
Use inverse of average latency as the metric. If Server A has 5 ms latency and Server B has 50 ms latency, linear would strongly favor A. Log10 compresses this difference, preventing all traffic from rushing to the slightly faster server (which might then degrade under load). Here is a reusable function to compute loadshare
If a high-capacity server starts failing requests, you can temporarily reduce its weight by treating its effective capacity as lower. Because weights compress, other servers can absorb the load without cascading failure.
In distributed systems, a loadshare (or load-splitting ratio) defines how incoming requests or data units are distributed among a set of servers, queues, or paths. A standard linear loadshare might send 70% of traffic to Server A and 30% to Server B.
However, real-world conditions—such as vastly different server capacities, response time constraints, or the need to protect small backends from overload—require a non-linear distribution. This is where log10 loadshare comes into play: it uses a base-10 logarithmic function to map a target metric (e.g., server weight, historical latency, or available capacity) into a share proportion. If you used a linear ratio based purely
Imagine you have three internet links:
If you used a linear ratio based purely on Mbps, the weights would be 10, 100, and 1000. While mathematically accurate, this creates a large table of weights for the router to process, and the 1 Gbps link would dominate the traffic flow so aggressively that the smaller links might appear completely unused in monitoring tools.
Using Log10 Loadshare: