akvo-rsr
akvo-rsr copied to clipboard
Use a real queue worker
Currently, RSR uses cronjobs to handle one-time background tasks. Using a proper queue worker opens up the possibility to defer tasks to the queue such as sending email and processing data that was previously done in the request handler.
There are multiple available choices. The most known one is probably Celery and maybe Apache Kafka.
| Name | active | Task search/listing | django ORM broker | python package | Ease of use | setup costs |
|---|---|---|---|---|---|---|
| celery | yes | no | maybe | yes | medium | medium |
| django-q | no | no | yes | yes | easy | low |
| dramatiq | yes | no | yes | medium | ||
| kafka | yes | no | no | difficult | high | |
| python-rq | yes | no | yes | easy | medium |
With all things considered, I think going with celery is the best.
Celery requires rabbitMQ or some other message queue. Seems like an unnecessary hassle for what we want to do (run a few jobs async). It's not like we're some high throughput application. Should we require high performance, multiple workers, and 5 9s for async tasks, we can talk about rabbitmq, kafka, etc.
Going with django-q which simply allows using postgres for queuing tasks.