dhilipsiva

dhilipsiva

Separating API from background tasks (oban/quantum) for deployment

Hello Community,

I come from a predominantly python background and I am very new to elixir. So I am having a hard time figuring out some things in Elixir (Phoenix/Oban).

Recently, my company took over a Elixir product that someone else built. It was built with Phoenix and they have used Oban to run asynchronous tasks. These tasks are very compute intensive (they do a lot of calculations) and its slowing the APIs down.

If it was python, we usually have one command to run API server and another command to run background tasks (usually a celery command). So I build a separate “api” container and a separate “task” container. I just scale “task” container and it won’t slow down “api” containers as they run on independent machines.

I am having a hard time figuring out how to do the same thing with Pheonix/Oban. Basically, what I am looking for is a way to start API and Tasks separately (using two different commands/ passing some flags).

Plus I discovered they have used something called “libcluster” in the product (I have a basic idea. I know I might have to use a different clustering strategy when I do deployment). I am not sure if this is relevant, but I somehow felt that these things are connected.

Can someone please point me to relevant resources? I just want to be able to deploy API server & Oban (or quantum) tasks independently.

Most Liked

sorentwo

sorentwo

Oban Core Team

You probably need to run Oban in all application instances. Most likely the API inserts Oban jobs, which requires a running instance (though it needn’t run any queues).

You can configure each application instance to run specific queues and avoid heavy computation on API instances. There is an official guide that covers this exact use case: Splitting Queues Between Nodes — Oban v2.23.0

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement