Skip to content

dk-kroos/pool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pool

this project is forked from https://github.com/shimingyah/pool

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/dk-laosiji/pool"
)
go get github.com/dk-laosiji/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/dk-laosiji/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

Packages

No packages published

Languages

  • Go 100.0%