dch

dch

Overview

For security compliance reasons, I need to ensure a complete separation between some of the consumers, and the producers that submit jobs to the queue. It’s sufficient to have the jobs go to a common PostgreSQL instance, but the Erlang VMs must be separate, to provide a strong security boundary.

In the past I’ve used RabbitMQ very successfully, but we don’t have a message broker yet in this project, and Oban’s workflows will be very useful for other aspects of the project.

Limitations

This rules out Erlang distributions obviously, and also PG Bouncer, but this is still enough to run Oban successfully using PostgreSQL LISTEN/NOTIFY. I asked this question on Slack, and got enough of a feel to implement this, so far it seems to work well enough.

Questions

  • have I missed anything obvious from the proposed solution?
  • has anybody been down this path, and has some war stories to share?
  • are there any other patterns to deal with this situation?
  • what’s the best way to notify the Producer that the work has completed? Note there’s no PubSub available between nodes. I found PostGrex.Notifications & Postgrex PubSub as well as Oban.Notifier

Current Solution

  • a front end Phoenix app, with migrations, and Oban job submission

  • a backend Elixir app, without migrations, but sharing Repo & Oban config

  • a common Oban.Worker library module, used in both apps

  • the primary has no queues defined via queues: []

  • the secondary has the necessary queues defined queues: [default: 10]

  • for notification the built-in Oban.Notifier is a better choice and works with the same underlying mechanisms.

Showing Posts 1 to 3

sorentwo

sorentwo

Oban Core Team

Nothing obvious to me. It’s fairly common to split up Oban between worker and non-worker (i.e. web) instances. In that case the worker code is usually shared between the applications, but that’s not a requirement.

Queue producers don’t need to know when work is completed, just that jobs are available. That’s one of the many places where PubSub notifications are used for coordination between nodes. The others would be for starting, stopping, pausing, resuming, and scaling queues; not to mention sharing metrics for Web.

The default notifier is Postgres based and there’s no need to bring in a separate Postgres notifier. That will work perfectly fine as long as the nodes running jobs share a database, and there isn’t a connection pooler.

Your current solution is spot on. This is something people ask about frequently and should probably be in an offiical guide.

dch

dch OP

Thanks! So far it seems to work very well. Should we expect a threshold of job volumes, after which performance begins to degrade?

Maikel suggested we can actually keep everything in a single Elixir app / codebase / repo, and just modify runtime.exs to selectively start the appropriate supervisors in application.ex. I’d originally envisioned separate Apps in the same git repo, but this is simpler.

sorentwo

sorentwo

Oban Core Team

For splitting the application, there’s no difference at all. Performance is mostly limited by the power of the database and your usage patterns.

The Postgres notifier is similarly limited. It requires additional transactions to emit events, and it can’t handle large payloads for metrics. Disabling insert triggers cuts down on the number of notifications drastically though.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

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
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews