WyvernoDragon

WyvernoDragon

I’ve been working on pgRx: a query engine that uses BEAM lightweight processes instead of PostgreSQL’s fork-per-connection model.

The numbers: 50 idle connections cost PostgreSQL 729MB additional memory. On pgRx it’s 0KB. Hibernated BEAM processes drop to ~400 bytes each.

How it works:

  • Each connection is a GenServer (~2KB active, hibernated to
    ~400 bytes when idle)
  • SQL parsing and execution happens in a Rust NIF via
    pg_query (the same parser PostgreSQL uses)
  • Shared state via RwLock — no per-connection data
    duplication
  • Wire protocol v3 implemented — psql connects without
    changes

What works today: JOINs (all types), subqueries, aggregates, GROUP BY, HAVING, ORDER BY, INSERT/UPDATE/DELETE with RETURNING, prepared statements.

The thesis: PostgreSQL’s process-per-connection model is essentially a worse version of BEAM’s actor model. OpenAI runs 800M ChatGPT users on a single PostgreSQL and has already hit connection storms causing outages. The architecture hasn’t changed since 1986. BEAM was built for exactly this problem at Ericsson - millions of concurrent isolated processes.

GitHub:

https://github.com/JagritGumber/pgrx

Demo site:

Would love to know the parts that have been annoying you, so I can fix them with this iteration.

Where Next? Top

Trending in RFCs Top

nikolis
BeamScope Why I created this: Needed some very particular metrics regarding the state of my Elixir cluster in a relatively small project...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews