BEAM There, Done That with Erik Stenman on the BEAM Book Origin, Scheduler Reductions and AI Compute Sovereignty

New BEAM There, Done That with Erik Stenman (Happi), Erlang researcher since 1994 and author of the BEAM Book.

The production story is directly relevant here: on Christmas Eve at Klarna, the BEAM scheduler throttled to a single active scheduler during low overnight traffic. A batch job arrived carrying all the day’s Christmas orders. A function serializing large XML structures to binary used only 20 reductions regardless of input size - meaning it never yielded to the scheduler. Heart, which monitors the system from outside, couldn’t get a response from the VM and killed the process. All three failover nodes reproduced the same condition. Half an hour of downtime. The BEAM Book exists because the debugging process required going deep into runtime behavior that wasn’t documented anywhere.

The reduction accounting issue: function calls on the BEAM consume reductions and yield when the limit is reached. Some BIFs and built-in operations historically consumed a fixed number of reductions regardless of the actual work performed - meaning operations on large data structures could monopolize a scheduler indefinitely. Understanding this requires knowing the runtime from the inside.

Erik’s current work (Eldrim) applies the same diagnostic instinct to AI compute: knowing where resources actually run versus where you’ve been told they run. The US Cloud Act and China’s national intelligence law both reach companies regardless of server location. Eldrim routes AI compute according to declared sovereignty rules and refuses requests that can’t be fulfilled within approved jurisdictions.

1 Like