-
Notifications
You must be signed in to change notification settings - Fork 196
Open
Description
Describe the Problem
When integrating Apache Commons Pool (general-purpose object pool) with MilvusClientV2 (Milvus Java SDK v2.x) in MilvusClientV2Pool, there's a critical conflict that wastes the multiplexing capability of HTTP/2 (H2) — the underlying transport protocol of gRPC used by MilvusClientV2.
Background & Technical Context
- MilvusClientV2 gRPC/H2 Foundation:
MilvusClientV2relies on gRPC, which uses H2 as the transport layer. H2's core advantage is single Channel multiplexing — multiple concurrent RPC streams can share one TCP connection, avoiding redundant connections and optimizing resource utilization. - Apache Commons Pool Behavior: Commons Pool is designed for generic object lifecycle management (borrow/return/idle/destroy). However, it has no built-in awareness or adaptation for H2 protocol features (e.g., multiplexing, concurrent stream limits, shared Channel management).
Current Conflict & Impact
When pooling MilvusClientV2 instances with Commons Pool:
- Redundant H2 Connections: By default, each pooled
MilvusClientV2creates an independent gRPC Channel (and thus an independent H2 TCP connection). This completely negates H2's multiplexing design, leading to unnecessary resource consumption (TCP connections, memory) and reduced performance. - Misalignment with H2 Stream Control: H2 has a default concurrent stream limit (100 streams per Channel). Commons Pool cannot recognize this limit, so it cannot adapt pooling logic to avoid exceeding H2's constraints (e.g., no coordination between pool maxTotal and H2's max concurrent streams).
- Wasted Optimization Potential: The core value of H2/gRPC (efficient multiplexing) is lost, making the object pool a counterproductive layer in this integration scenario.
Expected Behavior
We expect a way to use Apache Commons Pool with MilvusClientV2 while:
- Retaining H2's multiplexing capability (all pooled
MilvusClientV2instances share a single gRPC/H2 Channel). - Aligning pool management with H2's features (e.g., respecting H2's concurrent stream limits, avoiding redundant connections).
Questions for Maintainers
- Is there an official recommended approach to resolve this conflict? (e.g., custom
PooledObjectFactoryfor shared H2 Channel, or alternative pooling strategies compatible withMilvusClientV2's gRPC/H2 design) - Are there plans to optimize
MilvusClientV2's compatibility with common object pool frameworks like Apache Commons Pool, to better leverage H2's multiplexing? - If a custom integration is required (e.g., shared Channel in pool factory), are there any SDK-specific constraints or best practices to avoid stability issues (e.g., Channel lifecycle management, thread safety)?
Metadata
Metadata
Assignees
Labels
No labels