All Projects → fatih → Pool

fatih / Pool

Licence: mit
Connection pool for Go's net.Conn interface

Programming Languages

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

Labels

Projects that are alternatives of or similar to Pool

Pebble
Multi threading and processing eye-candy.
Stars: ✭ 276 (-76.49%)
Mutual labels:  pool
Ants
🐜🐜🐜 ants is a high-performance and low-cost goroutine pool in Go, inspired by fasthttp./ ants 是一个高性能且低损耗的 goroutine 池。
Stars: ✭ 7,180 (+511.58%)
Mutual labels:  pool
Errand Boy
A memory-conscious alternative to os.fork() and subprocess.Popen().
Stars: ✭ 34 (-97.1%)
Mutual labels:  pool
Pgagroal
High-performance connection pool for PostgreSQL
Stars: ✭ 362 (-69.17%)
Mutual labels:  pool
Btcpool Abandoned
backend of pool.btc.com
Stars: ✭ 541 (-53.92%)
Mutual labels:  pool
Coiniumserv
Next-gen crypto currency mining pool software
Stars: ✭ 651 (-44.55%)
Mutual labels:  pool
Gowp
golang worker pool , Concurrency limiting goroutine pool
Stars: ✭ 259 (-77.94%)
Mutual labels:  pool
Open Ethereum Pool
Open Ethereum Mining Pool
Stars: ✭ 1,062 (-9.54%)
Mutual labels:  pool
Pool
🚌 A golang general network connection poolction pool
Stars: ✭ 588 (-49.91%)
Mutual labels:  pool
Go Extend
go语言扩展包,收集一些常用的操作函数,辅助更快的完成开发工作,并减少重复代码
Stars: ✭ 839 (-28.53%)
Mutual labels:  pool
Libcopp
cross-platform coroutine library in c++
Stars: ✭ 398 (-66.1%)
Mutual labels:  pool
Groupco
PHP的服务化框架。适用于Api、Http Server、Rpc Server;帮助原生PHP项目转向微服务化。出色的性能与支持高并发的协程相结合
Stars: ✭ 473 (-59.71%)
Mutual labels:  pool
Honeydew
Job Queue for Elixir. Clustered or Local. Straight BEAM. Optional Ecto. 💪🍈
Stars: ✭ 670 (-42.93%)
Mutual labels:  pool
Mojito
An easy-to-use Elixir HTTP client, built on the low-level Mint library.
Stars: ✭ 333 (-71.64%)
Mutual labels:  pool
Gorpool
Simple Goroutine pool
Stars: ✭ 37 (-96.85%)
Mutual labels:  pool
Stormpot
A fast object pool for the JVM
Stars: ✭ 267 (-77.26%)
Mutual labels:  pool
Grpool
Lightweight Goroutine pool
Stars: ✭ 616 (-47.53%)
Mutual labels:  pool
Cardano Node Docker
Docker container for setting up and running a Cardano Stake Pool
Stars: ✭ 68 (-94.21%)
Mutual labels:  pool
Lite Pool
A lite fast object pool
Stars: ✭ 42 (-96.42%)
Mutual labels:  pool
Oeasypool
c++11 thread pool
Stars: ✭ 18 (-98.47%)
Mutual labels:  pool

Archived project. No maintenance.

This project is not maintained anymore and is archived. Feel free to fork and use make your own changes if needed.

Thanks all for their work on this project.

Pool GoDoc Build Status

Pool is a thread safe connection pool for net.Conn interface. It can be used to manage and reuse connections.

Install and Usage

Install the package with:

go get github.com/fatih/pool

Please vendor the package with one of the releases: https://github.com/fatih/pool/releases. master branch is development branch and will contain always the latest changes.

Example

// create a factory() to be used with channel based pool
factory    := func() (net.Conn, error) { return net.Dial("tcp", "127.0.0.1:4000") }

// create a new channel based pool with an initial capacity of 5 and maximum
// capacity of 30. The factory will create 5 initial connections and put it
// into the pool.
p, err := pool.NewChannelPool(5, 30, factory)

// now you can get a connection from the pool, if there is no connection
// available it will create a new one via the factory function.
conn, err := p.Get()

// do something with conn and put it back to the pool by closing the connection
// (this doesn't close the underlying connection instead it's putting it back
// to the pool).
conn.Close()

// close the underlying connection instead of returning it to pool
// it is useful when acceptor has already closed connection and conn.Write() returns error
if pc, ok := conn.(*pool.PoolConn); ok {
  pc.MarkUnusable()
  pc.Close()
}

// close pool any time you want, this closes all the connections inside a pool
p.Close()

// currently available connections in the pool
current := p.Len()

Credits

License

The MIT License (MIT) - see LICENSE for more details

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