gammazero/workerpool

Concurrency limiting goroutine pool

Go

1,460

115 commits

updated Oct 12, 2026

See the code

README

workerpool

GoDoc Build Status codecov License

Concurrency limiting goroutine pool. Limits the concurrency of task execution, not the number of tasks queued. Never blocks submitting tasks, no matter how many tasks are queued.

If you need a worker pool that blocks when all workers are busy, see workers.

This implementation builds on ideas from the following:

Installation

To install this package, you need to setup your Go workspace. The simplest way to install the library is to run:

$ go get github.com/gammazero/workerpool

Example

package main

import (
	"fmt"
	"github.com/gammazero/workerpool"
)

func main() {
	wp := workerpool.New(2)
	requests := []string{"alpha", "beta", "gamma", "delta", "epsilon"}

	for _, r := range requests {
		wp.Submit(func() {
			fmt.Println("Handling request:", r)
		})
	}

	wp.StopWait()
}

Example wrapper function to show start and finish time of submitted function.

Usage Note

There is no upper limit on the number of tasks queued, other than the limits of system resources. If the number of inbound tasks is too many to even queue for pending processing, then the solution is outside the scope of workerpool. It should be solved by distributing workload over multiple systems, and/or storing input for pending processing in intermediate storage such as a file system, distributed message queue, etc.

concurrency
worker-pool

Project health

Overall

3.0/10

Maintained

1/10

Code review

1/10
OpenSSF Scorecard

Latest release

v1.2.1 · Feb 14, 2026

Releases this year

2

Significant stargazers

Graham Campbell

7,103 followers · starred Jan 2024

David Zhao

425 followers · starred Aug 2021

Daniel (Shijun) Qian

219 followers · starred Jul 2020

Jamie Mansfield

117 followers · starred Dec 2020

gammazero/workerpool

Concurrency limiting goroutine pool

Go

1,460

115 commits

updated Oct 12, 2026

See the code

README

workerpool

GoDoc Build Status codecov License

Concurrency limiting goroutine pool. Limits the concurrency of task execution, not the number of tasks queued. Never blocks submitting tasks, no matter how many tasks are queued.

If you need a worker pool that blocks when all workers are busy, see workers.

This implementation builds on ideas from the following:

Installation

To install this package, you need to setup your Go workspace. The simplest way to install the library is to run:

$ go get github.com/gammazero/workerpool

Example

package main

import (
	"fmt"
	"github.com/gammazero/workerpool"
)

func main() {
	wp := workerpool.New(2)
	requests := []string{"alpha", "beta", "gamma", "delta", "epsilon"}

	for _, r := range requests {
		wp.Submit(func() {
			fmt.Println("Handling request:", r)
		})
	}

	wp.StopWait()
}

Example wrapper function to show start and finish time of submitted function.

Usage Note

There is no upper limit on the number of tasks queued, other than the limits of system resources. If the number of inbound tasks is too many to even queue for pending processing, then the solution is outside the scope of workerpool. It should be solved by distributing workload over multiple systems, and/or storing input for pending processing in intermediate storage such as a file system, distributed message queue, etc.

concurrency
worker-pool

Project health

Overall

3.0/10

Maintained

1/10

Code review

1/10
OpenSSF Scorecard

Latest release

v1.2.1 · Feb 14, 2026

Releases this year

2

Significant stargazers

Graham Campbell

7,103 followers · starred Jan 2024

David Zhao

425 followers · starred Aug 2021

Daniel (Shijun) Qian

219 followers · starred Jul 2020

Jamie Mansfield

117 followers · starred Dec 2020