zlacker

[parent] [thread] 6 comments
1. ramraj+(OP)[view] [source] 2019-05-27 11:46:06
Always hear using redis etc for job queues, what do these "job queues" entail? I've been an amateur and have used postgres tables as queues .. am I not being efficient?
replies(2): >>fsaint+02 >>actuat+23
2. fsaint+02[view] [source] 2019-05-27 12:08:17
>>ramraj+(OP)
Tables as queues is perfectly legit, one less component to worry about.
replies(2): >>actuat+b3 >>Stavro+W3
3. actuat+23[view] [source] 2019-05-27 12:18:06
>>ramraj+(OP)
Well, they are just a mechanism to push jobs between different components where you treat Redis as a message queue. In Redis you can implement one using Lists, Sorted Sets, Stream or Pub/Sub; though they are commonly implemented through the first two. Though if you end up using first two, to guarantee at least once semantics you need to take care of acknowledgement in a not so pleasant way.

You can replace Redis with pretty much any message queue though like RabbitMQ which has a better consumption story. The main advantage of using any one of these would be the throughout you can achieve and it decouples your database at that point which a lot of people prefer.

◧◩
4. actuat+b3[view] [source] [discussion] 2019-05-27 12:19:30
>>fsaint+02
One more advantage it gives is you can have pretty easy job guarantees through the database transactions.
◧◩
5. Stavro+W3[view] [source] [discussion] 2019-05-27 12:26:55
>>fsaint+02
Does anyone have any rough performance numbers on each approach? I'll only use DB tables when I don't want to deploy Redis (which I usually do, as a cache or whatever), and I'll use RabbitMQ for more "serious" projects. On small projects, I'll even forgo Redis and use the DB as a cache too, which works pretty well.

What do y'all do?

replies(1): >>ramraj+6n
◧◩◪
6. ramraj+6n[view] [source] [discussion] 2019-05-27 15:23:14
>>Stavro+W3
My job queue requirements have been very modest (less than ten jobs per hour) and no more than 2 or 3 workers. I also generally have redis deployed but it never occurred to me to use it given it's "ephemeral" nature - always remained paranoid that services on the cloud should always be assumed to go down at any time
replies(1): >>Stavro+Mn
◧◩◪◨
7. Stavro+Mn[view] [source] [discussion] 2019-05-27 15:28:53
>>ramraj+6n
I generally agree, but I have Redis as part of my main stack now, and it's been pretty solid. I'm fairly distrustful of "cloud" services, though, so I run my stuff on Hetzner and manage them myself. For my revenues, where a day's downtime might cost me $5/mo in lost revenue, I think it makes more sense.
[go to top]