Enhancements for the `ChannelPool`

未关闭
#35 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@0xCryptoZen 已经在做这个了。

开始于 2023年7月3日。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
rust
领域
networking

调研方向

首先定位 ChannelPool 的实现和 with_channel 入口点,然后明确提议的功能中哪些属于范围之内。在修改 pool 之前,定义最大连接数和连接过期的预期行为;完成标准应包括就这两项功能达成一致的行为,以及验证它们对池化 gRPC 连接的影响。

由索引模型根据 Issue 内容生成。

描述

Background:

ChannelPool is a struct for managing gRPC client connections, providing basic connection pooling functionality. While it already offers some useful features, there are potential improvements and extensions that could further enhance performance, stability, and maintainability.

Proposed Features:

  • Maximum Connection Limit: To prevent creating too many simultaneous connections, consider adding a maximum connection limit to the ChannelPool struct. Concurrent connection creation can be controlled using a Semaphore or other concurrency control structures.

  • Connection Expiration: Add an expiration time for each connection in the ChannelPool. Connections exceeding this duration would be automatically closed, ensuring connections don't remain open indefinitely.

I chose to implement these two features because they can significantly improve performance and reduce resource usage. Additionally, these features lay the groundwork for future improvements.
There are also any other features about ChannelPool, for example :

  • Smarter Connection Recycling Strategy: The current implementation simply discards connections when they encounter errors. Implement a smarter recycling strategy, such as deciding when to close connections based on their usage frequency or idle time.

  • Connection Health Checks: Perform periodic health checks on connections to ensure that the connections in the pool are still functional. If unhealthy connections are discovered, remove them from the pool and create new connections as needed.

  • Connection Load Balancing: If connecting to a service with multiple backend instances, consider implementing connection load balancing. Choose between round-robin, least connections, or other load balancing strategies based on connection usage.

  • Detailed Error Handling and Logging: For easier debugging and troubleshooting, consider adding more detailed error handling and logging within the code.

  • Generics: The current implementation of the with_channel method requires a function returning a Result<T, Status>. Consider using a generic error type to make it more adaptable to different error handling requirements.

主要语言
Rust
星标
425
派生
89
平均合并
2 小时 48 分钟
30 天内合并 PR
3

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

qdrant/rust-client 的其他 Issue

查看 qdrant/rust-client 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。