All Projects → aosen → Gopool

aosen / Gopool

Licence: apache-2.0
go连接池、Golang连接池、By Golang realize distributed common connection pool.

Programming Languages

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

Projects that are alternatives of or similar to Gopool

conn
netpoll事件驱动,goroutine协程池化,降低无效协程的资源占用,适用于高连接数(对于低频数据传输的场景,可以大幅降低协程数,提升资源利用率)
Stars: ✭ 28 (-53.33%)
Mutual labels:  connection-pool
Xredis
Redis C++ client, support the data slice storage, support redis cluster, thread-safe,multi-platform,connection pool, read/write separation.
Stars: ✭ 285 (+375%)
Mutual labels:  connection-pool
Libfastcommon
c common functions library extracted from my open source project FastDFS. this library is very simple and stable. functions including: string, logger, chain, hash, socket, ini file reader, base64 encode / decode, url encode / decode, fast timer, skiplist, object pool etc. detail info please see the c header files.
Stars: ✭ 739 (+1131.67%)
Mutual labels:  connection-pool
node-redshift
A simple collection of tools to help you get started with Amazon Redshift from node.js
Stars: ✭ 66 (+10%)
Mutual labels:  connection-pool
tk-pool
A connection pool implementation for tokio
Stars: ✭ 20 (-66.67%)
Mutual labels:  connection-pool
Hikari Cp
A Clojure wrapper to HikariCP JDBC connection pool
Stars: ✭ 334 (+456.67%)
Mutual labels:  connection-pool
Polyel-Framework
⚡️ Voltis Core: A PHP framework based on Swoole from the ground up
Stars: ✭ 22 (-63.33%)
Mutual labels:  connection-pool
Pgpool
A PosgreSQL client that automatically uses connection pools and handles reconnections in case of errors.
Stars: ✭ 38 (-36.67%)
Mutual labels:  connection-pool
Stormpot
A fast object pool for the JVM
Stars: ✭ 267 (+345%)
Mutual labels:  connection-pool
Hibernate Springboot
Collection of best practices for Java persistence performance in Spring Boot applications
Stars: ✭ 589 (+881.67%)
Mutual labels:  connection-pool
grpcp
grpcp is a Grpc Persistent Connection Pool.
Stars: ✭ 96 (+60%)
Mutual labels:  connection-pool
lighthouse
Easy clojure relational database queries, migrations and connection pooling
Stars: ✭ 19 (-68.33%)
Mutual labels:  connection-pool
Apnotic
A Ruby APNs HTTP/2 gem able to provide instant feedback.
Stars: ✭ 360 (+500%)
Mutual labels:  connection-pool
vertica-swoole-adapter
Provides a DB layer for Swoole-based applications to communicate to HP Vertica databases.
Stars: ✭ 14 (-76.67%)
Mutual labels:  connection-pool
Nexer
Content based network multiplexer or redirector made with love and Go
Stars: ✭ 7 (-88.33%)
Mutual labels:  connection-pool
pool
Go library that wraps http.Client to provide seamless higher-level connection pooling features
Stars: ✭ 39 (-35%)
Mutual labels:  connection-pool
Spring Boot Data Source Decorator
Spring Boot integration with p6spy, datasource-proxy, flexy-pool and spring-cloud-sleuth
Stars: ✭ 295 (+391.67%)
Mutual labels:  connection-pool
Chrome Pool
Headless chrome tabs manage pool
Stars: ✭ 40 (-33.33%)
Mutual labels:  connection-pool
Flexy Pool
FlexyPool adds metrics and failover strategies to a given Connection Pool, allowing it to resize on demand.
Stars: ✭ 856 (+1326.67%)
Mutual labels:  connection-pool
Redis Plus Plus
Redis client written in C++
Stars: ✭ 428 (+613.33%)
Mutual labels:  connection-pool

gopool

  • By Golang realize distributed common connection pool.

  • Golang分布式的连接池,协程池,内含redis client连接池实现

  • go get github.com/aosen/gopool

example

var addrs []string = []string{"127.0.0.1:8000", "127.0.0.1:8001", "127.0.0.1:8002", "127.0.0.1:8003"}

var epool Pooler

func InitExpPool() (err error) {
	if epool == nil {
		epool, err = NewChanConnPool(&ConnPoolReq{
			Addrs: addrs,
			Create: func(addr string, timeout time.Duration) (interface{}, error) {
				cli, err := net.DialTimeout("tcp", addr, timeout)
				return cli, err
			},
			IsOpen: func(cli interface{}) bool {
				if cli != nil {
					return true
				}
				return false
			},
			Down: func(cli interface{}) {
				c := cli.(net.Conn)
				c.Close()
			},
		})
		return
	}
	return
}

func Get() (cli net.Conn, err error) {
	if epool == nil {
		err = errors.New("no init epool.")
		return
	}
	cli, err = epool.Get()
	return
}

func Put(cli net.Conn, safe bool) {
	if epool == nil {
		err := errors.New("no init epool.")
		return
	}
	epool.Put(cli, safe)
}

func GetHealthy() map[string]bool {
	if epool == nil {
		return nil
	}
	return epool.GetHealthy()
}

func GetConnCount() map[string]int {
	if epool == nil {
		return nil
	}
	return epool.GetConnCount()
}
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].