Skip to content
forked from shimingyah/pool

Connection pool for Go's grpc client with supports connection reuse.

License

Notifications You must be signed in to change notification settings

titaniumyuer/pool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pool

GoDoc Go Report Card LICENSE

Connection pool for Go's grpc client that supports connection reuse.

Pool provides additional features:

  • Connection reuse supported by specific MaxConcurrentStreams param.
  • Failure reconnection supported by grpc's keepalive.

Getting started

Install

Import package:

import (
    "github.com/shimingyah/pool"
)
go get github.com/shimingyah/pool

Usage

p, err := pool.New("127.0.0.1:8080", pool.DefaultOptions)
if err != nil {
    log.Fatalf("failed to new pool: %v", err)
}
defer p.Close()

conn, err := p.Get()
if err != nil {
    log.Fatalf("failed to get conn: %v", err)
}
defer conn.Close()

// cc := conn.Value()
// client := pb.NewClient(conn.Value())

See the complete example: https://github.com/shimingyah/pool/tree/master/example

Reference

License

Pool is under the Apache 2.0 license. See the LICENSE file for details.

About

Connection pool for Go's grpc client with supports connection reuse.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%