-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Proposal
The library currently relies on default HTTP transport settings, which limits our ability to optimize for high-scale environments. Without access to connection pool configurations like MaxIdleConns or IdleConnTimeout, users cannot tune the client to prevent socket exhaustion or optimize for high-throughput scaling events.
Proposed Changes
I suggest exposing a TransportConfig struct via a new HTTPOption. This allows users to override the underlying http.Transport settings without having to provide a fully custom http.Client.
type TransportConfig struct {
MaxIdleConns int
MaxIdleConnsPerHost int
IdleConnTimeout time.Duration
DisableKeepAlives bool
}
func WithTransportConfig(config TransportConfig) HTTPOption {
return func(c *httpClientOption) {
c.transportConfig = &config
}
}Why this is needed
- High-Scale Performance: In environments with thousands of runners, the default
MaxIdleConnsPerHost(which is 2 in Go's default transport) can become a significant bottleneck, causing high latency due to constant connection recreation. - Resource Management: Custom
IdleConnTimeoutandMaxIdleConnsallow better control over the memory footprint and open file descriptors on the host. - Flexibility: Provides a clean way to disable keep-alives or tune the transport for specific network topologies without leaking implementation details.
Implementation Note
The httpClientOption should apply these settings to the http.Transport during client initialization, falling back to sensible defaults if the config is not provided.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels