r/erlang • u/Shoddy_One4465 • 14h ago
r/erlang • u/ancatrusca0 • 21h ago
Three years of uptime, then dust on the disk
An AXD 301 ATM switch carrying international trunks ran three years with no reboot. Upgrading meant rebooting the active node. It never came back, and neither did the standby when they repeated the upgrade there. The boot sector sat on the outer disk edges, where the head hadn't moved in three years and dust had settled. One-week outage, 6–7M subscribers without international calls. The fix: nightly head sweeps across the whole disk.
Francesco Cesarini's takeaway: if support engineers never firefight, they don't know where to look when it matters.
https://youtu.be/rPbLWY_393I
LiteGate – self-hosted OpenAI/Anthropic gateway in Erlang with failover, plan-aware routing and prompt-cache stickiness
github.comLiteGate is a self-hosted LLM API gateway written in Erlang/OTP. It gives your tools a single endpoint that speaks both the OpenAI and Anthropic API formats, and behind that endpoint you can mix as many providers, credentials and models as you like. Point Claude Code, Codex, opencode or any OpenAI/Anthropic SDK at it, give each client its own gateway key, and LiteGate decides where every request actually goes.
Routing that understands quotas
A route is a public model name that clients ask for. Each route has a list of targets (a credential plus an upstream model), grouped by priority. If a target hits a rate limit, times out, returns a 5xx or runs out of quota, the request falls back to the next one, including streaming requests as long as nothing has been sent to the client yet. 、
Within a priority group you can choose from six strategies: weighted random, in order, rotate by session count, or three that use your subscription plan data. LiteGate tracks the usage windows of coding plans such as GLM Coding Plan, Kimi Code and MiniMax Token Plan, so it can prefer the plan that resets soonest, or spread usage evenly across the week. Pay-as-you-go balances are tracked too.
Session stickiness keeps a conversation on the credential that has already answered it, so the upstream prompt cache keeps getting hit. A turn is never split, and a new turn moves elsewhere only when the cache is no longer worth keeping.
Rules run before target selection. They can reroute a request based on prompt size, images, reasoning, client format, tags, time of day, or intent. Intent is classified by a small decision model, with a circuit breaker so a flaky classifier never blocks traffic.
Staying polite to upstreams
When providers start returning 429s, an adaptive AIMD throttle lowers the outbound request rate and recovers it slowly. Failed credentials get cooldowns based on the failure type, honoring Retry-After and plan reset times. Per-credential concurrency limits queue excess requests instead of failing them. Long streams get keepalives, and a repeat detector stops a model that is stuck in a loop.
Control and safety
- API keys with route allowlists, plus rate limits and budgets per key, per user or per tag
- Admin and regular user roles; regular users see only their own keys, logs and usage
- Redaction of secrets and personal data before requests leave your network
- Middleware hooks on requests, stream events and responses, with built-ins (model mapping, parameter overrides, system prompts, word guard, remote hooks) and plugin support
- Upstream keys encrypted at rest, plus scheduled, encrypted config backups
Seeing what happened
Every request log includes a plain-language decision narrative: which rule matched, why stickiness held or broke, which targets were tried and why each one failed. On top of that you get session views, a live routing view, usage and cost by model, key and user, Prometheus metrics, OTLP trace export (Langfuse works), and alerts to webhooks, Feishu, DingTalk or WeCom for upstream outages, budgets, plan quotas, low balances and login brute force.
The React console covers all of this, including a Playground for testing chat, protocol conversion, images and speech. It now ships in English and Chinese.
Under the hood
Cowboy serves requests, Gun talks to upstreams, Mnesia holds configuration, and Bitcask (via a C++ NIF) stores logs, conversations and usage rollups. Erlang's supervision trees fit a gateway well: many concurrent streams, each in its own process, and one misbehaving upstream can't take the others down. It runs as a single release or a Docker container, and it's Apache-2.0 licensed.
Feedback is very welcome, especially from anyone running several coding plans or providers side by side.
r/erlang • u/Interesting_Meat_964 • 2d ago
ElixirConf EU 2027 (Lisbon & Virtual, 22-23 April): new website and Call for Talks open until 15 December
Hi everyone,
We have just launched a new website for ElixirConf EU 2027: https://www.elixirconf.eu
When and where: Lisbon & Virtual
- 21 April 2027: Training day
- 22-23 April 2027: Conference
Call for Talks is open until 15 December. Got something to share with the Erlang and BEAM community? Submit your talk here: https://sessionize.com/elixirconf-eu-2027/ (tips on speaking: https://www.elixirconf.eu/speak)
Super Early Bird waiting list. Join to be the first to hear when tickets go on sale: https://www.elixirconf.eu/#waiting-list
We would love to hear what you think of the new design. There are also a few easter eggs hidden on the site, so we are curious whether you will find them! GL&HF
bitcask: More Than a Key-Value Store, An Embedded Data Engine with Full-Text Search, Vector Retrieval, and Graph Database Capabilities
github.comBitcask — An Introduction
Bitcask is a high-performance, log-structured hash table for fast key/value storage, written in C++23 with an Erlang NIF interface. It goes well beyond a simple KV store: on top of the classic bitcask design it adds BM25 full-text search, approximate nearest-neighbor vector retrieval, RRF hybrid search, transactions with isolation, and even a graph database layer — making it a versatile embedded data engine for Erlang/OTP applications.
Architecture
The implementation is a single C++23 NIF (apps/bitcask/cpp/) behind a thin Erlang facade (bitcask.erl), organized as a rebar3 umbrella project. The on-disk format uses typed records with per-write ordinal numbers and optional DocValue encoding (text + vector + metadata). A separate application, apps/bitcask_cypher/, provides an openCypher graph query language built purely on the core's public API.
Key Capabilities
- Core KV storage — binary keys and values with
put/get/delete/sync, snapshot-consistent iteration viafold, and merge management for reclaiming space. - Ordered range queries (v6.0.0) — lexicographic scans over
[Lo, Hi)at O(range) cost, ideal for prefix scans. - Atomic batches & multi-key transactions —
put_batch_atomicandtxn_commitguarantee that after a crash or power loss a batch either fully applies or not at all, with optional preconditions (absent | {ord, N}) for optimistic concurrency control. - Isolated transactions (
bitcask_txn, v6.5.1) — a pure-OTP layer adding pessimistic two-phase locking, deadlock detection, automatic restart, prefix locks (phantom-free scans), and idempotency keys that make mid-commit crashes safely retryable — a single-node analogue of Mnesia's model. - BM25 full-text search — pluggable analyzers (whitespace, CJK n-gram, jieba Chinese segmentation), plus phrase, fuzzy (edit-distance), wildcard, proximity, and field-boosted search, with synonym dictionaries and highlight support.
- Vector search — three selectable engines:
hnsw(in-memory graph, up to a few million vectors),ivfrq(IVF-RaBitQ disk tier, recommended for 10M–100M), anddiskann(experimental Vamana graph). Embeddings can be fetched automatically from OpenAI-compatible HTTP endpoints or computed in-process via an optional llama.cpp backend (with CUDA/Vulkan GPU support), including Matryoshka (MRL) dimension truncation. - Hybrid search — RRF fusion of BM25 and vector ranking signals in a single query.
- Graph layer (
graphdb) — vertices and packed adjacency lists stored as KVs, with conditional writes so concurrent edge writers lose no edges, plus transactional graph operations, BFS/shortest-path traversal, and analytics (PageRank, connected components, SSSP). - Structured query DSL (
bitcask_query) — combines key conditions, full-text conditions, and meta filters in one query, with a planner that picks the driving index, plus secondary indexes.
Performance Highlights
Recent releases show aggressive optimization: point-read hits through the NIF dropped from 1.3–2.0 µs to 0.26–0.73 µs; graph one-hop reads went from 110 ms to 0.078 ms; put_edge on a 200k-degree hub improved from 255 µs to 20 µs; and del_vertex on a hub went from O(degree²) to linear (450 s → 2.1 s). The engine also offers a disk-resident keydir option cutting resident memory by ~90% at 100M keys.
Getting Started
The project builds with rebar3 compile (Erlang ≥ 22, plus the ICU development package), and can be used as a git_subdir dependency from any rebar3 project. C++ tests (400+ GoogleTests), sanitizers, and benchmarks are driven by CMake.
License
Apache 2.0.
Web development with Nova, Kura, Shigoto and Arizona
novaframework.github.ioThis is book is showing how you can work with Nova, Arizona, Kura and Shigoto. Similar stack as Elixir:s Phoenix, liveview, Ecto and Oban.
r/erlang • u/git-pull • 12d ago
libtmux-erlang 0.1: tmux client library for Erlang / BEAM
github.comHi all, I maintain libtmux, the Python library for tmux. I've been bringing the same sessions, windows and panes to Erlang. The core application is on Hex; it's still an early release.
It wraps tmux's CLI. Here I'm starting a server, finding a pane, sending some text and checking its screen. There's also an operation you can start and await separately, including a wait that times out while the work remains pending.
Compared with the released Python library, this has owned asynchronous operations, explicit cancellation, and query plans you can inspect before fetching. The objects are still tmux's sessions, windows and panes. I'm interested in how that fits Erlang's processes and ownership model.
A word on AI: It's experimental, and I used LLMs extensively to create this. Parts of this post were also drafted and tested with AI. My AI policy has more on that.
libtmux_erlang: tmux from Erlang
Hex · GitHub · Docs · API · Installation guide
Use a current Erlang/OTP 29 release, Rebar3, Linux and tmux 3.3a–3.8. Native records are experimental in OTP 29. You'll also need make and a C11 compiler. Installation builds an external helper for owning and retiring subprocesses; it isn't a NIF.
Start in an empty directory. Save as rebar.config; Rebar3 resolves this from Hex:
.
Keep the resulting rebar.lock to retain the resolved package version and checksum.
Save as demo.erl. with_owned (source) starts a separate daemon and checks its cleanup, including when the callback raises.
&&
demo / editor / build
output: build: complete
tmux_select:where (source) filters the captured graph. It doesn't contact tmux again. The pane example sends text to cat and reads the terminal's screen; it isn't isolated command stdout. Other clients can contribute output in a shared pane.
P.S. Change the window query from <<"editor">> to <<"editor2">>, keeping the creation name as it was. Compile and run it again. one_or_error raises:
no_match
one (source) instead returns a tagged result when you'd rather handle that branch yourself.
There is one core OTP application here. Persistent control attachments currently establish identity and manage the client lifetime. Sending commands and streaming pane output through that connection are still implementation work.
Query chaining and source plans
where (source) adds conditions to an immutable query. explain does no I/O; fetch is the point where the reads happen.
Save as query_demo.erl:
&&
native candidate filtering: true
hydration: complete_graph
active editor panes: 1
Native filtering is opt-in. It can add a candidate scan; the full graph is still read and the complete predicate is checked locally. So I wouldn't describe this as fewer subprocesses. Text and relationship conditions stay local, and reads of a changing server aren't atomic. The current snapshot path groups fields into framed entity scans; that is separate from grouping mutation commands.
Submit an operation, then await it
tmux_operation lets a process keep an operation handle while it does other work. An await timeout ends that wait, not the operation. This uses tmux's wait-for signal so there's something specific to await.
Save as operation_demo.erl:
&&
wait: pending; operation retained
signal: received; client cleaned up
This proves that the signal arrived. It doesn't prove a build ran: a real job needs to send its own completion signal and provide whatever result you need to check. Operations currently use bounded one-shot clients. Cancellation can leave an already-sent command's outcome unknown.
Control connection lifetime
The current control API owns an attachment and checks identity on that connection. It doesn't yet offer command submission or an output-event stream. Save as control_demo.erl:
&&
attached clients: 1
control client: closed
The attachment is closed before its parent server. We own this server and its session; attaching to somebody's existing session can also trigger their configured hooks.
I'd be interested in feedback on the operation handles and cleanup API from people using Erlang.
Related, I also released an elixir package for tmux as well!
r/erlang • u/ancatrusca0 • 14d ago
Should an agent be a process or a data structure?
In Jido 2.0, an agent is a validated struct and the process is a separate layer. Mike Hostetler got there after two early mistakes. The first was a private queue in GenServer state that let actions skip ahead of the mailbox. The second was making every agent a DynamicSupervisor.
Now the top-level GenServer only takes in a signal, hands the work to short-lived tasks and child processes, and saves the result back to its state. He also tried OTP 28 priority messages for reentrancy, and that work is feeding into Jido 3. Francesco compares the 2.0 rewrite to the first OTP release, where only the behaviours that cleanly separated the generic from the specific lasted.
r/erlang • u/Shoddy_One4465 • 15d ago
F3 file format for Beam languages
I've started following the F3 project. F3? It's a columnar research file format: the file stores columns, and a footer at the end holds an Arrow schema plus where those columns live. A file can also embed a Wasm decoder next to the data. The spec is still a prototype. This library speaks wire version 0.1 only.
I published f3 0.1.0 so you can open one of those files from Elixir, print the schema and footer, and read or write rows when the native decoder is loaded. Wasm stays off unless a read passes wasm: :sandbox, which runs that embedded module in a Wasmtime sandbox. A Hex install downloads precompiled builds for Apple silicon and Linux x86_64.
The longer version is in my write-up. The API is on Hexdocs, and the code is on GitHub.
I compiled Gleam's BEAM bytecode to WebAssembly so it runs on edge workers
afterglow is a compiler I've been writing. It compiles BEAM bytecode to WebAssembly ahead of time and links it with a small runtime written in Rust, so a Gleam app built for the Erlang target runs as an edge worker. It's experimental and runs a subset of OTP. Repo (GPL-3.0): https://github.com/withgiolt/afterglow · docs: https://docs.giolt.com/afterglow/about · live example: https://gote.giolt.app
Against the same app on Erlang/OTP 28, on one machine: startup 8.6 ms vs 175 ms, memory 0.5 MiB vs 29.9 MiB, and a warm request 10.7 µs vs 3.4 µs, so it's slower once warm. The script that reproduces this is in the repo.
Missing today: ETS, regular expressions, crypto hashing, and processes that outlive a request. You know the BEAM better than I do, so I'd like to hear which parts of OTP you'd expect to need first, and where my approach is naive. If you'd rather fix one than tell me, the build lists the missing functions, and PRs are very welcome.
And a broader question: afterglow works on BEAM bytecode, not Gleam source, so plain Erlang apps aren't out of reach. Would you deploy an Erlang app this way, and what kind? It's a question, not a promise.
I built it for Giolt, my host for Gleam apps (waitlist: https://giolt.com/waitlist).
r/erlang • u/Interesting_Meat_964 • 16d ago
Call for Talks and Call for Training for ElixirConf EU 2027 (Lisbon, 22-23 April), BEAM topics welcome
Hi all!
ElixirConf EU takes place in Lisbon and online on 22-23 April 2027, with a training day on 21 April. The Call for Talks and the Call for Training are open until 15 December.
Talk topics are not limited to Elixir code. If you work with Erlang/OTP or the wider BEAM (runtime, OTP design, tooling, production stories, distributed systems), a proposal is welcome. We have two tracks with 20- and 40-minute slots: https://sessionize.com/elixirconf-eu-2027/
We are also looking for trainers for a full-day Elixir or BEAM training on 21 April: https://forms.gle/YY3cJJpt9fYaMPQ46
Event site: https://www.elixirconf.eu/
Questions are welcome in the comments :)
r/erlang • u/ancatrusca0 • 28d ago
What does a 33.3 ms tick do to an Erlang timer?
It rounds to 33. Hernán Rivas Acosta's multiplayer game AstroBeam ran a 30 Hz server tick on a timer that only accepts whole milliseconds, and the drift showed up as lag that grew steadily through each match. Short playtests hid it completely. Moving to 40 Hz, a clean 25 ms, fixed it.
Also from the conversation: his first Erlang game server, around 2010, held 50,000 concurrent TCP connections per machine, limited only by file descriptors; the Java option would have managed a few thousand. And he chose WebAssembly over a NIF so a simulation crash kills one match process, not the node.
r/erlang • u/crowdhailer • Oct 21 '26
https://eyg.run/guides/embedding-eyg-in-erlang-programs
r/erlang • u/Comfortable_Meat_524 • Oct 20 '26
Code Beam Europe 2026
Code BEAM Europe 2026 starts tomorrow.
On Wednesday 21 and Thursday 22 October, the Erlang, Elixir and Gleam communities meet at PHIL in Haarlem and online for two days and two tracks of talks.
This year's programme covers:
- Type systems: José Valim on set-theoretic types, Roberto Aloi (WhatsApp) on Erlang typing in the prompt era
- AI and the runtime: finding vulnerabilities with AI, and whether language or runtime matters more when AI writes the code
- Production stories: distributed Elixir at NetzeBW, self-healing systems, ATProto on Elixir
- The runtime itself: Native Records from the OTP team, BeamAsm JIT on ARM32, AtomVM
- Keynotes from Sam Aaron, José Valim and Brooklyn Zelenka
Not in Haarlem? Join online with 15% off a virtual ticket using code 15FORYOU.
Your virtual ticket includes:
- Both tracks live, on both days
- Live Q&A with speakers
- Online networking through the conference app
- 3 months of exclusive access to the recordings
Tickets: https://codebeameurope.com/#register
See you tomorrow!
r/erlang • u/0xjnml • Oct 19 '26
Running a subset of Erlang/Elixir on bare metal - Parallax Propeller 2
First preview with pre-built binaries available at https://github.com/modernc-org/obeam
BSD-3 License
r/erlang • u/Neustradamus • Oct 16 '26
ejabberd 26.09 / ProcessOne - Erlang Jabber/XMPP/Matrix Server - Communication
process-one.netr/erlang • u/ancatrusca0 • Oct 16 '26
The BEAM Book came from a production outage caused by a function that used only 20 reductions - what does that tell us about reduction accounting?
New BEAM There, Done That with Erik Stenman (Happi) - Erlang researcher since 1994, BEAM Book author, former architect of Klarna's payment core.
The scar is worth dissecting for this community: on Christmas Eve, Klarna's BEAM scheduler throttled to a single active scheduler due to low overnight traffic. A large batch job arrived. An XML-to-binary serialization function used only 20 reductions per call regardless of input size. It ran on the single scheduler, never yielded, and Heart (the external watchdog process) couldn't get a response from the VM. Heart killed the system. The failover node hit the same condition. So did the third. Half-hour outage on Christmas Eve.
The fix required going deep into runtime behavior - understanding the relationship between reductions, yielding, and scheduler availability under load. That diagnostic process is directly what motivated the BEAM Book.
The current work (Eldrim - sovereign AI compute routing) applies the same principle at a different layer: you need to know where resources actually run, not where you've been told they run.
r/erlang • u/Interesting_Meat_964 • Oct 07 '26
Code BEAM Europe 2026 (21-22 Oct, Haarlem + online): OTP team update, Native Records, doctests, WhatsApp on Erlang DevX
Disclosure: I'm on the Code BEAM Europe organising team. The programme is final and there's a lot of Erlang in it this year.
From the Erlang/OTP team
- Update from the OTP Team and Native Records (Björn Gustavsson)
- Exploring Doctests in Erlang (Lukas Backström)
- Do the List Shuffle (Raimo Niskanen)
More Erlang
- Still Typing Erlang? Developer Experience in the Prompt Era (Roberto Aloi, WhatsApp)
- Idiomatic Erlang: Tips for Erlang Beginners (Brujo Benavides)
- Structuring Erlang Code with Application-Level Visibility (Erik Stenman)
- The Erlang Ecosystem Frontier: Our Work Ahead (Dan Janowski)
- Exploring Audio, Music, and Erlang (Cara Superlativo and Ellyse Cedeno)
- Updates from the AtomVM Landscape (Davide Bettio)
Tutorial on 20 October: Gnome Village: Understanding the BEAM Through Processes, Flows, and Runtime Behaviour, a full day with Erik Stenman (author of The BEAM Book) and Måns af Klercker.
Informal Space: the community-run third room includes an open ELP clinic. Bring your own project and the tool authors will help you set it up. See the lineup
Practical
- PHIL in Haarlem, 15 minutes by train from Amsterdam Centraal
- Online ticket €146 + VAT with recordings
Programme and tickets: codebeameurope.com
r/erlang • u/MagnusSedlacek • Sep 24 '26
WebAssembly on the BEAM: Building erlang_wasm in Erlang by Benoit Chesneau at Func Prog Sweden
youtube.comr/erlang • u/Shoddy_One4465 • Sep 21 '26
Just released Rheo a broker less consumer group library
reddit.comr/erlang • u/Interesting_Meat_964 • Sep 18 '26
The Schedule | Code BEAM Europe 2026!
galleryHey everyone, the full Code BEAM Europe 2026 schedule is up! Two days, two tracks, 21-22 October in Haarlem (and online), with a training day on 20 October.
One update worth flagging: Frank Hunleth and Omer Kilic won't be giving keynotes this year, but José Valim is stepping in with a keynote, "Set-Theoretic Types from Scratch," and he is sticking around for extended Q&A, so bring your questions. Alongside José, we have Sam Aaron (twice, including the interactive Phone Orchestra evening session) and Brooklyn Zelenka closing things out.
Check the full schedule here: codebeameurope.com/#schedule
Come for the talks, stay for the hallway track. Use the code 10FORYOU and get additional -10% off your ticket! Register for the event here: codebeameurope.com/#register
See you there!