pub struct PoolConfig {
pub max_idle_per_host: Option<usize>,
pub max_idle_total: usize,
pub idle_timeout: Duration,
pub tcp_keepalive: Option<Duration>,
pub tcp_nodelay: bool,
pub max_response_size: usize,
}Expand description
Configuration for HTTP connection pooling.
Controls how connections are reused across requests for better performance.
Fields§
§max_idle_per_host: Option<usize>Maximum number of idle connections per host. Default: unlimited (no limit)
max_idle_total: usizeMaximum total idle connections in the pool. Default: 100
idle_timeout: DurationHow long to keep idle connections alive. Default: 90 seconds
tcp_keepalive: Option<Duration>Whether to enable TCP keepalive. Default: true
tcp_nodelay: boolWhether to enable TCP nodelay (disable Nagle’s algorithm). Default: true
max_response_size: usizeMaximum response body size in bytes.
Default: 100 MB (104_857_600 bytes)
§Security
This limit helps prevent memory exhaustion from extremely large responses. The Aptos API responses are typically much smaller than this limit.
Implementations§
Source§impl PoolConfig
impl PoolConfig
Sourcepub fn builder() -> PoolConfigBuilder
pub fn builder() -> PoolConfigBuilder
Creates a new pool configuration builder.
Sourcepub fn high_throughput() -> Self
pub fn high_throughput() -> Self
Creates a configuration optimized for high-throughput scenarios.
- More idle connections
- Longer idle timeout
- TCP keepalive enabled
Sourcepub fn low_latency() -> Self
pub fn low_latency() -> Self
Creates a configuration optimized for low-latency scenarios.
- Fewer idle connections (fresher connections)
- Shorter idle timeout
- TCP nodelay enabled
Trait Implementations§
Source§impl Clone for PoolConfig
impl Clone for PoolConfig
Source§fn clone(&self) -> PoolConfig
fn clone(&self) -> PoolConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more