Currently viewing the AI version
Switch to human version

Erlang/OTP: AI-Optimized Knowledge Base

Overview

Erlang/OTP is a functional programming language designed for high-concurrency, fault-tolerant systems. Originally developed by Swedish telecom engineers in the 1980s for phone switches where downtime costs millions per minute.

Process Model & Performance Characteristics

Process Specifications

  • Process Cost: 2.6KB RAM per process
  • Theoretical Limit: Millions of processes (scheduler-limited in practice)
  • Production Reality: 100k processes commonly achievable
  • Isolation: Complete memory isolation between processes
  • Failure Mode: Process crashes don't affect other processes

Performance Benchmarks & Limitations

  • Synthetic Benchmarks: Claims of millions of messages/second
  • Production Reality: 5-30k messages/second with real JSON payloads
  • Bottleneck: Network I/O limits performance before VM limits
  • Memory Usage: Scales linearly with process count (50k processes = 128MB overhead)

Critical Installation & Setup Issues

Platform-Specific Failure Modes

Platform Common Failures Solution Version Issues
Linux libssl1.1 vs libssl3 dependency conflicts Use OTP 25.2 or 26+ Ubuntu 22.04: OTP 25.3 breaks SSL randomly
macOS M1 "Bad CPU type in executable" Use native ARM build OTP 24.x has threading issues on Apple Silicon
Windows PATH variables, command not found Use WSL instead OTP 27+ has better native support

Shell Environment Risks

  • REPL Crashes: Frequent crashes with syntax errors
  • Process Spawning: Spawning millions of processes can lock REPL session
  • Recovery: Always keep backup shell open

Language Syntax & Common Pitfalls

Critical Syntax Rules

  • Function Termination: Semicolons separate clauses, periods end functions
  • Variable Naming: Variables start with capital letters, atoms with lowercase
  • Pattern Matching: Backwards from other languages

Common Error Messages & Causes

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

Cause: Usually misspelled variable or missing period

syntax error before: '.'

Cause: Mixed up semicolons and periods

OTP Framework Components & Failure Modes

GenServers

  • Function: State management with message passing
  • Failure Mode: Can get stuck in infinite loops processing same message
  • Recovery: Supervisor restarts required

Supervisors

  • Restart Strategies:
    • one_for_one: Restart only failed process
    • one_for_all: Restart all processes (dangerous in production)
  • Critical Failure: Wrong strategy can crash entire cluster
  • Production Impact: 15k users disconnected from authentication process failure

Hot Code Reloading

  • Capability: Update production code without stopping system
  • Risk: State format changes can corrupt all user sessions
  • Best Practice: Always test on staging first
  • Failure Recovery: 30+ minutes to restart all processes

Real-World Performance Case Studies

WhatsApp Success Metrics

  • Scale: 32 engineers handled 450 million users (14M users per engineer)
  • Reality Check: Achieved after years of optimization and custom kernel tuning
  • Acquisition: Sold to Facebook for $19 billion

Production Deployment Examples

Company Use Case Technical Details
Goldman Sachs High-frequency trading Millisecond delays cost millions
CouchDB Database engine Entire database written in Erlang
Discord Message fanout Switched from Go due to GC latency spikes

Development Environment & Tooling Issues

Error Debugging Complexity

  • Process Communication: Silent failures when sending to wrong process name
  • Debug Time: 3 days debugging user_manager vs users_manager typo
  • Error Message: "bad argument" without specific cause
  • Solution: Use :dbg for message tracing

Memory Management Reality

  • Linear Scaling: Memory usage = process count × 2.6KB + actual data
  • Monitoring Tool: observer:start() for real-time memory tracking
  • Production Example: Chat app with 50k users = 128MB process overhead

Ecosystem & Alternative Languages

BEAM VM Languages

  • Elixir: Same performance, readable syntax, better ecosystem
  • Gleam: Type safety, too immature for production (check 2027)
  • LFE: Lisp syntax on BEAM, academic interest only

Learning Curve & Resource Requirements

  • Time Investment: 6+ months to proficiency
  • Developer Availability: Extremely rare, expensive talent
  • Quit Rate: High among developers from imperative languages
  • Training Cost: Professional training expensive but necessary

Comparative Analysis

Aspect Erlang Strength Limitation Alternative
Concurrency Millions of lightweight processes CPU-intensive work suffers Go for single-threaded performance
Fault Tolerance Isolated process failures Still requires proper supervision design Traditional exception handling
Hot Deployment Zero-downtime updates possible State corruption risk Blue-green deployments
Web Development Phoenix framework (Elixir) Ancient tooling in pure Erlang Node.js, Go frameworks

