News for hackers. Stuff that matters.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by mark242 on Tuesday April 11, 2023 @01:15PM (#35528099)
In summary -- their RabbitMQ consumer library and config is broken in that their consumers are fetching additional messages when they shouldn't. I've never seen this in years of dealing with RabbitMQ. This caused a cascading failure in that consumers were unable to grab messages, rightfully, when only one of the messages was manually ack'ed. Fixing this one fetch issue with their consumer would have fixed the entire problem. Switching to pg probably caused them to rewrite their message fetching code, which probably fixed the underlying issue.

It ultimately doesn't matter because of the low volume they're dealing with, but gang, "just slap a queue on it" gets you the same results as "just slap a cache on it" if you don't understand the tool you're working with. If they knew that some jobs would take hours and some jobs would take seconds, why would you not immediately spin up four queues. Two for the short jobs (one acting as a DLQ), and two for the long jobs (again, one acting as a DLQ). Your DLQ queues have a low TTL, and on expiration those messages get placed back onto the tail of the original queues. Any failure by your consumer, and that message gets dropped onto the DLQ and your overall throughput is determined by the number * velocity of your consumers, and not on your queue architecture.

This pg queue will last a very long time for them. Great! They're willing to give up the easy fanout architecture for simplicity, which again at their volume, sure, that's a valid trade. At higher volumes, they should go back to the drawing board.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by dpflan on Tuesday April 11, 2023 @01:39PM (#35528446)
Your last comment is the key, they had an issue and not the scale so a simpler approach works, but then I imagine that this company, which is a new company and growing, will have a future blogpost about switching from pg queue to something that fits their scale...
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by SahAssar on Tuesday April 11, 2023 @02:19PM (#35529025)
So they are picking the right tool (and a tool that they know) for their problem.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by hospadar on Tuesday April 11, 2023 @04:34PM (#35531164)
Also when they have two many jobs for their one table - partition the table by customer, when that's still somehow too big - shard the table across a couple DB instances. Toss in some beefy machines that can keep the tables in memory and I suspect you'd have a LOOOONG way to go before you ever really needed to get off of postgres.

In my experience, the benefits of a SQL table for a problem like this are real big - easier to see what's in the queue, manipulate the queue, resolve head-of-queue blocking problems, etc.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by dpflan on Tuesday April 11, 2023 @05:17PM (#35531696)
There is another variable of experience with the technology which seems to be high for Postgres, low for RabbitMQ…
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by seunosewa on Tuesday April 11, 2023 @02:22PM (#35529093)
Not exactly. For performance (I guess) each worker fetches an extra job while it's working on the current job. If the current job happens to be very long, then the extra job it fetched will be stuck waiting for a long time.

Your multiple queue solution might work but it is most efficient to have just one queue with a pool of workers where where each worker doesn't pop a job unless it's ready to process it immediately. In my experience, this is the optimal solution.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by mannyv on Tuesday April 11, 2023 @02:27PM (#35529170)
It's actually a misconfiguration (see the comment below with the documentation).
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by yarg on Tuesday April 11, 2023 @08:36PM (#35533636)
Better to post a link - the order of comments changes with votes and time.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by quintes on Tuesday April 11, 2023 @03:41PM (#35530397)
I used rabbit many many years ago but agree, scale consumers and only pop when ready to actually process
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by whakim on Tuesday April 11, 2023 @09:14PM (#35533853)
I think this is definitely optimal if your jobs take a long time (and if you add in worker autoscaling of some type, you can deal with quick jobs reasonably well too). But if you have a very large number of quick jobs, setting a high prefetch limit can increase throughput by a tremendous amount. It's in this context that multiple queues makes a lot of sense; you can optimize some workers to read from one queue and others to read from another.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by echelon on Tuesday April 11, 2023 @02:24PM (#35529118)
I'm at a point where I built a low volume queue in MySQL and need to rip it out and replace it with something that does 100+ QPS, exactly once dispatch / single worker processing, job priority level, job topics, sampling from the queue without dequeuing, and limited on failure retry.

I can probably bolt some of these properties onto a queue that doesn't support all the features I need.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by ikiris on Tuesday April 11, 2023 @02:26PM (#35529167)
If your MySQL queue can't handle 100qps you've done something really wrong.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by qaq on Tuesday April 11, 2023 @03:35PM (#35530288)
batch requests instead of ripping anything out. 100 qps sounds really low btw
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by ryanjshaw on Tuesday April 11, 2023 @02:40PM (#35529389)
> I've never seen this in years of dealing with RabbitMQ.

Did you do long running jobs like they did? It's a stereotype, but I don't think they used the technology correctly here -- you're not supposed to hold onto messages for hours before acknowledging. They should have used RabbitMQ to kick off the job, and asynchronously flag the job as complete... inside a database.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by xahrepap on Tuesday April 11, 2023 @03:05PM (#35529800)
I’ve used RabbitMq to do long running jobs. Jobs that take hours and hours to complete. Occasionally even 1-2 days.

It did take some configuring to get it working. Between acking appropriately and the prefetch (qos perhaps? Can’t remember, don’t have it in front of me). We were able to make it work. It was pretty straightforward it never even crossed my mind that this isn’t a correct use case for RMQ.

(Used the Java client.)

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by mark242 on Tuesday April 11, 2023 @03:17PM (#35529974)
The short answer is "yes" but the questions that you should be asking are: A) How long am I willing to block the queue for additional consumers, B) How committed am I to getting close to exactly-once processing, and C) how tolerant of consumer failure should I be? Depending on the answer to those three questions is what drives your queue architecture. Note that this has nothing to do with time spent processing messages or "long running jobs".

Assume that your producers will be able to spike and generate messages faster than your consumers can process them. This is normal! This is why you have a queue in the first place! If your jobs take 5 seconds or 5 hours, your strategy is influenced by the answers to those three questions. For example -- if you're willing to drop a message if a consumer gets power-cycled, then yeah, you'd immediately ack the request and put it back onto a dead letter queue if your consumer runs into an exception. Alternatively, if you're unwilling to block and you want to be very tolerant of consumer failure, you'd fan out your queues and have your consumers checking multiple queues in parallel. Etc etc etc, you get the drift.

Keep in mind also that this isn't specific to RabbitMQ! You'd want to answer the same questions if you were using SQS, or if you were using Kafka, or if you were using 0mq, or if you were using Redis queues, or if you were using pg queues.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by zibarn on Tuesday April 11, 2023 @06:07PM (#35532266)
Except sqs has a limit for unacked messages of 12 hours
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by js2 on Tuesday April 11, 2023 @08:51PM (#35533731)
If I were designing a system with tasks that took that long, I'd probably want to find a way to checkpoint along the way and break the task down into smaller steps. I'd hate to lose 11 hours and 59 seconds of work if the task fails near the end. You can then use multiple queues to pass the task along between steps.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by carrja99 on Tuesday April 11, 2023 @04:24PM (#35531029)
Bingo. This is exactly a setup I have seen before as well. Message recieved and acked, process kicked off, job state tracked in redis or similar.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by hospadar on Tuesday April 11, 2023 @04:26PM (#35531054)
at which point, if you've got to use a DB to track status, really why bother with the queuing system?
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by TedDoesntTalk on Tuesday April 11, 2023 @05:07PM (#35531569)
When you’re dealing with billions of messages, i think queuing systems may be tuned more for it?

I’d like to hear why people chose Kafka over some RDBMS tables.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by RhodesianHunter on Tuesday April 11, 2023 @07:30PM (#35533152)
Performance and distributed nature.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by jjeaff on Tuesday April 11, 2023 @08:18PM (#35533513)
Billions of jobs with hours long time to complete seems like something no one would have the resources for.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by OOPMan on Wednesday April 12, 2023 @10:07AM (#35539881)
Just wait till a start convinces someone to give them money for a system that allows anyone, anywhere to queue up infinite loops XD
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by raverbashing on Wednesday April 12, 2023 @01:54AM (#35535542)
I'm going to be honest, I think some 80% of Kafka users are overengineering it.

Kafka has specific use cases but it seems a lot of people just go "ok use Kafka here" and wait for the load that rarely comes

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by eurasiantiger on Wednesday April 12, 2023 @08:55AM (#35538867)
In an online environment, having your system go down during those rare times will eventually cost you your business.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by raverbashing on Wednesday April 12, 2023 @09:34AM (#35539387)
Sure, then kafka stays online and the rest doesn't because you forgot some details.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by giovannibonetti on Tuesday April 11, 2023 @05:13PM (#35531639)
It's all a matter of how much throughput you need. A queuing system can handle, in the same hardware, orders of magnitude more than a traditional SQL database that writes rows to disk in a page-oriented fashion.

If your load is, say, a few hundred writes/second, stick with the database only, and it will be much simpler.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by arcticfox on Tuesday April 11, 2023 @05:34PM (#35531901)
how does that help if you still have to have a DB tracking status? you still need the same order-of-magnitude of DB throughput
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by RhodesianHunter on Tuesday April 11, 2023 @07:30PM (#35533146)
No, because you only need to read and write ids and maybe timestamps to your db, both of which are trivially indexed, rather than the whole blob of your message payload.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by Footkerchief on Tuesday April 11, 2023 @07:38PM (#35533210)
In many cases, the message payload is (or should be) an ID anyway. It's seldom desirable for the message payload to include a copy of an external source of truth, because it can cause sync issues. There are exceptions, of course.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by Closi on Wednesday April 12, 2023 @02:23AM (#35535707)
I don’t think it should be an ID - these platforms are really made for creating distributed event-driven systems.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by jwmoz on Wednesday April 12, 2023 @06:29AM (#35537488)
The idea is your task should just run off an ID, no point passing all that data around.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by Closi on Wednesday April 12, 2023 @11:59AM (#35541869)
How do you get the data relevant to that ID?

If the answer is a call to a shared database, you might as well not have RabbitMQ.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by eternalban on Tuesday April 11, 2023 @09:44PM (#35534052)
You do not need a database. It is trivial (and correct) to create a ~'<x>-status' topic. In the forward arc you are reliably propagating job requests (acked). In the backflow the processing status of job is posted for anyone interested. You can even propagate retries, etc. It is an MQ and RabbitMQ shines in defining complex dispatch toplogies.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by marcus_holmes on Tuesday April 11, 2023 @11:46PM (#35534779)
Yeah but they already have a database, so it's not like they're adding a database to the system. And (as the article says) the database already contains state, so it makes way more sense to remove RMQ and hold all the state in the database (like they did).
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by valenterry on Wednesday April 12, 2023 @04:22AM (#35536528)
Because a queuing system offers a different thing than a (relational) database.

You can build a queuing system with a database, but you have to do that. Some of the features and constraints of the database might even make your life harder than it has to be.

Instead, view it like that: there is a need for a queuing system and a job system. Either or both can be implemented using a database for certain concersn, but it can also be a custom implementation. It's not a great idea to mix the two things unless the operational and infrastructure costs and complexity outweigh the benefits of a clear separation.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by nicoburns on Wednesday April 12, 2023 @07:05AM (#35537743)
There are libraries that implement queueing on top of databases that require very little setup by the user. For example https://github.com/timgit/pg-boss
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by scrollaway on Wednesday April 12, 2023 @10:06AM (#35539871)
I’ve had a positive experience with Procrastinate.

https://procrastinate.readthedocs.io/en/stable/

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by valenterry on Wednesday April 12, 2023 @10:39PM (#35550199)
Right. However, please don't forget that there are very often inherit limitations regarding scaling or availability and also that many fully fledged message queues come with a lot of perks like access management and administration / debugging tooling and interfaces.

I'm not saying that libraries like pg-boss and co. cannot sometimes replace a full queue implementation. But the tradeoffs need to be clear.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by 4dayworkweek4u on Thursday April 13, 2023 @09:42AM (#35555313)
Queues are good for connecting separated systems (like 2 or more separate companies).
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by petesergeant on Tuesday April 11, 2023 @11:33PM (#35534709)
To me, the difference here is a job queue vs a message queue
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by fake-name on Wednesday April 12, 2023 @03:11AM (#35536020)
I do something like this in some projects of mine.

RabbitMQ is completely happy to do this. On the other hand, literally every python client library would fall over and/or wedge forever periodically. Celery in particular was a flaming pile of garbage (at least circa 2018).

I wound up vendoring the best of the bunch (amqpstorm, fyi), and adding a bunch of additional logic to handle all the various corner cases. That, plus a bunch of careful thought about how the queues are structured, and I've been pushing millions of messages a day without issue.

I wasn't able to get a lot of my changes upstream due to the extent I had to alter the assumptions the library made about control flow.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by OOPMan on Wednesday April 12, 2023 @10:09AM (#35539927)
Don't worry, Celery has always been and will always be a flaming pile of garbage
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by xmcqdpt2 on Thursday April 13, 2023 @06:45AM (#35553502)
For what it's worth, I found rq to be much nicer than celery but only used it in a relatively constrained fashion.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by justinclift on Wednesday April 26, 2023 @10:58PM (#35722800)
rq doesn't interoperate with other languages though, so if you use it then your workers can only be written in Python. :(
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by valenterry on Wednesday April 12, 2023 @04:18AM (#35536488)
> They should have used RabbitMQ just to kick off the job, immediately ACKing the request, and job tracking/completion handled inside... a database.

That's what I think too. Use the message queue for communication and potentially work distribution and the database for the rest like internal state.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by aidos on Tuesday April 11, 2023 @02:50PM (#35529583)
It may be a misconfiguration but I’m fairly sure you couldn’t change this behaviour in the past. Each worker would take a job in advance and you could not prevent it (I might be misremembering but I think I checked the source at the time).

In my experience, RabbitMQ isn’t a good fit for long running tasks. This was 10 years ago. But honestly, if you have a short number of long running tasks, Postgres is probably a better fit. You get transactional control and you remove a load of complexity from the system.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by whakim on Tuesday April 11, 2023 @03:24PM (#35530108)
I don't think this behavior has changed significantly. The key issue is that they seem to have correctly identified that they wanted to prefetch a single task, but they didn't recognize that this setting is the count of un-ACK'ed tasks. If you ACK upon receipt (as most consumers do by default), then you're really prefetching two tasks - one that's being processed, and one that's waiting to be processed. If you ACK late, you get the behavior that TFA seems to want. I've seen this misconfiguration a number of times.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by skrtskrt on Tuesday April 11, 2023 @05:47PM (#35532047)
> RabbitMQ isn’t a good fit for long running tasks

yeah I've seen 3 different workplaces run into this exact issue, usually when they started off with a default Django-Celery-Redis approach

all of those cases were actually easily fixed with Postgres SELECT FOR UPDATE as a job queue

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by phamilton on Tuesday April 11, 2023 @06:51PM (#35532770)
I'll add another to the anecdata. We saw this issue with RabbitMQ. We replaced it with SQS at the time but we're currently rebuilding it all on SELECT FOR UPDATE.

Our problem was that when a consumer hung on a poison pilled message, the prefetched messages would not be released. We fixed the hanging, but hit a similar issue, and then we fixed that, etc.

We moved to SQS for other reasons (the primary being that we sometimes saturated a single erlang process per rabbit queue), but moving to the SQS visibility timeout model has in general been easier to reason about and has been a better operations experience.

However, we've found that all the jobs are in postgres anyway, and being able to index into our job queue and remove jobs is really useful. We started storing job metadata (including "don't process this job") in postgres and checking it at the start of all our queue workers and we've decided that our lives would be simpler if it was all in postgres.

It's still an experiment on our part, but we've seen a lot of strong stories around it and think it's worth trying out.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by 2muchcoffeeman on Tuesday April 11, 2023 @06:18PM (#35532385)
The linked docs in the article also suffer from the “wall of text” style that almost all software docs suffer from. If that’s what they had to go by to work out this behaviour, I wouldn’t be surprised they missed it. Most of the time when I look at docs, none of them are laid out to build understanding. It’s just a description of the system.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by aftbit on Tuesday April 11, 2023 @06:48PM (#35532731)
What exactly do you mean by "take a job in advance"? I have certainly set the prefetch limit to 1 on my queues, which I believe prevents them from taking a job while they are running one. One of our production applications runs 4+ hour jobs in a RabbitMQ queue without blocking and has done so for 5+ years.

You do want to make sure to set the VM high water mark below 50% of RAM as the GC phase can double the used memory. If high water mark is set too high, the box will thrash swap really badly during GC and hang entirely.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by ftkftk on Tuesday April 11, 2023 @03:39PM (#35530350)
My thoughts exactly half way through the article.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by tracker1 on Tuesday April 11, 2023 @06:00PM (#35532184)
Yeah, my first thought was curiosity about their volume needs. DB based queues are fine if you don't need more than a few messages a second of transport. For that matter, I've found Azure's Storage Queues probably the simplest and most reliable easy button for queues that don't need a lot of complexity. Once you need more than that, it gets... complicated.

Also, sharing queues for multiple types of jobs just feels like frustration waiting to happen.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by TexanFeller on Tuesday April 11, 2023 @06:47PM (#35532722)
> DB based queues are fine if you don't need more than a few messages a second of transport

I'd estimate more like dozens to hundreds per second should be pretty doable, depending on payload, even on a small DB. More if you can logically partition the events. Have implemented such a queue and haven't gotten close to bottlenecking on it.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by tracker1 on Tuesday April 11, 2023 @06:51PM (#35532773)
Had meant few hundred... :-)
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by eastern on Wednesday April 12, 2023 @01:20AM (#35535322)
A column in the database identifying which 'queue' is all you need for that. The table is not a queue, it's a structure to store queues.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by whalesalad on Tuesday April 11, 2023 @10:14PM (#35534251)
Sounds like a prefetch issue. Or auto ack.

Rabbit is a phenomenal tool but you need to know how to use it.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by Xenoamorphous on Wednesday April 12, 2023 @02:17AM (#35535662)
Pretty sure they just needed to disable autoack and manually ack after the long running task was done.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by btilly on Wednesday April 12, 2023 @12:05AM (#35534881)
If they knew that some jobs would take hours and some jobs would take seconds, why would you not immediately spin up four queues. Two for the short jobs (one acting as a DLQ), and two for the long jobs (again, one acting as a DLQ). Your DLQ queues have a low TTL, and on expiration those messages get placed back onto the tail of the original queues.

Here is why I would not recommend that.

Do that and you have to rewrite your system around predictions how long each job will take, deal with 4 sources of failure, and have more complicated code. All this to maintain the complication of an ultimately unneeded queueing system. You call it an "easy fanout architecture for simplicity." I call it, "an entirely unnecessary complication that they have no business having to deal with."

If they get to a volume where they should go back to the drawing board, then they can worry about it then. This would be a good problem to have. But there is no need to worry about it now.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by pushedx_ on Wednesday April 12, 2023 @01:25AM (#35535357)
Agreed. I previously worked for a well known service provider that relied on a single SQL database for queueing hundreds of jobs per second across all regions. The system was well understood by everyone at the company and the company had a surprisingly high market cap. You can get very far with the simple thing.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by noisy_boy on Wednesday April 12, 2023 @10:13AM (#35540005)
With the additional advantage that you can run adhoc queries against the SQL database which isn't an option with RMQ.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by mekoka on Wednesday April 12, 2023 @01:19AM (#35535313)
> In summary -- their RabbitMQ consumer library and config is broken in that their consumers are fetching additional messages when they shouldn't. I've never seen this in years of dealing with RabbitMQ.

What do you mean by "broken"? Are you implying that the behavior they're describing is not the way the consumer library is supposed to work? They linked to RabbitMQ's documentation basically saying that's exactly how it works. Also, where do you get the sense that they've misconfigured it? You've made these statements, but did not exactly enlightened us as to how one should set things up to have consumers handle exactly one job at a time. That was their only problem (Edit: an answer by @whakim https://news.ycombinator.com/item?id=35530108 is providing more light on this).

The rest of your answer sanctimoniously presumes that they don't know how to use the tool, but your own proposed solution is moot, as it seems to address a different problem, not the one that they have (1 job per consumer max).

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by tuyiown on Wednesday April 12, 2023 @04:17AM (#35536482)
The architectural error was to have messages acknowledged at end of long processing, probably to avoid to handle messages produced from the worker, instead of having two messages with quick ack, one message at start, one message at end from worker.

RabbitMQ jobs is to handle message transfert, if you tie business logics (jobs completion) to its state, you have a problem.

So basically, producer and consumer MUST have their own storage for tracking processes, typically by ID, RabbitMQ jobs being the message handler for synchin' states.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by bsaul on Wednesday April 12, 2023 @04:30AM (#35536586)
"two messages with quick ack, one message at start, one message at end from worker."

how do you deal with worker getting killed in that scenario ? if you can't rely on the queue job state then you need another whole set of code somewhere to handle timeouts & retries, don't you ?

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by tuyiown on Wednesday April 12, 2023 @06:29AM (#35537492)
For long async processes:

A worker, or at least, the consumer receiving the messages and spawning sub workers, when getting killed, should restart at some point, inspecting jobs ids unfinished, the one stored just before ack'ing reception, and either resume work or notify failure.

Answering is the worker sole responsibility, and no viable implementation of an app can reliably try to substitute to that.

As for timeouts, they are necessary when waiting for answers from services that are not under your control, eg, you cannot assume they will answer you in all cases. Under your control, you have to keep yourself in a situation where worker response is guaranteed, success or failure.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by bsaul on Thursday April 13, 2023 @05:13AM (#35552897)
I feel like this would reimplement a lot of the machinery that's built-in the job queue (atomic state locking to take ownership of the job, with deadlocking prevention mechanism to make sure a killed process doesn't keep that job locked, and timeouts).

At this point, why not throw the whole job queue away and simply use that system ?

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by whakim on Wednesday April 12, 2023 @11:37AM (#35541538)
I wish you wouldn't speak so authoritatively because much of this is just one way (and hardly the only way) to implement such a system. If you read the RabbitMQ docs (see https://www.rabbitmq.com/confirms.html) you'll see that ACK'ing the messages after processing is explicitly described as a way to handle consumer failures.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by tuyiown on Wednesday April 12, 2023 @01:45PM (#35543694)
Depends on your definition of processing. In the case I describe the processing is receiving and recording the job id sent by the producer. Ack should be sent asap so that all non-business issues on message transmissions should be handled by messaging logics.

Having the jobs processing itself being independent of the messaging solution seems like good way to go as the actual message implementation, might have to change. I really think that you don't want ossification of your messaging implementation detail on your business logics.

I did not pretend that it was the only solution, merely just something I know would be reliable, an implicit «one way to it».

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by whakim on Wednesday April 12, 2023 @03:56PM (#35545838)
Again though, RabbitMQ and many AMQP consumers are explicitly designed so that you don't have to do this if you don't want to. If you have long idempotent tasks, it is both possible (and, in many cases, recommended!) to set QoS (prefetch) to 1 and ACK only after the long task has completed. This means you don't have to write any logic to deal with worker crashes/disconnects/etc. because this is a fully anticipated and supported workflow. There are certainly downsides to this approach, but not having to worry about tracking job ids is much simpler.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by tuyiown on Thursday April 13, 2023 @04:29AM (#35552569)
It's not only simpler, it's just way more reliable for high volumes of messages with a large number of workers and short processing.

I really was focusing on low volume, long jobs, where RabbitMQ is overkill, and workers respawn does not need proper dequeuing.

One aspect to keep in mind is also the kind of use case, when the job is just a subtask, and the final result is stored, on completion it produces as message to be handled for continuation, you have direct id tracking without further additional logics, and a simple ack is not enough.

For eg, sending emails, the jobs does not create further message, and no shared mutable state occurs. The scenario with ack on end of process covers all cases.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by dkersten on Friday April 14, 2023 @03:50AM (#35566686)
That seems like a rather uncommon definition of processing. Certainly not what people mean when they generally talk about processing a message.

You’re right that if the business-processing is a long heavy-weight operation then that should be decoupled from the message queue and failure handled internally, in which case your definition does make sense as an intermediary hand-off step. Just in the general case, I think most people wouldn’t consider hand-off alone as processing.

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by mastermedo on Wednesday April 12, 2023 @01:26AM (#35535361)
What about messages that uncover a bug in the consumer/message format? After X failed attempts, the data shouldn’t be enqueued anymore, but rather logged somewhere for engineers to inspect.
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by raverbashing on Wednesday April 12, 2023 @01:51AM (#35535523)
It might be because RabbitMQ libraries and tooling is awfully unintuitive and confusing (without some higher level library on top).

At some point using what you understand is easier

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by rawoke083600 on Wednesday April 12, 2023 @03:11AM (#35536021)
This! In all my years of working with RabbitMQ is been super solid! Throwing all that out in exchange for a db queue, honestly doesnt seem smart (with respect)
Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by stolsvik on Wednesday April 12, 2023 @01:38PM (#35543563)
Their solution does not preclude fanout. Fetching work items from such a work queue by multiple nodes/servers should be no problem. One solution that also would be good for monitoring would be to have a state column, and a "handled by node" column. So, in a transaction, find a row that is not taken, take it by setting the state to PROCESSING, and set the handled_by_node to the nodename. Shove in a timestamp for good measure. When it is done, set the state to DONE, or delete the column.

Monitor by having some health check evaluating that no row stays in PROCESSING for too long, and that no row stays NOT_STARTED for too long, etc. Introspect by making a nice little HTML screen that shows this work queue and its states.

As I wrote in another comment, this is somewhat similar to a "work queue pattern" I've described here: https://mats3.io/patterns/work-queues/

Re:SQL Maxis: Why We Ditched RabbitMQ and Replaced It with a... by datavirtue on Thursday April 13, 2023 @12:58AM (#35551141)
This.