PostgreSQL as a Celery Broker

I’m currently using Redis as the broker for Celery, but since I already have PostgreSQL running, I wondered if I could use it as a broker instead. This would eliminate the need for a separate Redis server, saving cost a bit.

I came across this GitHub …


This content originally appeared on DEV Community and was authored by Kamal Mustafa

I’m currently using Redis as the broker for Celery, but since I already have PostgreSQL running, I wondered if I could use it as a broker instead. This would eliminate the need for a separate Redis server, saving cost a bit.

I came across this GitHub issue discussing PostgreSQL as a potential Celery broker. This led me to discover an interesting alternative task queue called BQ, which is built specifically to use PostgreSQL for task management.

What caught my attention with BQ is that it use mix way to process tasks: the traditional polling method and a pub-sub model, which is pretty unique. For those unfamiliar, BQ’s pub-sub system leverages PostgreSQL’s NOTIFY function. The way it works is that when a new task is added, NOTIFY sends a signal to listening clients, so they can act immediately—no more constant polling to check for new tasks, which can be more efficient.

One thing I’ve been mindful of when working with task queues is the noisy neighbor problem, where one task queue can consume too many resources and affect the performance of others. I haven’t fully explored how BQ handles this, but it’s definitely something to look into if you’re considering a PostgreSQL-based task queue.


This content originally appeared on DEV Community and was authored by Kamal Mustafa


Print Share Comment Cite Upload Translate Updates
APA

Kamal Mustafa | Sciencx (2024-10-23T01:48:20+00:00) PostgreSQL as a Celery Broker. Retrieved from https://www.scien.cx/2024/10/23/postgresql-as-a-celery-broker/

MLA
" » PostgreSQL as a Celery Broker." Kamal Mustafa | Sciencx - Wednesday October 23, 2024, https://www.scien.cx/2024/10/23/postgresql-as-a-celery-broker/
HARVARD
Kamal Mustafa | Sciencx Wednesday October 23, 2024 » PostgreSQL as a Celery Broker., viewed ,<https://www.scien.cx/2024/10/23/postgresql-as-a-celery-broker/>
VANCOUVER
Kamal Mustafa | Sciencx - » PostgreSQL as a Celery Broker. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/23/postgresql-as-a-celery-broker/
CHICAGO
" » PostgreSQL as a Celery Broker." Kamal Mustafa | Sciencx - Accessed . https://www.scien.cx/2024/10/23/postgresql-as-a-celery-broker/
IEEE
" » PostgreSQL as a Celery Broker." Kamal Mustafa | Sciencx [Online]. Available: https://www.scien.cx/2024/10/23/postgresql-as-a-celery-broker/. [Accessed: ]
rf:citation
» PostgreSQL as a Celery Broker | Kamal Mustafa | Sciencx | https://www.scien.cx/2024/10/23/postgresql-as-a-celery-broker/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.