![BEAM Virtual Machine Architecture](https://avatars.githubusercontent.com/u/6510388?s=200&v=4)

BEAM Virtual Machine Architecture

What Actually Is This Thing?

Erlang came from Swedish telecom engineers in the '80s who were pissed off that their phone switches kept dying. When a telecom switch goes down, you lose millions per minute, so they said "fuck this" and built a language where things are allowed to crash without bringing down the entire system.

The syntax looks like someone took C and ran it through a blender with Prolog. I spent 3 weeks cursing at semicolons vs periods - they're backwards from literally every other language. You end clauses with semicolons and functions with periods, which feels wrong until your muscle memory finally gives up fighting it.

But here's the kicker: spawning an Erlang process costs less than creating an object in Java. No joke - 2.6KB of RAM and you get your own isolated universe with a mailbox.

The Actor Model (But Actually Useful)

Erlang BEAM Virtual Machine

Each process is completely isolated - it has its own memory heap, stack, and message queue. When one crashes, it doesn't take down anything else. I learned this the hard way when I spawned way too many processes on my MacBook (maybe 2 million?) and everything kept running fine. Try that with threads and see how fast your OS starts weeping.

The BEAM VM can theoretically handle millions of processes, but in practice you'll hit other limits first. I've run systems with 100k processes without breaking a sweat - the scheduler is fucking magical at keeping everything fair.

Forget those synthetic benchmarks claiming millions of messages per second. Real production systems with actual payloads? Maybe 20-40k messages/second if you're lucky and everything's optimized. Network I/O will be your bottleneck way before the VM gives up.

Who's Actually Using This?

OTP 28.0 dropped in May 2025 with some decent improvements. They've been pretty consistent with yearly releases, which is nice when you're not dealing with the JavaScript ecosystem's "new framework every Tuesday" bullshit.

Here's who's actually betting their infrastructure on this weird functional language:

  • WhatsApp: 32 engineers handled 450 million users before Facebook bought them for $19 billion. That's roughly 14 million users per engineer. Try scaling that with Node.js.
  • Discord: Actually switched from Go to Rust because their garbage collector was causing random latency spikes during message fanout. They didn't go with Erlang/Elixir, but the problem they solved is exactly what BEAM languages excel at.
  • Goldman Sachs: Uses it for high-frequency trading where a millisecond delay costs millions. If Goldman trusts it with their money, maybe it's not just academic masturbation.
  • CouchDB: The entire database is written in Erlang because they needed something that doesn't shit itself when things go wrong.

The "Let It Crash" Philosophy (Sounds Insane, Actually Works)

Most languages teach you to catch every exception and handle it gracefully. Erlang says "fuck that" and just lets things crash. Sounds stupid until you realize that process isolation means one crashed process doesn't take down everything else.

When a process dies, its supervisor restarts it in milliseconds. I've seen production systems restart 10,000 processes without dropping a single user connection. Try that with your REST API built on Express.

Hot code reloading is pure magic when it works. You can literally update running production code without stopping the system. But I once accidentally updated the wrong module and all user sessions got corrupted because the state format changed mid-flight. The docs say it's "safe" but always test that shit on staging first.

Erlang vs Everything Else (Honest Take)

Learning and Getting Started (Good Luck)

Installation and Setup (AKA Your First Frustration)

Download OTP 28.0 - though in my experience, half the time the installer is broken on whatever OS you're using.

Linux: apt-get install erlang works 90% of the time. When it doesn't, you get cryptic dependency errors about libssl1.1 vs libssl3 that'll waste 2 hours of your life. Ubuntu 22.04 users: OTP 25.3 breaks SSL connections randomly - use 25.2 or 26+.

Mac: brew install erlang usually works, but on M1 Macs you might get this fun error: beam.smp: Bad CPU type in executable. Solution: uninstall everything and use the native ARM build. Pro tip: OTP 24.x has threading issues on Apple Silicon - go straight to 25+.

Windows: Just fucking use WSL. Seriously. I've seen grown developers cry trying to get Erlang running on Windows 11. PATH variables become your enemy, and erl command not found is basically guaranteed. If you absolutely must use Windows, OTP 27+ has better native support but you'll still hate life.

The REPL Will Teach You Or Break You

The Erlang shell is great when it works, but it'll crash more often than Windows Vista. Syntax errors give you cryptic shit like:

** exception error: no match of right hand side value {error,eacces}

What the fuck does that mean? Usually you misspelled something or forgot a period somewhere.

Pro tip: Always keep a backup shell open. I once spawned a million test processes in the REPL and locked up my entire session. Had to kill -9 the whole BEAM VM and lost 2 hours of REPL history.

Pattern Matching Will Hurt Your Brain

factorial(0) -> 1;
factorial(N) when N > 0 -> N * factorial(N-1).

See that semicolon vs period? I still fuck this up after 2 years. Mix them up and you get beautiful error messages like:

syntax error before: '.'

Super helpful, right? Semicolons separate clauses, periods end functions. Remember that or prepare for pain.

Variables start with capital letters, atoms with lowercase. This is backwards from every other language and will fuck with your head for months. I still occasionally write User when I mean user and wonder why my pattern matching is broken.

OTP: The Magic You Don't Understand Yet

GenServers are like classes if classes had mailboxes and could crash gracefully. They handle state automatically, which is amazing until your server gets stuck in an infinite loop processing the same message forever.

Supervisors restart your crashed processes, but the strategy matters. I learned this around 3am when I used one_for_all instead of one_for_one and crashed our entire user session cluster. One broken authentication process took down maybe 15k connected users. Took the system half an hour to restart everything and users were pissed.

The error I got? Just this helpful message:

=SUPERVISOR REPORT==== 11-Sep-2024::03:xx:xx ===
supervisor: {local,session_sup}
errorContext: shutdown_error
reason: reached_max_restart_intensity

"Reached max restart intensity" - gee thanks, super specific.

Performance Reality Check

Performance Scaling Architecture

WhatsApp's numbers came after years of optimization and custom kernel tuning. Your first Erlang app will not handle 450 million users. Mine crashed at 10k concurrent connections because I didn't configure TCP buffer sizes properly.

Ignore those synthetic benchmarks claiming millions of messages per second. In production with real JSON payloads and database calls, expect maybe 15-30k messages/second if you're good at this. Network I/O kills performance way before the BEAM VM gives up.

The BEAM Ecosystem (Choose Your Poison)

BEAM Languages Ecosystem

  • Elixir: Same VM, readable syntax. Use this instead of Erlang unless you hate yourself.
  • Gleam: Types everywhere, still too young for production. Check back in 2027.
  • LFE: Lisp on BEAM. For people who think Erlang syntax isn't confusing enough.

Learning Curve From Hell

Expect 6+ months of pain. I've seen Java developers quit after a week because immutable variables broke their brains. Learn You Some Erlang is good but won't prepare you for production debugging nightmares.

Real war story: Spent 3 days debugging why messages weren't being processed. Turns out I was sending to user_manager when the process was registered as users_manager (note the 's'). The error?

** exception exit: {badarg,[{gen_server,call,[user_manager,get_user,5000],[{file,"gen_server.erl"},{line,261}]}]}

Just says "bad argument" - super helpful. You'll learn to trace everything with :dbg or go insane.

Questions People Actually Ask (And Honest Answers)

Q

Why the fuck do Erlang variables start with capital letters?

A

Because Joe Armstrong liked Prolog syntax and decided everyone else should suffer too. Atoms are lowercase, variables are Uppercase. This will mess with your head for months if you're coming from literally any other language. I still catch myself writing user instead of User and wondering why pattern matching fails.

Q

How many processes can it really handle?

A

Millions, theoretically. I've personally run 100k processes on my Mac

Book

  • the BEAM scheduler is genuinely impressive. Each process eats about 2.6KB, so on a 16GB machine you can theoretically spawn ~6 million before running out of memory. But good luck debugging that mess.
Q

How available are Erlang developers?

A

Good luck finding Erlang developers. They're rarer than parking spots in San Francisco and cost twice as much. Most companies just train their existing devs or use Elixir instead because the talent pool is slightly less microscopic.

Q

What's the difference between Erlang and Elixir, really?

A

Same engine, different paint job. Elixir looks like Ruby, Erlang looks like a math theorem.

Both compile to identical BEAM bytecode, so performance is exactly the same.

Just learn Elixir

Q

The learning curve - is it as bad as everyone says?

A

Erlang Learning Curve VisualizationYes. It's fucking brutal. I spent 2 weeks confused why variables don't change after you assign them. Then another month getting supervisor strategies wrong and crashing production. Pattern matching will make you question your career choices.Expect 6 months of feeling stupid before things click. The "let it crash" philosophy feels backwards when you've spent years writing defensive code.

Q

What sucks about Erlang?

A

Everything that doesn't involve concurrency. CPU-intensive single-threaded work? Go destroys it. Machine learning? The ecosystem is pathetic compared to Python. Web development? Just use Phoenix (Elixir) or you'll hate your life.The tooling is ancient. Error messages are cryptic. Documentation assumes you have a PhD in distributed systems. And good luck explaining to your manager why you want to rewrite everything in a functional language they've never heard of.

Q

Can you really achieve zero downtime?

A

Theoretically yes, practically you'll still fuck it up. Hot code reloading works until you update the wrong module and suddenly your system thinks all user sessions are undefined.I once watched a hot reload take down an entire cluster because someone updated a critical supervisor. The docs say it's "safe" but always test that shit on staging first. Zero downtime is possible, but zero mistakes isn't.

Q

Why does my Erlang app eat memory like Chrome?

A

Each process gets its own heap, which means memory usage scales linearly with process count.

I once had a chat app where every user session was a process

  • 50k users = 50k processes = 128MB of just process overhead. That's before your actual data. Use observer:start() to watch your memory usage in real-time and prepare to be horrified.
Q

What kind of performance can I expect?

A

Forget those bullshit synthetic benchmarks. In production with database writes and proper JSON parsing, I usually see 5-20k messages/second depending on payload size. For CPU-heavy single-threaded work, Go will destroy Erlang.But for concurrent network I/O? Nothing touches the BEAM VM's lightweight processes.

Essential Erlang/OTP Resources

Related Tools & Recommendations

tool
Similar content

Gleam: Type Safety, BEAM VM & Erlang's 'Let It Crash' Philosophy

Rust's type safety meets Erlang's "let it crash" philosophy, and somehow that actually works pretty well

Gleam
/tool/gleam/overview
100%
howto
Similar content

Getting Started with Gleam: Installation, Usage & Why You Need It

Stop writing bugs that only show up at 3am in production

Gleam
/howto/gleam/overview
92%
review
Similar content

RabbitMQ Production Review: Real-World Performance & Costs

What They Don't Tell You About Production (Updated September 2025)

RabbitMQ
/review/rabbitmq/production-review
57%
tool
Similar content

Gleam Production Deployment: Docker, BEAM Releases & Monitoring

Stop wondering how the hell to actually deploy a Gleam app. Here's how to get your shit running in production without losing your sanity.

Gleam
/tool/gleam/production-deployment
50%
news
Recommended

Google Avoids $2.5 Trillion Breakup in Landmark Antitrust Victory

Federal judge rejects Chrome browser sale but bans exclusive search deals in major Big Tech ruling

OpenAI/ChatGPT
/news/2025-09-05/google-antitrust-victory
50%
compare
Recommended

Python vs JavaScript vs Go vs Rust - Production Reality Check

What Actually Happens When You Ship Code With These Languages

go
/compare/python-javascript-go-rust/production-reality-check
50%
news
Recommended

Google Avoids Breakup, Stock Surges

Judge blocks DOJ breakup plan. Google keeps Chrome and Android.

go
/news/2025-09-04/google-antitrust-chrome-victory
50%
integration
Recommended

Temporal + Kubernetes + Redis: The Only Microservices Stack That Doesn't Hate You

Stop debugging distributed transactions at 3am like some kind of digital masochist

Temporal
/integration/temporal-kubernetes-redis-microservices/microservices-communication-architecture
48%
tool
Recommended

PostgreSQL Performance Optimization - Stop Your Database From Shitting Itself Under Load

integrates with PostgreSQL

PostgreSQL
/tool/postgresql/performance-optimization
33%
tool
Recommended

PostgreSQL WAL Tuning - Stop Getting Paged at 3AM

The WAL configuration guide for engineers who've been burned by shitty defaults

PostgreSQL Write-Ahead Logging (WAL)
/tool/postgresql-wal/wal-architecture-tuning
33%
integration
Recommended

FastAPI + SQLAlchemy + Alembic + PostgreSQL: The Real Integration Guide

integrates with FastAPI

FastAPI
/integration/fastapi-sqlalchemy-alembic-postgresql/complete-integration-stack
33%
howto
Similar content

Build REST APIs in Gleam That Don't Crash in Production

Build robust, crash-resistant REST APIs with Gleam. Learn Gleam setup, HTTP server creation, PostgreSQL integration, and graceful error handling for production-

Gleam
/howto/setup-gleam-production-deployment/rest-api-development
32%
tool
Popular choice

jQuery - The Library That Won't Die

Explore jQuery's enduring legacy, its impact on web development, and the key changes in jQuery 4.0. Understand its relevance for new projects in 2025.

jQuery
/tool/jquery/overview
32%
integration
Popular choice

Sync Notion with GitHub Projects Without Losing Your Mind

Your dev team uses Notion for planning and GitHub for actual work. Keeping them in sync manually is a special kind of hell.

Notion
/integration/notion-github-projects/bidirectional-sync-architecture
30%
troubleshoot
Recommended

Docker Desktop Won't Install? Welcome to Hell

When the "simple" installer turns your weekend into a debugging nightmare

Docker Desktop
/troubleshoot/docker-cve-2025-9074/installation-startup-failures
30%
howto
Recommended

Complete Guide to Setting Up Microservices with Docker and Kubernetes (2025)

Split Your Monolith Into Services That Will Break in New and Exciting Ways

Docker
/howto/setup-microservices-docker-kubernetes/complete-setup-guide
30%
troubleshoot
Recommended

Fix Docker Daemon Connection Failures

When Docker decides to fuck you over at 2 AM

Docker Engine
/troubleshoot/docker-error-during-connect-daemon-not-running/daemon-connection-failures
30%
tool
Popular choice

OpenAI API Enterprise - The Expensive Tier That Actually Works When It Matters

For companies that can't afford to have their AI randomly shit the bed during business hours

OpenAI API Enterprise
/tool/openai-api-enterprise/overview
29%
howto
Popular choice

Migrate JavaScript to TypeScript Without Losing Your Mind

A battle-tested guide for teams migrating production JavaScript codebases to TypeScript

JavaScript
/howto/migrate-javascript-project-typescript/complete-migration-guide
28%
integration
Recommended

OpenTelemetry + Jaeger + Grafana on Kubernetes - The Stack That Actually Works

Stop flying blind in production microservices

OpenTelemetry
/integration/opentelemetry-jaeger-grafana-kubernetes/complete-observability-stack
27%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization