Scaling Concurrency: Millions of BEAM Processes vs. Thousands of OS Threads
The minimal memory footprint of BEAM processes enables the Erlang Virtual Machine to efficiently support millions of concurrent processes on a single machine, a scale that is practically unachievable with the significantly heavier OS threads.
The top 3
- BEAM Process Memory: Kilobytes vs. Megabytes: BEAM processes are exceptionally lightweight, typically starting at just 2-3 KB per process. In stark contrast, traditional OS threads (like those in a JVM) often consume 1-2 MB of stack space each, making BEAM processes 500-1000 times lighter in memory footprint.
- BEAM Process Memory: Hundreds of Bytes vs. Megabytes: A BEAM process typically consumes only a few hundred bytes (e.g., ~2-3 KB), allowing millions to run on a single machine, while OS threads usually require 1-2 MB of stack space, limiting practical concurrency to thousands.
- BEAM's Fault Isolation: Resilient Million-Process Systems: Unlike OS threads where a crash can often affect the entire process, BEAM processes are completely isolated, ensuring that a failure in one process does not impact others. This 'let it crash' philosophy, combined with supervision trees, is crucial for maintaining system uptime and stability when scaling to millions of concurrent units.
Sources
Open the full topic