Critical Warnings & Production Pitfalls

What Official Documentation Doesn't Tell You

  • Default Settings: Will fail in production without tuning
  • TCP Buffer Sizes: Must configure properly for high connection counts
  • Supervisor Max Restart Intensity: Easily exceeded during cascading failures
  • Process Registry: Typos in process names cause silent message loss

Breaking Points & Failure Modes

  • Connection Limits: 10k concurrent connections without TCP tuning
  • Message Processing: Degrades with large JSON payloads
  • Memory Exhaustion: Linear scaling with process count
  • Hot Reload Risks: Wrong module updates can crash entire clusters

Resource Requirements

Time Investment

  • Initial Learning: 2 weeks to understand basic syntax
  • Production Readiness: 6+ months of experience required
  • Debugging Proficiency: Additional 6 months for complex system debugging

Expertise Requirements

  • Distributed Systems Knowledge: Essential for supervisor tree design
  • Functional Programming Background: Helpful but not required
  • Telecom/Network Experience: Beneficial for understanding design philosophy

Infrastructure Costs

  • Memory Requirements: Higher baseline due to process overhead
  • Developer Salaries: 2x premium for experienced Erlang developers
  • Training Investment: Professional training recommended for teams

Essential Learning Resources

Primary Documentation

Community Support

Development Tools

Decision Framework

Choose Erlang/OTP When:

  • Massive concurrency requirements (100k+ connections)
  • Fault tolerance is critical (telecom, financial systems)
  • Message-passing architecture fits problem domain
  • Team has 6+ months for learning curve

Avoid Erlang/OTP When:

  • CPU-intensive single-threaded work required
  • Rapid prototyping needed
  • Limited developer availability
  • Machine learning or data science workloads

Success Factors

  • Proper supervisor tree design
  • Understanding of "let it crash" philosophy
  • Investment in team training
  • Realistic performance expectations (not synthetic benchmarks)

Useful Links for Further Investigation

Essential Erlang/OTP Resources

LinkDescription
Erlang.orgOfficial website and downloads. Where you'll download OTP 28.0 and immediately regret not checking if it breaks your existing code first.
Erlang DocumentationOfficial docs (good luck). Comprehensive but assumes you already know distributed systems. Written by academics for academics.
OTP Design PrinciplesHow to not crash everything. Actually essential reading. The supervision tree concept will save your ass in production.
GitHub RepositorySource code and bugs. Where you'll spend hours reading source code to understand why your error message says "bad argument".
Learn You Some ErlangBest tutorial available. Actually good. Funny, practical, and won't make you want to quit programming. Start here.
Erlang Solutions TrainingProfessional training. Expensive but worth it if your company is serious about adoption. Cheaper than hiring consultants later.
Programming Erlang (Book)By the language creator. Joe Armstrong explains the "why" behind the weirdness. Good for understanding the philosophy.
Erlang ForumsWhere you'll ask for help. Friendly community that won't judge you for basic questions. Much better than Stack Overflow for Erlang.
Erlang Central (Medium)Decent blog posts. Hit or miss quality, but occasionally you'll find gems that explain things the official docs don't.
Erlang Slack CommunityReal-time help. Good for quick questions when you're stuck. More active than you'd expect for a niche language.
ElixirJust use this instead. Same power as Erlang, readable syntax, better ecosystem. Phoenix framework is genuinely good for web dev.
GleamTypes for safety nerds. Interesting but too young for production. Check back in 2027 when the ecosystem matures.
LFE (Lisp Flavoured Erlang)For masochists. If Erlang syntax wasn't weird enough for you. Academic curiosity, not practical.
Rebar3Build tool that works (mostly). Standard build system. Works better than expected but you'll still spend hours fighting dependency hell.
ObserverBuilt-in process monitor. Actually useful GUI tool. Great for watching your system melt down in real-time when you fuck up.
Hex.pmPackage manager. Shared with Elixir ecosystem. Way smaller than npm but the packages that exist are usually solid.
ErlperfActually useful benchmarking. For when you need real performance numbers instead of synthetic bullshit. Well documented.
BEAM Performance ResourcesCurated perf links. Good collection of optimization articles. Better than googling randomly.
Erlang SolutionsExpensive but competent. When your boss demands enterprise support. Pricey but they know their shit.
Erlang Ecosystem FoundationCommunity support. Non-profit trying to keep the ecosystem alive. Deserves your support.
WhatsApp EngineeringHow they actually did it. Real engineering posts about scaling Erlang. Way better than marketing case studies.
Discord EngineeringModern Elixir usage. Good technical posts about using BEAM languages at scale. Actually helpful.
Erlang SecurityCVE updates and patches. Check here when vulnerabilities drop. Usually patched faster than you'd expect.

