Repolode
hibiken

hibiken/asynq

Go library for distributed task queues backed by Redis, with scheduling, retries, priority queues and a web UI.

Stars
13,784
Forks
991
Open issues
293
Last commit
3 days ago

What is it?

Asynq is a Go library for putting tasks on queues and processing them asynchronously with worker goroutines. Clients enqueue tasks into Redis, and one or more worker servers pull them off and run them concurrently, which lets work be spread across multiple machines.

The library covers common background-job needs: scheduled and periodic tasks, retries for failed tasks, recovery of tasks after a worker crash, weighted and strict priority queues, de-duplication with a unique option, per-task timeouts and deadlines, and grouping of tasks into batches. Handlers can be plain functions or types implementing an interface, and middleware is supported.

Operations tooling includes Prometheus metrics, Redis Sentinel support for high availability, a separate Asynqmon web UI for inspecting and controlling queues and tasks, and a command line tool called asynq. Redis 4.0 or higher is required, and some Lua scripts may not work with Redis Cluster.

Key features

  • 01Scheduled, periodic and delayed task execution
  • 02Automatic retries and recovery of tasks after worker crashes
  • 03Weighted and strict priority queues
  • 04Task de-duplication, timeouts and deadlines
  • 05Task aggregation for batching successive operations
  • 06Prometheus metrics, Redis Sentinel support, web UI and CLI

Use cases

  • Sending emails or notifications in the background without blocking HTTP requests
  • Resizing images or processing uploads on separate worker machines
  • Running periodic jobs such as cleanup or report generation in a Go service
  • Distributing heavy workloads across several servers with Redis as the broker

Quick start

  1. 1

    Install Go and make sure a Redis server (version 4.0 or higher) is running

  2. 2

    Install the Asynq library in your Go module

    go get -u github.com/hibiken/asynq
  3. 3

    Write a task package, then enqueue tasks with a Client and process them with a Server

Things to know

  • Requires a Redis server (version 4.0 or higher) to store and move tasks.
  • Still at v0.x, so the public API may change without a major version bump before v1.0.0.
  • Some Lua scripts may not be compatible with Redis Cluster.

Topics

FAQ

What is asynq?
Go library for distributed task queues backed by Redis, with scheduling, retries, priority queues and a web UI. Asynq is a Go library for putting tasks on queues and processing them asynchronously with worker goroutines. Clients enqueue tasks into Redis, and one or more worker servers pull them off and run them concurrently, which lets work be spread across multiple machines.
Is asynq free to use? What license does it have?
asynq is open source under the MIT license. Check the license terms before using it in commercial products.
Is asynq still maintained?
Actively maintained. The last commit to asynq was on Oct 19, 2026.
What can I use asynq for?
Sending emails or notifications in the background without blocking HTTP requests Resizing images or processing uploads on separate worker machines Running periodic jobs such as cleanup or report generation in a Go service Distributing heavy workloads across several servers with Redis as the broker
How do I install asynq?
Install Go and make sure a Redis server (version 4.0 or higher) is running Install the Asynq library in your Go module: go get -u github.com/hibiken/asynq Write a task package, then enqueue tasks with a Client and process them with a Server
Where can I get asynq?
The source code and installation instructions are on GitHub: https://github.com/hibiken/asynq

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects