Live data from Hacker News

Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

github.com

131–140 of 140 posts

Re: Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

#131

We use listen notify extensively and it is great. The things it lacks most for us is guaranteed single recipient. All subscribers get all notifications which leads to problems in determining who should act on the message n our case.

Wouldn't it be possible for you to lose jobs if no subscriber is listening?

Re: Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

#134

Earlier quoted context omitted.

Thats exactly what we do but taking a lock takes 1 RTT to the database which means about 100ms. it limits the number of events receivers can handle. IF you have too many events, receivers will be just trying to take a lock most of the time.

Of my head, you could attach a uuid or sequence number to the emitted event. Then based on the uuid or sequence you can let one or the other event consumer pick? Ex. you have two consumers, if the sequence number is odd, A picks it, if its even B picks.

Without more logic than this does this mean any workers that are busy or down mean you lose jobs?

Re: Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

#135

Earlier quoted context omitted.

Thats exactly what we do but taking a lock takes 1 RTT to the database which means about 100ms. it limits the number of events receivers can handle. IF you have too many events, receivers will be just trying to take a lock most of the time.

Of my head, you could attach a uuid or sequence number to the emitted event. Then based on the uuid or sequence you can let one or the other event consumer pick? Ex. you have two consumers, if the sequence number is odd, A picks it, if its even B picks.

Great observation, I wrote a little wrongly. What we want ideally is guaranteed delivery to one random free worker. Uuid strategy is better than locking but this could mean that if one worker gets a longer job, all the others on this worker are delayed even if another worker is free.

Re: Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

#136

Earlier quoted context omitted.

Of my head, you could attach a uuid or sequence number to the emitted event. Then based on the uuid or sequence you can let one or the other event consumer pick? Ex. you have two consumers, if the sequence number is odd, A picks it, if its even B picks.

Without more logic than this does this mean any workers that are busy or down mean you lose jobs?

We use a garbage collector to error restart if a job is not served within a specified amount of time.

Re: Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

#137

We use listen notify extensively and it is great. The things it lacks most for us is guaranteed single recipient. All subscribers get all notifications which leads to problems in determining who should act on the message n our case.

Wouldn't it be possible for you to lose jobs if no subscriber is listening?

We use a garbage collector to error restart if a job is not served within a specified amount of time.

Re: Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

#138

Earlier quoted context omitted.

Thats exactly what we do but taking a lock takes 1 RTT to the database which means about 100ms. it limits the number of events receivers can handle. IF you have too many events, receivers will be just trying to take a lock most of the time.

Of my head, you could attach a uuid or sequence number to the emitted event. Then based on the uuid or sequence you can let one or the other event consumer pick? Ex. you have two consumers, if the sequence number is odd, A picks it, if its even B picks.

I think this concept you mentioned would be called sharding? It's kinda required for apache Kafka and others.

Re: Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

#139

Earlier quoted context omitted.

Some names - Celery (massive and heavy) - Dramatiq - APScheduler - Huey Today, Redis queues, unless stricly a single process, seem to be most pain free for small scale use.

We had a terrible time with Dramatiq; very buggy and resource-heavy. We ended up switching to SNS/SQS combo

Ah that's unfortunate, I had a pretty OK time with Dramatiq (coming off of Celery especially). But I imagine this is dependent on your scale.

I think most people reading this site are working on relatively small systems (that still need background tasks!) and the fixed costs of background tasks can be reasonable. But I could be totally offbase

Re: Show HN: PgQueuer – Transform PostgreSQL into a Job Queue

#140

I really like the emergence of simple queuing tools for robust database management systems. Keep things simple and remove infrastructure complexity. Definitely a +1 from me! For handling straightforward asynchronous tasks like sending opt-in emails, we've developed a similar library at All Quiet for C# and MongoDB: https://allquiet.app/open-source/mongo-queueing In this context: LISTEN/NOTIFY in PostgreSQL is compara…

[deleted]
Post reply on HN