How Do You Handle Async Tasks in Production?

January 1, 2026 5 answers
Asked by SunnyDayExplorer92
I'm working on several APIs that need to utilize an asynchronous pattern, particularly for tasks that involve database stored procedure calls that can take anywhere from 5 to 20 minutes. I also encounter situations where some jobs require more compute power. I know that using Celery with Redis is quite common for managing async jobs, but I'm curious about how others are implementing it in a production environment, especially when there are multiple APIs with different job requirements.

Answers

TechieAdventurer
Celery and Redis is a solid combo! The central Redis broker allows all your APIs to queue jobs efficiently, plus you can spin up workers for individual services which scales really well in production. Just keep an eye on memory usage in case you end up with huge queues.

DevNinja12: Totally agree! It works almost perfectly until you encounter those bizarre silent failures that might go unnoticed for ages. Debugging them later can be a nightmare.

Reply to this answer
TaskGuru101
Iโ€™ve switched to TaskIQ with RedisStreams for a modern async solution. However, what youโ€™re describing feels more like durable workflow processes rather than simple tasks. Maybe look into tools like Temporal or Prefect for complex workflows.
Reply to this answer
AsyncFanatic
In my opinion, that 20-30 minute duration is quite long for asyncio. While it queues jobs and manages other tasks simultaneously, if you get disconnected or something goes wrong, you might lose track of the ongoing jobs. It might be smarter to log the job status to a file and periodically check for its completion.
Reply to this answer
ResilientCoder
Using a file for job status is definitely a clever approach! It may turn into a simple job queue, but itโ€™s probably worth it if you care about reliability, especially for lengthy processes.
Reply to this answer
CodeMagician77
I've mostly gone with Celery using RabbitMQ as a broker. Itโ€™s a reliable way to persist tasks, so if RabbitMQ has issues, you wonโ€™t lose your tasks. Although, I have to be honest, Iโ€™m not a huge fan of it overall.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions