BEAM vs. Go & Java: Lightweight Concurrency Benchmarks
The BEAM's 20ns context switch is significantly faster than Go goroutines, which achieve around 50ns, and offers an advantage over Java's newer virtual threads, which, while also fast and user-scheduled, showed longer process forking times in some high-concurrency benchmarks.
The top 3
- BEAM's Memory Efficiency for Millions of Processes: Erlang's BEAM VM processes are exceptionally lightweight, consuming only ~2-3 KB each, enabling systems to manage millions of concurrent processes on standard hardware. In contrast, traditional Java threads typically require ~1-2 MB of stack space per thread, limiting concurrent threads to thousands.
- Erlang's Superior Scheduler Fairness & Real-Time Performance: Erlang's BEAM scheduler demonstrates significantly superior fairness and real-time performance compared to Golang's goroutine scheduler, particularly under sustained CPU pressure. Erlang's preemptive scheduling ensures fair execution, whereas Go's scheduler has been noted for being crude and unfair.
- Go's Edge in Spawning 1 Million Concurrent Units: In a benchmark spawning 1 million concurrent processes, Go Threads (goroutines) demonstrated the fastest execution at approximately 4.5 seconds. Elixir Erlang Threads followed closely at 5.1 seconds, while Java 21 Virtual Threads took around 7 seconds for the same task.
Sources
Open the full topic