Fork me on GitHub

Task queues

Task queues handle background work that need to be processed outside the usual HTTP request-response cycle. These tasks are handled asynchronously because HTTP requests must be responded back to by the server as fast as possible otherwise the user experience in the web browser will suffer. The most common types of jobs for task queues include

  • calculating computationally expensive data analytics

  • scheduling periodic jobs such as batch processes

  • spreading out large numbers of independent database inserts over time instead of all at once

  • aggregating collected data values on a fixed interval, such as every 15 minutes

Task queue projects

  • The Celery distributed task queue is the most commonly used Python library for handling asynchronous tasks and scheduling.

  • The RQ (Redis Queue) is a simple Python library for queueing jobs and processing them in the background with workers. RQ is backed by Redis and is designed to have a low barrier to entry. The intro post contains information on design decisions and how to use RQ.

  • Taskmaster is a lightweight simple distributed queue for handling large volumes of one-off tasks.

Task queue resources

What's next after task queues?

How do I monitor my app and its task queues with logging?

How can I learn more about the users of my application?

What tools exist for monitoring a live web application?


Interested in a complete Full Stack Python book with detailed tutorials and example code? Sign up here and you'll get an alert email if a book is created. No other emails will be sent other than sign up confirmation.