yale8848 / Gorpool
Licence: mit
Simple Goroutine pool
Stars: ✭ 37
Projects that are alternatives of or similar to Gorpool
Ants
🐜🐜🐜 ants is a high-performance and low-cost goroutine pool in Go, inspired by fasthttp./ ants 是一个高性能且低损耗的 goroutine 池。
Stars: ✭ 7,180 (+19305.41%)
Mutual labels: pool, goroutine
goroutine-pool
A simple goroutine pool which can create and release goroutine dynamically, inspired by fasthttp.
Stars: ✭ 31 (-16.22%)
Mutual labels: pool, goroutine
workerpool
A workerpool that can get expanded & shrink dynamically.
Stars: ✭ 55 (+48.65%)
Mutual labels: pool, goroutine
gohive
🐝 A Highly Performant and easy to use goroutine pool for Go
Stars: ✭ 41 (+10.81%)
Mutual labels: pool, goroutine
Golang runtime reading
golang 1.10.2 runtime code reading - golang runtime源码分析。只有思考过,你才会印象深刻。
Stars: ✭ 393 (+962.16%)
Mutual labels: goroutine
Machine
Machine is a zero dependency library for highly concurrent Go applications. It is inspired by errgroup.Group with extra bells & whistles
Stars: ✭ 346 (+835.14%)
Mutual labels: goroutine
Mojito
An easy-to-use Elixir HTTP client, built on the low-level Mint library.
Stars: ✭ 333 (+800%)
Mutual labels: pool
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+1337.84%)
Mutual labels: goroutine
Honeydew
Job Queue for Elixir. Clustered or Local. Straight BEAM. Optional Ecto. 💪🍈
Stars: ✭ 670 (+1710.81%)
Mutual labels: pool
Groupco
PHP的服务化框架。适用于Api、Http Server、Rpc Server;帮助原生PHP项目转向微服务化。出色的性能与支持高并发的协程相结合
Stars: ✭ 473 (+1178.38%)
Mutual labels: pool
gorpool
Simple Goroutine pool
How to use
go get github.com/yale8848/[email protected]
Simple example
package main
import (
"github.com/yale8848/gorpool"
"time"
"fmt"
)
func main() {
// workerNum is worker number of goroutine pool ,one worker have one goroutine ,
// jobNum is job number of job pool
p := gorpool.NewPool(5, 10).
Start()
defer p.StopAll()
for i := 0; i < 100; i++ {
count := i
p.AddJob(func() {
time.Sleep(10 * time.Millisecond)
fmt.Printf("%d\r\n", count)
})
}
time.Sleep(2 * time.Second)
}
WaitForAll
package main
import (
"fmt"
"github.com/yale8848/gorpool"
"time"
)
func main() {
p := gorpool.NewPool(5, 10).
Start().
EnableWaitForAll(true)
for i := 0; i < 100; i++ {
count := i
p.AddJob(func() {
time.Sleep(10 * time.Millisecond)
fmt.Printf("%d\r\n", count)
})
}
p.WaitForAll()
p.StopAll()
}
SetIdleDuration
After set idle duration , the worker will stop it worker go routine
package main
import (
"fmt"
"github.com/yale8848/gorpool"
"time"
)
func main() {
p := gorpool.NewPool(5, 10).
SetIdleDuration(3 * time.Second).
Start().
EnableWaitForAll(true)
for i := 0; i < 100; i++ {
count := i
p.AddJob(func() {
time.Sleep(5 * time.Second)
fmt.Printf("%d\r\n", count)
})
}
p.WaitForAll()
p.StopAll()
}
Doc
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].