Live data from Hacker News

Turning PostgreSQL into a queue serving 10k jobs per second (2013)

gist.github.com

1–10 of 146 posts

Re: Turning PostgreSQL into a queue serving 10k jobs per second (2013)

#4
post #3

How does this compare to Redis? Seems like Redis would handily beat it.

The author addresses Redis:

> So, many developers have started going straight to Redis-backed queues (Resque, Sidekiq) or dedicated queues (beanstalkd, ZeroMQ...), but I see these as suboptimal solutions - they're each another moving part that can fail, and the jobs that you queue with them aren't protected by the same transactions and atomic backups that are keeping your precious relational data safe and consistent. Inevitably, a machine is going to fail, and you or someone else is going to be manually picking through your data, trying to figure out what it should look like.

I disagree though. BLPOP is far easier to grok than any Postgres solution and Redis is rock-solid. Either using the new Redis streams or a good queueing library is going to guarantee you don’t miss any jobs and have a need for transactions across both systems either.

I would also be very hesitant to add work to my database. That’s often a sensitive part of systems.

Re: Turning PostgreSQL into a queue serving 10k jobs per second (2013)

#6
post #3

How does this compare to Redis? Seems like Redis would handily beat it.

Postgres is not best in class in many things it does well but it suits the needs most people will actually encounter in the wild while being built on a rock solid foundation. It truly is a fantastic hammer for every nail involving data integrity or synchronization.

It's well designed so that when you do venture into territory where you need a specialized solution it's not difficult to replace. But you'll definitely miss ACID and relational data if you're leveraging them.

There is a great operational economy to making Postgres your default solution for these sorts of problems.

Re: Turning PostgreSQL into a queue serving 10k jobs per second (2013)

#7
post #4
post #3

How does this compare to Redis? Seems like Redis would handily beat it.

The author addresses Redis: > So, many developers have started going straight to Redis-backed queues (Resque, Sidekiq) or dedicated queues (beanstalkd, ZeroMQ...), but I see these as suboptimal solutions - they're each another moving part that can fail, and the jobs that you queue with them aren't protected by the same transactions and atomic backups that are keeping your precious relational data safe and consistent.…

I was also wondering about the "safe and consistent" part. Doesn't Redis Streams with persistence solve those pretty well?

Edit: oh, someone mentioned this being from 2013. No Redis Streams back then.

Re: Turning PostgreSQL into a queue serving 10k jobs per second (2013)

#8
post #3

How does this compare to Redis? Seems like Redis would handily beat it.

If your requirements don’t necessitate such scale, I can see Postgres being a viable alternative. I’d rather not introduce another dependency unless it’s absolutely needed.

Re: Turning PostgreSQL into a queue serving 10k jobs per second (2013)

#9
post #3

How does this compare to Redis? Seems like Redis would handily beat it.

You may be right in terms of performance (I've no idea) but article states:

> many developers have started going straight to Redis-backed queues (Resque, Sidekiq) or dedicated queues (beanstalkd, ZeroMQ...), but I see these as suboptimal solutions - they're each another moving part that can fail, and the jobs that you queue with them aren't protected by the same transactions and atomic backups that are keeping your precious relational data safe and consistent

Re: Turning PostgreSQL into a queue serving 10k jobs per second (2013)

#10
post #6
post #3

How does this compare to Redis? Seems like Redis would handily beat it.

Postgres is not best in class in many things it does well but it suits the needs most people will actually encounter in the wild while being built on a rock solid foundation. It truly is a fantastic hammer for every nail involving data integrity or synchronization. It's well designed so that when you do venture into territory where you need a specialized solution it's not difficult to replace. But you'll definitely m…

[deleted]
Post reply on HN