rythm-sachdeva opened a new pull request, #2606:
URL: https://github.com/apache/iggy/pull/2606
## Description
Implements connection pooling for `AsyncTcpConnection` using Netty's
`FixedChannelPool` to handle concurrent async operations efficiently.
## Changes
- **Connection Pooling**: Replaced single channel with `FixedChannelPool`
for concurrent request handling
- **Pool Metrics**: Added `PoolMetrics` class to track:
- Active connections
- Total requests and errors
- Wait times (min/max/average in nanoseconds, microseconds, and
milliseconds)
- Error rate percentage
- **Configuration**: Added `TCPConnectionPoolConfig` with builder pattern
for customizing:
- Max connections (default: 5)
- Max pending acquires (default: 1000)
- Acquire timeout (default: 3000ms)
- **Request Correlation**: Implemented FIFO queue-based request/response
matching using `ConcurrentLinkedQueue`
- **Broadcast Operations**: Added `broadcastAsync()` method to execute
commands across all pooled connections (useful for authentication)
- **Client Integration**: Exposed pool configuration via
`AsyncIggyTcpClient.Builder.connectionPoolSize()`
## Implementation Details
- Uses Netty's `FixedChannelPool` with `ChannelHealthChecker.ACTIVE`
- Each channel has its own `IggyResponseHandler` with a response queue
- Pool automatically releases channels after request completion
- Handles connection errors gracefully with proper cleanup
## Testing
- Added integration test `testConnectionPoolMetrics()` to verify metrics
tracking
- Existing async integration tests validate concurrent operations
- Pool properly handles concurrent sends and polls
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]