System design hack: Postgres is a great pub/sub and job server
31–40 of 162 posts
Re: System design hack: Postgres is a great pub/sub and job server
#32I'm curious if the same holds true if you drop in Sqlite/MS Sql Server/Mysql. I.e. is this good advice because Postgres in particular is a great implementation of sql, or because sql in general is good enough to solve this problem, or a mix of the two?
Postgres in particular: - has strong performance vs, say, sqlite - has "channel" and "trigger" support so you can avoid polling (which either slows down your jobs or limits your number of workers) - is actually OSS (versus, say, mysql)
Re: System design hack: Postgres is a great pub/sub and job server
#33I'm curious if the same holds true if you drop in Sqlite/MS Sql Server/Mysql. I.e. is this good advice because Postgres in particular is a great implementation of sql, or because sql in general is good enough to solve this problem, or a mix of the two?
Re: System design hack: Postgres is a great pub/sub and job server
#34Earlier quoted context omitted.
Postgres in particular: - has strong performance vs, say, sqlite - has "channel" and "trigger" support so you can avoid polling (which either slows down your jobs or limits your number of workers) - is actually OSS (versus, say, mysql)
How is MySQL not OSS?
Re: System design hack: Postgres is a great pub/sub and job server
#35Isn't hijacking a DB as a "distributed" message queue a pretty well trodden path? Enterprises have been doing this for decades.
This pattern falls down if you need to poll the database, because if you have 3 queues and 100 workers you're making 300 queries per poll interval. The feature of postgres that makes this viable in comparison to most other databases is the "channel"
There is a solution to every perceived problem.
Re: System design hack: Postgres is a great pub/sub and job server
#36However, my design was more bare bones. I was picking jobs by chaining CTE's that did the status update as they returned the first element of the queue.
Re: System design hack: Postgres is a great pub/sub and job server
#37Re: System design hack: Postgres is a great pub/sub and job server
#38Earlier quoted context omitted.
Postgres in particular: - has strong performance vs, say, sqlite - has "channel" and "trigger" support so you can avoid polling (which either slows down your jobs or limits your number of workers) - is actually OSS (versus, say, mysql)
How is MySQL not OSS?
Re: System design hack: Postgres is a great pub/sub and job server
#39Earlier quoted context omitted.
I'm not seeing how this recovers from the failure scenario where a worker grabbed an event and then immediately crashed.
The comment you are replying to wasn't addressing that scenario. Typically you would implement visibility timeouts and other such stuff. Depending on the use case you could make specific optimizations or keep it generic and have SQS like semantics or something.
Re: System design hack: Postgres is a great pub/sub and job server
#40Postgres is an acceptable relational database / nosql database / pub/ sub/ job server / blockchain.
It's also the easiest one to start with, excelling in all the mainstream categories for relational databases.