All Projects β†’ ivpusic β†’ Grpool

ivpusic / Grpool

Licence: mit
Lightweight Goroutine pool

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Grpool

workerpool
A workerpool that can get expanded & shrink dynamically.
Stars: ✭ 55 (-91.07%)
Mutual labels:  pool, goroutine
Honeydew
Job Queue for Elixir. Clustered or Local. Straight BEAM. Optional Ecto. πŸ’ͺ🍈
Stars: ✭ 670 (+8.77%)
Mutual labels:  pool, workers
Gorpool
Simple Goroutine pool
Stars: ✭ 37 (-93.99%)
Mutual labels:  pool, goroutine
errgroup
errgroup with goroutine worker limits
Stars: ✭ 143 (-76.79%)
Mutual labels:  pool, goroutine
noroutine
Goroutine analogue for Node.js, spreads I/O-bound routine calls to utilize thread pool (worker_threads) using balancer with event loop utilization. 🌱
Stars: ✭ 86 (-86.04%)
Mutual labels:  workers, goroutine
gohive
🐝 A Highly Performant and easy to use goroutine pool for Go
Stars: ✭ 41 (-93.34%)
Mutual labels:  pool, goroutine
goroutine-pool
A simple goroutine pool which can create and release goroutine dynamically, inspired by fasthttp.
Stars: ✭ 31 (-94.97%)
Mutual labels:  pool, goroutine
Ants
🐜🐜🐜 ants is a high-performance and low-cost goroutine pool in Go, inspired by fasthttp./ ants ζ˜―δΈ€δΈͺι«˜ζ€§θƒ½δΈ”δ½ŽζŸθ€—ηš„ goroutine 池。
Stars: ✭ 7,180 (+1065.58%)
Mutual labels:  pool, goroutine
Pgagroal
High-performance connection pool for PostgreSQL
Stars: ✭ 362 (-41.23%)
Mutual labels:  pool
Html
HTML Standard
Stars: ✭ 5,217 (+746.92%)
Mutual labels:  workers
Mojito
An easy-to-use Elixir HTTP client, built on the low-level Mint library.
Stars: ✭ 333 (-45.94%)
Mutual labels:  pool
Golang runtime reading
golang 1.10.2 runtime code reading - golang runtimeζΊη εˆ†ζžγ€‚εͺζœ‰ζ€θ€ƒθΏ‡οΌŒδ½ ζ‰δΌšε°θ±‘ζ·±εˆ»γ€‚
Stars: ✭ 393 (-36.2%)
Mutual labels:  goroutine
Flower
Real-time monitor and web admin for Celery distributed task queue
Stars: ✭ 5,036 (+717.53%)
Mutual labels:  workers
Machine
Machine is a zero dependency library for highly concurrent Go applications. It is inspired by errgroup.Group with extra bells & whistles
Stars: ✭ 346 (-43.83%)
Mutual labels:  goroutine
Btcpool Abandoned
backend of pool.btc.com
Stars: ✭ 541 (-12.18%)
Mutual labels:  pool
Reading
ζ•΄η†ι˜…θ―»θΏ‡ηš„εΉ²θ΄§ζ–‡η« , 帖子
Stars: ✭ 318 (-48.38%)
Mutual labels:  goroutine
Dingo
An easy-to-use, distributed, extensible task/job queue framework for #golang
Stars: ✭ 289 (-53.08%)
Mutual labels:  workers
Pool
🚌 A golang general network connection poolction pool
Stars: ✭ 588 (-4.55%)
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 (-13.64%)
Mutual labels:  goroutine
Node Worker Nodes
A node.js library to run cpu-intensive tasks in a separate processes and not block the event loop.
Stars: ✭ 468 (-24.03%)
Mutual labels:  workers

grpool

Build Status

Lightweight Goroutine pool

Clients can submit jobs. Dispatcher takes job, and sends it to first available worker. When worker is done with processing job, will be returned back to worker pool.

Number of workers and Job queue size is configurable.

Docs

https://godoc.org/github.com/ivpusic/grpool

Installation

go get github.com/ivpusic/grpool

Simple example

package main

import (
  "fmt"
  "runtime"
  "time"

  "github.com/ivpusic/grpool"
)

func main() {
  // number of workers, and size of job queue
  pool := grpool.NewPool(100, 50)

  // release resources used by pool
  defer pool.Release()

  // submit one or more jobs to pool
  for i := 0; i < 10; i++ {
    count := i

    pool.JobQueue <- func() {
      fmt.Printf("I am worker! Number %d\n", count)
    }
  }

  // dummy wait until jobs are finished
  time.Sleep(1 * time.Second)
}

Example with waiting jobs to finish

package main

import (
  "fmt"
  "runtime"

  "github.com/ivpusic/grpool"
)

func main() {
  // number of workers, and size of job queue
  pool := grpool.NewPool(100, 50)
  defer pool.Release()

  // how many jobs we should wait
  pool.WaitCount(10)

  // submit one or more jobs to pool
  for i := 0; i < 10; i++ {
    count := i

    pool.JobQueue <- func() {
      // say that job is done, so we can know how many jobs are finished
      defer pool.JobDone()

      fmt.Printf("hello %d\n", count)
    }
  }

  // wait until we call JobDone for all jobs
  pool.WaitAll()
}

License

MIT

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].