Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/authzed/consistent
gRPC Balancer that routes requests using a consistent hashring
https://github.com/authzed/consistent
consistent-hash-ring grpc grpc-client grpc-go load-balancer
Last synced: 2 months ago
JSON representation
gRPC Balancer that routes requests using a consistent hashring
- Host: GitHub
- URL: https://github.com/authzed/consistent
- Owner: authzed
- License: apache-2.0
- Created: 2023-07-31T06:44:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-09T22:01:20.000Z (over 1 year ago)
- Last Synced: 2024-06-19T00:20:42.178Z (7 months ago)
- Topics: consistent-hash-ring, grpc, grpc-client, grpc-go, load-balancer
- Language: Go
- Homepage:
- Size: 130 KB
- Stars: 38
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE-OF-CONDUCT.md
Awesome Lists containing this project
README
# consistent
[![GoDoc](https://godoc.org/github.com/authzed/consistent?status.svg)](https://godoc.org/github.com/authzed/consistent)
[![Discord Server](https://img.shields.io/discord/844600078504951838?color=7289da&logo=discord "Discord Server")](https://authzed.com/discord)
[![Twitter](https://img.shields.io/badge/twitter-%40authzed-1D8EEE?logo=twitter "@authzed on Twitter")](https://twitter.com/authzed)This package implements a gRPC Balancer that routes requests based upon a consistent hashring.
The hashing algorithm is customizable, but xxhash is recommended.
It was originally built to serve [SpiceDB](https://github.com/authzed/spicedb), but has been extracted from that repository to be made available for other projects.In order to use this balancer, you must:
1. Register the balancer (typically in `main`):
```go
balancer.Register(consistent.NewBuilder(xxhash.Sum64))
```2. Configure the connections:
```go
// This is using the defaults, but you can create your own config.
grpc.Dial(addr, grpc.WithDefaultServiceConfig(consistent.DefaultServiceConfigJSON))
```## Acknowledgements
This project is a community effort fueled by contributions from both organizations and individuals.
We appreciate all contributions, large and small, and would like to thank all those involved.A large portion of the structure of this library is based off of the example implementation in [grpc-go](https://github.com/grpc/grpc-go).
That original work is copyrighted by the gRPC authors and licensed under the Apache License, Version 2.0.