TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Redis Queue Hacks and Questions

2 pointsby 88stacksabout 2 years ago
I have 2 situations I want to ask about. I am currently using redis to process 10&#x27;s of thousands of jobs a day now. I have been enjoying it and seems to be the right tool for the job for when I started. I have some interesting characteristics though. Question 1) My jobs are smaller jobs that are part of bigger job. Each job takes 30 seconds and when all related jobs are done, the &quot;master job&quot; is considered complete. I have multiple people who are submitting to the queue. Since they each have 10k jobs each. Its the first 10k jobs from user A that get processed ,then the next 10k jobs from user B get processed. How could I mix the jobs so so that jobs from User A and User B are intermingled so that they both make progress and can review the results in realtime.<p>Question 2) Sometimes I inspect the smaller job results, and if they are bad, I delete the rest of the jobs. In redis I would need to select all jobs and filter them based off some criteria and then remove them. Im not sure how practical this is.<p>I have an accompanying database in postgresql. I was thinking about moving the queue to postgresql, but I think not giving the workers db access is safer&#x2F;easier, but maybe I&#x27;m wrong? Another alternative I was thinking is to make a db&#x2F;redis hybrid where postgresql is watching the redis queue and when the queue gets to under X items, it keeps filling up the queue. That seems like overkill.

1 comment

nadermxabout 2 years ago
Could try RQ <a href="https:&#x2F;&#x2F;python-rq.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;python-rq.org&#x2F;</a> it has enqueue funcs which can be called when one job finishes. Can fork, diff workers, etc. And simple