SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a Postgres Queue

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • tembo

    Monorepo for Tembo Operator, Tembo Stacks, and Tembo CLI

    Love to see it. We (CoreDB) recently released PGMQ, a message queue extension for Postgres: https://github.com/CoreDB-io/coredb/extensions/pgmq

  • Que

    A Ruby job queue that uses PostgreSQL's advisory locks for speed and reliability.

    (not sure why this comment was dead, I vouched for it)

    There are a lot of ways to implement a queue in an RDBMS and a lot of those ways are naive to locking behavior. That said, with PostgreSQL specifically, there are some techniques that result in an efficient queue without locking problems. The article doesn't really talk about their implementation so we can't know what they did, but one open source example is Que[1]. Que uses a combination of advisory locking rather than row-level locks and notification channels to great effect, as you can read in the README.

    [1]: https://github.com/que-rb/que

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • pg-boss

    Queueing jobs in Node.js using PostgreSQL like a boss

    If you don't want to roll your own, look into https://github.com/timgit/pg-boss

  • litequeue

    Queue built on top of SQLite

    SQLite is missing some features like `SELECT FOR UPDATE`, but you can work around some issues with a few extra queries. I wrote litequeue[0] with this specific purpose. I haven't been able to use it a lot, so I don't have real-world numbers of how it scales, but the scaling limits depend on how fast you can insert into the database.

    [0]: https://github.com/litements/litequeue

  • worker

    High performance Node.js/PostgreSQL job queue (also suitable for getting jobs generated by PostgreSQL triggers/functions out into a different work queue)

    Another good library for this is Graphile Worker:

    https://github.com/graphile/worker

    Uses both listen notify and advisory locks so it is using all the right features. And you can enqueue a job from sql and plpgsql triggers. Nice!

    Worker is in Node js.

    https://github.com/graphile/worker

  • good_job

    Multithreaded, Postgres-based, Active Job backend for Ruby on Rails.

    I'm the GoodJob author. Here's the class that is responsible for implementing Postgres's LISTEN/NOTIFY functionality in GoodJob:

    https://github.com/bensheldon/good_job/blob/10e9d9b714a668dc...

    That's heavily inspired by Rail's Action Cable (websockets) Adapter for Postgres, which is a bit simpler and easier to understand:

    https://github.com/rails/rails/blob/be287ac0d5000e667510faba...

    Briefly, it spins up a background thread with a dedicated database connection and doings a blocking Postgres LISTEN query returns results, and then it forwards the result to other subscribing objects.

  • Ruby on Rails

    Ruby on Rails

    I'm the GoodJob author. Here's the class that is responsible for implementing Postgres's LISTEN/NOTIFY functionality in GoodJob:

    https://github.com/bensheldon/good_job/blob/10e9d9b714a668dc...

    That's heavily inspired by Rail's Action Cable (websockets) Adapter for Postgres, which is a bit simpler and easier to understand:

    https://github.com/rails/rails/blob/be287ac0d5000e667510faba...

    Briefly, it spins up a background thread with a dedicated database connection and doings a blocking Postgres LISTEN query returns results, and then it forwards the result to other subscribing objects.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • starqueue

    I wrote a message queue in Python called StarQueue.

    It’s meant to be a simpler reimagining of Amazon SQS.

    It has an HTTP API and behaves mostly like SQS.

    I wrote it to support Postgres, Microsoft’s SQL server and so MySQL because they all support SKIP LOCKED.

    At some point I turned it into a hosted service and only maintained the Postgres implementation though the MySQL and SQL server code is still in there.

    It’s not an active project but the code is at https://github.com/starqueue/starqueue/

  • tqs

    Tiny Queue Service (Server)

    I wrote https://github.com/TinyWebServices/tqs a couple of years ago. It is modelled after SQS and runs in a single threaded Tornado server.

    I don’t know how many messages per second it does but for a podcast crawling side project I have processed billions of messages through this little Python wrapper around SQLite. Zero problems. It just keeps running happily.

  • amqp

    Idiomatic Elixir client for RabbitMQ (by pma)

    So far I have not had any issues with the Elixir one.

    https://github.com/pma/amqp

  • pgtt

    PostgreSQL extension to create, manage and use Oracle-style Global Temporary Tables and the others RDBMS (by darold)

  • oban

    💎 Robust job processing in Elixir, backed by modern PostgreSQL and SQLite3

    Oban [0] is a job queuing system in the Elixir world that supports both postgres and sqlite.

    [0] https://getoban.pro/

  • rq

    Simple job queues for Python

    Also had a similar experience using RabbitMQ with Django+Celery. Extremely complicated and workers/queues would just stop for no reason.

    Moved to Python-RQ [1] + Redis and been rock solid for years now.

    [1] https://python-rq.org/

  • neoq

    Queue-agnostic background job library for Go, with a pleasant API and powerful features.

    This is exactly the thesis behind neoq: https://github.com/acaloiaro/neoq

  • BeanstalkD

    Beanstalk is a simple, fast work queue.

    Not when a queue is involved. IME trying to replicate something like beanstalkd (https://beanstalkd.github.io/) in postgres is asking for trouble for anything but trivial workloads.

    If you're measuring throughput in jobs/s, use a real work queue.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts