Intro

Asynq is an asynchronous task framework for the Go language, which uses Redis as a message queue and possesses scalability and simplicity.

Asynq asynchronous task solution:

  • The client puts tasks into the queue.
  • The server retrieves tasks from the queue and starts a worker thread (goroutine) for each task.
  • Multiple worker goroutines process tasks in parallel.

A task queue is a mechanism for distributing work across multiple machines. The system can consist of multiple worker servers and agents to achieve high availability and horizontal scalability.

Task Queue Diagram

Features

  • Ensures at least once task execution
  • Task scheduling
  • Retrying failed tasks
  • Automatic task recovery when a worker thread crashes
  • Weighted priority queue
  • Strict priority queue
  • Low delay in adding tasks due to fast write operations in Redis
  • Duplicates tasks using unique options
  • Allows setting timeouts and deadlines for each task
  • Allows aggregating a group of tasks to perform multiple consecutive operations in batches
  • Flexible handler interface with support for middleware
  • Allows pausing the queue to stop processing tasks from the queue
  • Periodic tasks
  • Supports Redis Cluster for automatic sharding and high availability
  • Supports Redis Sentinel for high availability
  • Integration with Prometheus to collect and visualize queue metrics
  • Web interface for inspecting and remotely controlling queues and tasks
  • Command-line interface for inspecting and remotely controlling queues and tasks