Problem: A last-mile logistics platform's Python queue processor saturated at 120 jobs/second under peak load. CPython's GIL prevented true concurrency on CPU-bound route scoring. Driver assignment delays were causing visible UX degradation.
Solution: Rewrote the worker pool in Go. Workers pull batches from Redpanda, score jobs against drivers using a weighted graph algorithm with an in-memory R-tree spatial index (updated incrementally from a driver-position topic). Worker count scales with K8s HPA keyed on consumer group lag. Scoring complexity: O(n) → O(log n).
Technology: Go · Redpanda · Kubernetes · R-tree spatial index
Optimisation pattern: python-to-go-concurrent-workers
Outcomes:
Throughput: 120 → 800 jobs/second. P99 assignment latency: 4.2 s → 380 ms. Worker pod count at peak: 40 (Python) → 6 (Go). Driver complaints down 78%.