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

wuxinwei/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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages