DEV Community

Tommi k Vincent
Tommi k Vincent

Posted on

Asynchronous tasks in Django.

Definition: is the process of offloading workload from request/response cycle by executing certain tasks in background. example a video sharing platform allowing users to upload videos , the site might return a response informing that the trans-coding will start soon and start trans-coding the video asynchronously.

Type of Asynchronous tasks in Django.

1 Workers : Workers are processes that execute tasks asynchronously. In Django, you can use a worker system like Celery to handle asynchronous task execution. Workers typically listen for tasks from a message queue and execute them when they become available.
2 Message queues: Message queues are data structures that store messages sent between different parts of an application or between different applications. In the context of Django, message queues are often used to decouple the process of en-queuing tasks from the process of executing them. Celery, for example, can use message queues such as RabbitMQ, Redis, or others to distribute tasks to workers.
3 Message brokers:Message brokers handle the routing of messages between the Django application and the Celery workers.

Top comments (0)