AWS Builder Center
I Routed Garbage Trucks Before I Understood Load Balancers

I Routed Garbage Trucks Before I Understood Load Balancers

I routed garbage collection trucks before I met load balancers. Same problem: spread the work, survive a failure, and notice who is overloaded.

Teaching process improvement, agile and data. Software development PM. Based in Medellín, Colombia.
Before I taught process improvement, I spent a year routing garbage collection vehicles in Antioquia.
When I started reading about Elastic Load Balancing on AWS, I had the same feeling I had with S3 storage classes: I wasn’t learning something new, I was recognizing something old.

The dispatcher

A load balancer is a dispatcher. Requests arrive, and someone has to decide which server handles each one. That’s exactly what a routing desk does: work arrives, and you decide which truck takes it.
If there were only one truck, there would be nothing to decide. The problem starts when you have several, and they are not equally available.

Round robin: the first rule everyone tries

The simplest rule is to give each truck the next street in turn. Truck 1, truck 2, truck 3, back to truck 1.
It works when every street is about the same. It fails the moment one street has three times the garbage of the others. One truck fills up and falls behind while another finishes early and waits.
Load balancers have the same problem. On an AWS Application Load Balancer, round robin is the default: it sends requests to healthy servers in order, without looking at how heavy each request is. AWS describes it as a good fit when requests are similar in complexity and servers are similar in capacity.
When requests vary, you can switch the target group to the least outstanding requests algorithm, which sends each new request to the server with the fewest requests in progress. It’s the same instinct as sending the next street to the emptiest truck, not the one whose turn it is.

Health checks: knowing when a truck is down

A truck breaks down. A good dispatcher doesn’t keep sending it streets and hoping for the best. They stop assigning it work until it’s back.
That’s what health checks do. By default, an Application Load Balancer monitors the health of its servers and routes requests only to the healthy ones. Nobody has to notice at 3 a.m. and make a phone call.

The night a hose burst

One truck broke down on the road when a hydraulic oil hose burst. That hose raises and lowers the blade that compacts the garbage, so without it the truck couldn’t work.
The mechanics didn’t know the exact size of the hose or the precise damage. I went with them, because replacing the part was only half of the problem. I wanted to understand the cause. It could be wear on the part, or it could be something new about that route. We stayed up all night with the team.
After several hours of repairs, analyzing the vehicle and its conditions, and talking with the driver, we found that the hose had simply worn out. But when we compared it with other vehicles, it had worn out in less time. So we kept investigating, and we found a bad practice: the driver was overstressing the system.
After the repair, we gave feedback to the drivers and trained them again. The time lost to repairs was far greater than the time you save by operating the machines with care, and the rush was exactly what accelerated the wear.
I didn’t leave that night with only a repaired truck. I left with a different question. Not “how fast can we fix it?” but “why did it break?”
That’s the difference between a health check and a diagnosis. A health check tells you the truck is down. It doesn’t tell you why. If we had only swapped the hose, the next one would have burst early too. Servers are the same: replacing a failed one is fast, but if you never ask why it failed, the next one fails the same way.

Draining: don’t pull a truck mid-street

If you need to take a truck out of service, you don’t yank it halfway through a route. You stop giving it new streets and let it finish the one it’s on.
Load balancers do the same thing. AWS calls it deregistration delay: when a server is being removed, the load balancer stops sending it requests and, by default, waits 300 seconds, which helps requests already in progress finish. Without it, someone in the middle of a payment gets cut off.

More than one depot

A depot floods, or loses power. If all your trucks live there, you’re out of service. If you have depots in different places, the others keep running.
That’s the idea behind spreading servers across Availability Zones. The load balancer only routes to healthy servers, so if the ones in one zone fail, traffic keeps flowing to the zones that still work.

Peak days

Some days there’s more garbage: holidays, a long weekend. You add trucks for those days and release them afterwards.
That’s auto scaling. The difference is that in the cloud you pay for the extra capacity only while you use it. In real life, someone still has to pay the driver and the fuel.

Where the analogy breaks

I have to dismantle my own comparison, because it fails in two places.
First, a truck has state. It’s full or empty, and it’s in a specific place. If it breaks down halfway through a route, that route’s progress is gone. Most web requests don’t work that way: any server can handle the next one, which is what makes them so easy to balance. The exception is sticky sessions, where the load balancer binds a user’s session to a specific server. It’s convenient for servers that keep state, and it brings the truck problem back: if that server fails, the load balancer picks another one, but whatever the first one was holding for that user is gone.
Second, trucks can’t be copied. You can’t have a new one in seconds. Servers can be started quickly, but not instantly, and that delay is why you scale before the peak, not during it.

A five-minute exercise

Take any service you depend on and ask three questions:
How does work get divided between servers? What happens to the work in progress if one server fails? Who notices, and how fast?
If the answer to the third question is “someone will eventually see it”, you have a truck broken down in the middle of a route and nobody has told the dispatcher.


When was the last time you fixed a symptom without asking why it happened? And if you come from logistics, transport or operations, which cloud concept did you recognize first because you had already lived it?

Reference: AWS Elastic Load Balancing documentation.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article