-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
triageThe issue needs triaging.The issue needs triaging.
Description
The default Go HTTP client has MaxIdleConnsPerHost: 2, which is insufficient for microservices making frequent requests to the same host. This causes:
- Connection pool exhaustion errors:
"http: putIdleConn: too many idle connections for host" - Increased latency: Connection establishment time increases from 4.5ms to 13.6ms (3x slower)
- Poor connection reuse, leading to unnecessary connection overhead
Suggested Solution
Add configurable HTTP connection pool settings to gofr's HTTP service initialization, allowing users to customize:
MaxIdleConns: Maximum idle connections across all hostsMaxIdleConnsPerHost: Maximum idle connections per host (critical setting)IdleConnTimeout: How long to keep idle connections
Proposed Changes
- Add HTTP connection pool configuration options to
App.AddHTTPService()method - Apply settings to the HTTP client's transport used by gofr's HTTP services
Benefits
- Eliminates connection pool exhaustion errors
- Improves performance for high-frequency inter-service calls
- Backward compatible
Configuration
Allow configuration via:
- Programmatic API: Optional parameters to
AddHTTPService()
Metadata
Metadata
Assignees
Labels
triageThe issue needs triaging.The issue needs triaging.