#pool #grpc #tonic #channel

soda-pool

Connection pool for tonic's gRPC channels

1 unstable release

new 0.0.1 May 13, 2025

#86 in #tonic

Download history 82/week @ 2025-05-08

82 downloads per month

MIT/Apache

71KB
1.5K SLoC

soda-pool

⚠️ Note: Soda-pool library is in experimental stage.
Features may change, and breaking changes can occur while I integrate it in the production code I am working on. Use with caution.

Overview

Soda-pool is a set of libraries meant to help adapt tonic gRPC clients to be used in more dynamic world of microservices.

Soda-pool provides a dynamic, automatically managed pool of gRPC channels. Unlike the basic tonic's balanced channel, soda's pool is based on DNS resolution and automatically updates periodically to keep in sync with the true state of network.

Soda-pool is designed to be used in tandem with soda-pool-build rather than on it's own. Soda-pool-build builds upon soda-pool and tonic-build and can generate a gRPC client that on top of further simplifying channel pool management, supports also automatic request retrying.

Features

  • Automatically managed and updated gRPC connection pool
  • Configurable retrying of failed requests

For considered future features, see the roadmap.

Getting started

All of the documentation and examples assume prior familiarity with tonic ecosystem.

  • example-generator crate has a basic example of using a builder to generate a client that uses soda-pool internally.
  • example-protobuf crate has an exemplary client code generated by soda-pool-build.
  • example-client crate has a basic example of using the aforementioned client.

While soda-pool channel pool can be used directly, it is not designed to be done so, so no examples are given beyond the crate's documentation.

Rust Version

At this experimental stage, crates are developed against the latest stable Rust version. I plan on lowering MSRV as far as reasonable soon.

Dependencies

Soda-pool and generated clients depends heavily on tonic and tokio and the generated client code shares dependencies with the one generated by tonic-build.

Project Layout

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~8–19MB
~258K SLoC