Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have no strong opinion on this as long as you are not using queues for purposes of inter-thread communication.

If you are using queues for this purpose, then I recommend reading the following:

https://lmax-exchange.github.io/disruptor/disruptor.html#_th...

> When in use, queues are typically always close to full or close to empty due to the differences in pace between consumers and producers. They very rarely operate in a balanced middle ground where the rate of production and consumption is evenly matched.

This has always been my experience. Has anyone ever had a perfect goldilocks scenario between 2 threads?




One good use-case for still using queues is if your producer or consumer has spiky characteristics on small timescales, but predicatable perfomance if you zoom out enough. In that case your queue size spikes to some high value, but always returns to 0.

The reasons for this can be numerous, maybe you produce a lot of jobs at once because of a user interaction, or your consumer is running slower for five minutes because some cron job is stealing your resources.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: