Skip to content

Asynq

A Go library that runs background tasks on worker processes, using Redis as the queue.

Stars
13.8k
Forks
991
Licence
MIT
Language
Go
Last update
18 days ago
Type
Library

What it is

Asynq is a Go library for putting jobs on a queue and having separate worker processes pick them up and run them in the background. It stores the queue in Redis, so several machines can share the work. It supports retries, scheduled and periodic tasks, priority queues, and a web UI and command-line tool for inspecting tasks.

  • Send emails in the background after a user action so the web request returns quickly
  • Resize or process uploaded images on separate worker servers
  • Schedule a task to run after a delay using ProcessIn or ProcessAt
  • Run periodic tasks on a timetable
  • Pause a queue or inspect and manage tasks through the web UI or CLI

Great for

  • Go developers who need background jobs such as sending emails or resizing images
  • Teams that already run Redis and want a task queue without adding another service type
  • Applications that need to spread work across multiple worker machines
  • Projects that want retries, scheduling, or priority queues without building them from scratch

Not ideal for

  • Non-Go projects, since it is a Go library and the README only shows Go usage
  • Teams without Redis (version 4.0 or higher is required) and no plans to run it
  • Setups using Redis Cluster, because the README warns some Lua scripts may not be compatible with it
  • Projects that need a stable v1 API guarantee, since the README says the public API could change before v1.0.0
Step-by-step guide: how to use AsynqInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Go (the last two Go versions are supported) · Redis 4.0 or higher, running locally or in Docker

    Install the Asynq library

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

    Run it

    • Start a Redis server locally or in a Docker container
    • Create a Go module with go mod init and install the library with go get
    • Write a package that defines task types, payload structs, and handler functions
    • Create a client with asynq.NewClient and call client.Enqueue to add a task
    • Run a worker server that processes tasks from the queue
  3. 3

    Get the most out of it

    • Use asynq.ProcessIn or asynq.ProcessAt to schedule tasks for later
    • Set MaxRetry and Timeout per task, or override them at enqueue time
    • Use weighted or strict priority queues to control which queues get processed first
    • Use the Web UI and CLI to inspect and remote-control queues and tasks
    • Use Prometheus integration to collect queue metrics

Downloads

Strengths

  • Covers common job-queue needs (retries, scheduling, priorities, timeouts, deduplication) in one library
  • Simple Go API with clear examples for defining task types and handlers
  • Has Prometheus integration and a web UI and CLI for monitoring

Trade-offs

  • Depends on Redis, so Redis availability and configuration matter for reliability
  • Some Lua scripts may not work with Redis Cluster
  • The README states the project is at v0.x, so the API may still change

How it compares

ProjectStarsTypeLevelUpdatedBest for
asynq (this)13.8kLibraryintermediate18 days agoGo developers who need background jobs such as sending emails or resizing images
temporal24.1kDev toolintermediate4 days agoBackend developers building multi-step processes that must finish reliably
codis13.2kDev tooladvanced2.6 years agoTeams running Redis that have outgrown a single server
go-zero33.4kLibraryintermediate5 days agoGo developers building REST APIs or microservices
kit27.4kLibraryadvanced2.3 years agoGo developers building service-oriented or microservice backends
kratos26kLibraryintermediate4 days agoGo developers building a set of backend services that talk over HTTP or gRPC

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.