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

manuel-rubio
There was some time when I started thinking about giving a boost to Lambdapad, the initiative from @garretsmith in Erlang that I loved wa...
New
Agostinho1965
Hey everyone — I’m putting together a practical, code-first book on building production-ready business applications with Phoenix LiveView...
New
andreasronge
You set up environments, each with its own tools, its own data and its own limits, and programs get evaluated in them. The same program r...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews