Shimingyah Pool Save

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

Project README

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.

Open Source Agenda is not affiliated with "Shimingyah Pool" Project. README Source: shimingyah/pool
Stars
195
Open Issues
9
Last Commit
1 year ago
Repository
License
Tags

Open Source Agenda Badge

Open Source Agenda Rating