今日已更新 386 条资讯 | 累计 20358 条内容
关于我们

标签:#balancer

找到 1 篇相关文章

AI 资讯

A load balancer inspired by how Emperor Penguins survive Antarctic winters

Why I modeled a load balancer after Emperor Penguin huddles A few months ago I was reading about how emperor penguins survive Antarctic winters. Temperature drops to -40°C, wind hits 120km/h, and somehow these birds make it through. Not because they're individually tough. Because they rotate. Cold penguins on the outside push inward. Warm ones from the center move out to rest. Nobody coordinates this. No penguin is in charge. It emerges from one simple rule: if you're cold, push in. If you're warm, you'll get pushed out eventually. I couldn't stop thinking about this. I was working on a service mesh at the time and dealing with the usual problem — one slow server quietly dragging down the whole cluster. Round robin doesn't care. Least connections helps but not always. Weighted approaches need manual tuning that goes stale immediately. The penguin thing kept nagging at me. What if servers had a "temperature"? What if hot servers rotated out to rest? That's HuddleCluster. The basic structure Two rings: Inner ring (deque): Active servers. Requests go to them round-robin. Simple, fair, zero overhead for normal traffic. Outer ring (min-heap): Resting servers. Keyed by temperature — coolest server sits at the top, ready to rotate back in first. When a server in the inner ring runs hot past a threshold, it moves out. When an outer ring server cools down, it comes back in. That's the entire rotation logic. About 50 lines of Python. What is "temperature"? This took me a while to get right. My first attempt was just raw latency. That was bad. A server handling one slow database query looks terrible even when it's completely healthy. I needed something more composed. Current formula: pythontemperature = EMA( 0.7 * relative_latency_anomaly + 0.1 * cpu_score + 0.1 * memory_score + 0.1 * (error_rate + connection_score) ) Three decisions here worth explaining. EMA over simple moving average EMA weights recent measurements more heavily. If a server just had a bad spike but recovere

2026-06-15 原文 →