Skip to content

a concise implement of gRPC connection pool, based on buffered channel.

License

Notifications You must be signed in to change notification settings

NiclasLindqvist/grpcpool

 
 

Repository files navigation

gRPC Connection Pool

Actions Status Go Report Card codecov

It's a simple implement of grpc connection pool, based on buffered channel.

Requirement

  • Go 1.9+

Usage

import "github.com/wuxinwei/grpcpool"

// create a grpc pool
sa := ServiceArg
Create(grpc.Dial, 5, 10, sa)

// got a connection from pool, and create a grpc client
conn, _ := grpcpool.Get()
cli := pb.NewHelloClient(conn)

// do whatever you want with grpc client

// after you finish your work, remember to put the conn back into the pool
grpcpool.PutBack(conn)

// you can close your pool do your own purpose
grpcpool.Close()

About

a concise implement of gRPC connection pool, based on buffered channel.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%