zlacker

[return to "Postgres is a great pub/sub and job server (2019)"]
1. colinc+be[view] [source] 2021-12-18 00:19:11
>>anonu+(OP)
Author here! A few updates since this was published two years ago:

- The service mentioned (now called https://webapp.io ) eventually made it into YC (S20) and still uses postgres as its pub/sub implementation, doing hundreds of thousands of messages per day. The postgres instance now runs on 32 cores and 128gb of memory and has scaled well.

- We bolstered Postgres's PUBLISH with Redis pub/sub for high traffic code paths, but it's been nice having ACID guarantees as the default for less popular paths (e.g., webhook handling)

- This pattern only ever caused one operational incident, where a transaction held a lock which caused the notification queue to start growing, and eventually (silently) stop sending messages, starting postgres with statement_timeout=(a few days) was enough to solve this

Previous discussion: https://news.ycombinator.com/item?id=21484215

Happy to answer any questions!

◧◩
2. boomsk+Ye[view] [source] 2021-12-18 00:24:46
>>colinc+be
> doing hundreds of thousands of messages per day

> The postgres instance now runs on 32 cores and 128gb of memory and has scaled well.

Am I the only one?

◧◩◪
3. colinc+Uf[view] [source] 2021-12-18 00:31:49
>>boomsk+Ye
Such a server is 400$/mo, a backend developer that can confidently maintain kafka in production is significantly more expensive!
◧◩◪◨
4. rockwo+vk[view] [source] 2021-12-18 01:09:49
>>colinc+Uf
Fwiw I don't know the shape of the data, but I feel like you could do this with Firebase for a few bucks a month...
◧◩◪◨⬒
5. daenz+yp[view] [source] 2021-12-18 01:49:36
>>rockwo+vk
you 100% could, and this thread feels like the twilight zone with how many people are advocating for using a rdbms for (what seems like) most peoples queuing needs.
◧◩◪◨⬒⬓
6. foepys+GM[view] [source] 2021-12-18 06:09:00
>>daenz+yp
Why should I rely on yet another microservice when I have PostgreSQL right there?
◧◩◪◨⬒⬓⬔
7. daenz+NQ[view] [source] 2021-12-18 07:03:55
>>foepys+GM
Everything is a nail, why should I use anything but this hammer?
◧◩◪◨⬒⬓⬔⧯
8. Dowwie+Pc1[view] [source] 2021-12-18 11:45:38
>>daenz+NQ
I think you're helping bring balance to the enthusiasm here for using Postgres as a multi-purpose tool. However, there is a lot of room for you and the advocates favoring Postgres to both be right about tooling. I adopted RabbitMQ because I decided I didn't want to grow into needing it by dealing with many of the problems that motivated engineers to bring RabbitMQ into existence. However, I probably would have been fine with Postgres-pubsub, or Redis-pubsub/streams, both databases that I already used for their general purpose and have established capabilities for messaging. I noticed your earlier agreement with the person who mentioned using Firebase, and Firebase is yet another multi-purpose tool good enough at many things but still not better than the customized domain systems. If you agree with the claim for Firebase, others can now agree about Supabase. It's all Postgres beneath, though.
◧◩◪◨⬒⬓⬔⧯▣
9. nicobu+sm1[view] [source] 2021-12-18 13:34:54
>>Dowwie+Pc1
Agree with your point about multiple tools being good enough, but IMO firebase is not one of them. In my experience despite it claiming to be excellent at scaling, it performs worse than even a small Postgres instance. It’s good at the “real-time subscriptions”, but that’s about it.
[go to top]