Related Tools & Recommendations

integration
Recommended

GitOps Integration Hell: Docker + Kubernetes + ArgoCD + Prometheus

How to Wire Together the Modern DevOps Stack Without Losing Your Sanity

go
/integration/docker-kubernetes-argocd-prometheus/gitops-workflow-integration
100%
tool
Similar content

Gleam - Type Safety That Doesn't Suck

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

Gleam
/tool/gleam/overview
83%
tool
Similar content

Gleam Getting Started - Stop Fighting the Type System, Start Building Shit

Start your Gleam journey! Learn how to install Gleam, build robust web applications that don't crash, and move beyond basic tutorials to create real-world proje

Gleam
/tool/gleam/getting-started
78%
compare
Recommended

Rust, Go, or Zig? I've Debugged All Three at 3am

What happens when you actually have to ship code that works

go
/compare/rust/go/zig/modern-systems-programming-comparison
68%
tool
Similar content

RabbitMQ - Message Broker That Actually Works

Discover RabbitMQ, the powerful open-source message broker. Learn what it is, why you need it, and explore key features like flexible message routing and reliab

RabbitMQ
/tool/rabbitmq/overview
59%
tool
Similar content

Gleam Production Deployment - From Local Dev to Live Systems

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
58%
howto
Similar content

Getting Gleam Running

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

Gleam
/howto/gleam/overview
46%
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
45%
howto
Recommended

MySQL to PostgreSQL Production Migration: Complete Step-by-Step Guide

Migrate MySQL to PostgreSQL without destroying your career (probably)

MySQL
/howto/migrate-mysql-to-postgresql-production/mysql-to-postgresql-production-migration
45%
compare
Recommended

PostgreSQL vs MySQL vs MongoDB vs Cassandra vs DynamoDB - Database Reality Check

Most database comparisons are written by people who've never deployed shit in production at 3am

PostgreSQL
/compare/postgresql/mysql/mongodb/cassandra/dynamodb/serverless-cloud-native-comparison
45%
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
45%
tool
Popular choice

Hoppscotch - Open Source API Development Ecosystem

Fast API testing that won't crash every 20 minutes or eat half your RAM sending a GET request.

Hoppscotch
/tool/hoppscotch/overview
43%
tool
Popular choice

Stop Jira from Sucking: Performance Troubleshooting That Works

Frustrated with slow Jira Software? Learn step-by-step performance troubleshooting techniques to identify and fix common issues, optimize your instance, and boo

Jira Software
/tool/jira-software/performance-troubleshooting
41%
howto
Recommended

Stop Docker from Killing Your Containers at Random (Exit Code 137 Is Not Your Friend)

Three weeks into a project and Docker Desktop suddenly decides your container needs 16GB of RAM to run a basic Node.js app

Docker Desktop
/howto/setup-docker-development-environment/complete-development-setup
41%
troubleshoot
Recommended

CVE-2025-9074 Docker Desktop Emergency Patch - Critical Container Escape Fixed

Critical vulnerability allowing container breakouts patched in Docker Desktop 4.44.3

Docker Desktop
/troubleshoot/docker-cve-2025-9074/emergency-response-patching
41%
tool
Recommended

Mongoose - Because MongoDB's "Store Whatever" Philosophy Gets Messy Fast

competes with Mongoose

Mongoose
/tool/mongoose/overview
41%
tool
Similar content

BEAM Virtual Machine - Architecture Deep Dive

Deep dive into BEAM VM architecture, performance, and implementation details. Learn how Erlang's abstract machine handles concurrency and its production reality

BEAM
/tool/beam/vm-architecture
40%
tool
Popular choice

Northflank - Deploy Stuff Without Kubernetes Nightmares

Discover Northflank, the deployment platform designed to simplify app hosting and development. Learn how it streamlines deployments, avoids Kubernetes complexit

Northflank
/tool/northflank/overview
40%
tool
Popular choice

LM Studio MCP Integration - Connect Your Local AI to Real Tools

Turn your offline model into an actual assistant that can do shit

LM Studio
/tool/lm-studio/mcp-integration
38%
troubleshoot
Similar content

Gleam Compilation Errors - Fix Type System Issues & Build Failures

Gleam's compiler errors are better than JavaScript's "undefined is not a function" but they still need translation from compiler-speak to human.

Gleam
/troubleshoot/gleam-compilation-production/compilation-type-errors
37%

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