workerpool alternatives and similar packages
Based on the "Goroutines" category.
Alternatively, view workerpool alternatives based on common mentions on social networks and blogs.
-
ants
๐๐๐ ants is a high-performance and low-cost goroutine pool in Go, inspired by fasthttp./ ants ๆฏไธไธช้ซๆง่ฝไธไฝๆ่็ goroutine ๆฑ ใ -
goworker
goworker is a Go-based background worker that runs 10 to 100,000* times faster than Ruby-based workers. -
pool
:speedboat: a limited consumer goroutine or unlimited goroutine pool for easier goroutine handling and cancellation -
pond
๐ Minimalistic and High-performance goroutine worker pool written in Go -
Goflow
Simply way to control goroutines execution order based on dependencies -
go-workers
๐ท Library for safely running groups of workers concurrently or consecutively that require input and output through channels -
artifex
Simple in-memory job queue for Golang using worker-based dispatching -
async
A safe way to execute functions asynchronously, recovering them in case of panic. It also provides an error stack aiming to facilitate fail causes discovery. -
semaphore
๐ฆ Semaphore pattern implementation with timeout of lock/unlock operations. -
gollback
Go asynchronous simple function utilities, for managing execution of closures and callbacks -
go-do-work
Dynamically resizable pools of goroutines which can queue an infinite number of jobs. -
Hunch
Hunch provides functions like: All, First, Retry, Waterfall etc., that makes asynchronous flow control more intuitive. -
gpool
gpool - a generic context-aware resizable goroutines pool to bound concurrency based on semaphore. -
routine
go routine control, abstraction of the Main and some useful Executors.ๅฆๆไฝ ไธไผ็ฎก็Goroutine็่ฏ๏ผ็จๅฎ -
goccm
Limits the number of goroutines that are allowed to run concurrently -
kyoo
Unlimited job queue for go, using a pool of concurrent workers processing the job queue entries -
go-waitgroup
A sync.WaitGroup with error handling and concurrency control -
gowl
Gowl is a process management and process monitoring tool at once. An infinite worker pool gives you the ability to control the pool and processes and monitor their status. -
channelify
Make functions return a channel for parallel processing via go routines. -
conexec
A concurrent toolkit to help execute funcs concurrently in an efficient and safe way. It supports specifying the overall timeout to avoid blocking. -
go-tools/multithreading
A collection of tools for Golang -
execpool
A pool that spins up a given number of processes in advance and attaches stdin and stdout when needed. Very similar to FastCGI but works for any command. -
hands
Hands is a process controller used to control the execution and return strategies of multiple goroutines. -
concurrency-limiter
Concurrency limiter with support for timeouts , dynamic priority and context cancellation of goroutines. -
queue
package queue gives you a queue group accessibility. Helps you to limit goroutines, wait for the end of the all goroutines and much more. -
github.com/akshaybharambe14/gowp
High performance, type safe, concurrency limiting worker pool package for golang! -
oversight
Oversight is a complete implementation of the Erlang supervision trees.
Less time debugging, more time building
Do you think we are missing an alternative of workerpool or a related project?
README
๐จโ๐ง worker-pool
Go simple async worker pool.
๐ ABOUT
Worker pool is a software design pattern for achieving concurrency of task execution. Maintains multiple workers waiting for tasks to be allocated for concurrent execution. By maintaining a pool of workers, the model increases performance and avoids latency in execution. The number of available workers might be tuned to the computing resources available.
You can read more about worker pools in Go here.
Contributors:
Want to contribute ? Feel free to send pull requests!
Have problems, bugs, feature ideas? We are using the github issue tracker to manage them.
๐ Documentation
For examples visit godoc#pkg-examples
For GoDoc reference, visit pkg.go.dev
๐ HOW TO USE
๐ Benchmark
CPU: 3,3 GHz Intel Core i7
RAM: 16 GB 2133 MHz LPDDR3
โ worker-pool git:(master) โ go test -bench=. -cpu=4 -benchmem
goos: darwin
goarch: amd64
pkg: github.com/vardius/worker-pool/v2
BenchmarkWorker1-4 3944299 284 ns/op 56 B/op 3 allocs/op
BenchmarkWorker1Parallel-4 7394715 138 ns/op 48 B/op 2 allocs/op
BenchmarkWorker100-4 1657569 693 ns/op 56 B/op 3 allocs/op
BenchmarkWorker100Parallel-4 3673483 368 ns/op 48 B/op 2 allocs/op
BenchmarkWorkerNumCPU-4 2590293 445 ns/op 56 B/op 3 allocs/op
BenchmarkWorkerNumCPUParallel-4 3591553 298 ns/op 48 B/op 2 allocs/op
PASS
ok github.com/vardius/worker-pool/v2 9.511s
๐ซ Basic example
package main
import (
"fmt"
"sync"
"github.com/vardius/worker-pool/v2"
)
func main() {
var wg sync.WaitGroup
poolSize := 1
jobsAmount := 3
workersAmount := 2
// create new pool
pool := workerpool.New(poolSize)
out := make(chan int, jobsAmount)
worker := func(i int) {
defer wg.Done()
out <- i
}
for i := 1; i <= workersAmount; i++ {
if err := pool.AddWorker(worker); err != nil {
panic(err)
}
}
wg.Add(jobsAmount)
for i := 0; i < jobsAmount; i++ {
if err := pool.Delegate(i); err != nil {
panic(err)
}
}
go func() {
// stop all workers after jobs are done
wg.Wait()
close(out)
pool.Stop() // stop removes all workers from pool, to resume work add them again
}()
sum := 0
for n := range out {
sum += n
}
fmt.Println(sum)
// Output:
// 3
}
๐ [License](LICENSE.md)
This package is released under the MIT license. See the complete license in the package
*Note that all licence references and agreements mentioned in the workerpool README section above
are relevant to that project's source code only.