https://github.com/shimingyah/pool
Connection pool for Go's grpc client with supports connection reuse.
https://github.com/shimingyah/pool
go grpc pool
Last synced: about 1 year ago
JSON representation
Connection pool for Go's grpc client with supports connection reuse.
- Host: GitHub
- URL: https://github.com/shimingyah/pool
- Owner: shimingyah
- License: apache-2.0
- Created: 2019-06-04T05:24:34.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-09T06:50:00.000Z (almost 4 years ago)
- Last Synced: 2025-04-02T07:51:15.583Z (about 1 year ago)
- Topics: go, grpc, pool
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 208
- Watchers: 3
- Forks: 49
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pool
[](https://godoc.org/github.com/shimingyah/pool)
[](https://goreportcard.com/report/github.com/shimingyah/pool)
[](https://github.com/shimingyah/pool/blob/master/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](https://github.com/shimingyah/pool/tree/master/example)
# Reference
* [https://github.com/fatih/pool](https://github.com/fatih/pool)
* [https://github.com/silenceper/pool](https://github.com/silenceper/pool)
# License
Pool is under the Apache 2.0 license. See the [LICENSE](https://github.com/shimingyah/pool/blob/master/LICENSE) file for details.