Earlier quoted context omitted.
Which complexity? Of running a SQL query on the same database you're already using, vs writing code to support some other new system?
>Of running a SQL query on the same database you're already using Go back and read OPs link. They create new SQL types, tables, triggers, and functions, with non-trivial and very unforgiving atomic logic. And every system that needs to read or write from this "db queue" needs to leverage specific queries. That's the complexity. >vs writing code to support some other new system You mean using a stable well maintained…
Postgres is a great pub/sub and job server (2019)
111–120 of 209 posts
Re: Postgres is a great pub/sub and job server (2019)
#112Just because something can be used to do something doesn't mean it should. Kafka is specifically designed for this purpose, it is free, and it is easy to learn and use. If "starting with Postgres and then switching out when the time comes" saves money then I can understand. Otherwise use the right tool for the right job, right from the start.
Kafka is not a queue. Kafka's parallelism is limited by the number of partitions you allocate, and you have to be sure to avoid head of line blocking. Not the case with a queue.
Re: Postgres is a great pub/sub and job server (2019)
#113> graphile-worker is horizontally scalable. Each instance has a customisable worker pool, this pool defaults to size 1 (only one job at a time on this worker) but depending on the nature of your tasks (i.e. assuming they're not compute-heavy) you will likely want to set this higher to benefit from Node.js' concurrency.
Re: Postgres is a great pub/sub and job server (2019)
#114Earlier quoted context omitted.
What does scale have to do with it? Pub/sub as an architectural pattern could be equally relevant for your use case whether there are a hundred users in your system or a billion. And Kafka isn't the only solution for it. There are many lightweight pub/sub and queuing systems which also don't involve needlessly adding abstraction layers and application code into an RDBMS.
I think massive scale is the only reason you'd really want to adopt something like Kafka. If you're 10k inserts/s or less then there's no reason not to do everything in a single big relational DB where you get the warm fuzzy feeling of transactions, point in time backups, scalable read replication, etc
Re: Postgres is a great pub/sub and job server (2019)
#115Re: Postgres is a great pub/sub and job server (2019)
#116Earlier quoted context omitted.
>Of running a SQL query on the same database you're already using Go back and read OPs link. They create new SQL types, tables, triggers, and functions, with non-trivial and very unforgiving atomic logic. And every system that needs to read or write from this "db queue" needs to leverage specific queries. That's the complexity. >vs writing code to support some other new system You mean using a stable well maintained…
Not necessarily. Many languages like Java already have queuing libraries that operate on rdbms through JPA. So not even a single additional line needs to be written for this to work. We got ours working in a day and it works great. I don't know if other languages have these libraries but I'm inclined to believe they do (at least nodejs has).
Re: Postgres is a great pub/sub and job server (2019)
#117Re: Postgres is a great pub/sub and job server (2019)
#118Earlier quoted context omitted.
I assume that is their main database for everything, not just for pub/sub. One of the big benefits of doing it that way is that you have proper transaction handling across jobs and their related data.
Come on man… you can run the whole thing off if a few Gb instance. Such a huge instance should be able to do about 100k a second!
Re: Postgres is a great pub/sub and job server (2019)
#119Earlier quoted context omitted.
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.
Dude you are seriously underestimating postgres' versatility. It does so many different things, and well!
Re: Postgres is a great pub/sub and job server (2019)
#120Author 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 p…