c := &http.Client{
Transport: &http.Transport{
MaxIdleConnsPerHost: 10000,
}
}
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuseecho "9000 65500" > /proc/sys/net/ipv4/ip_local_port_rangeecho 500000 > /proc/sys/fs/file-max
Hi James, thanks for your answer! Does it also mean, every MSL seconds kernel is allotting a new fixed pool of ephemeral ports that service can use, and before new ports are allotted it is impossible to reassign already used port? If yes, is this pool is per process or it is globally available?I always thought, once I close HTTP client connection, the used port is getting available immediately.I would like to understand this in details, will be also very happy if you can redirect me to some readings on this topic.Thanks!
--pooozdrawiam :-)
Hi James, thanks for your answer! Does it also mean, every MSL seconds kernel is allotting a new fixed pool of ephemeral ports that service can use, and before new ports are allotted it is impossible to reassign already used port?
If yes, is this pool is per process or it is globally available?
I always thought, once I close HTTP client connection, the used port is getting available immediately.
I would like to understand this in details, will be also very happy if you can redirect me to some readings on this topic.
Is there any way to tell kernel to close this connection after shorter time then 60 seconds? These are my linux network tunning parameters:net.core.somaxconn = 65535net.core.netdev_max_backlog = 65536net.core.rmem_max = 131071net.core.wmem_max = 131071net.ipv4.ip_local_port_range = 9101 65535net.ipv4.tcp_fin_timeout = 3net.ipv4.tcp_max_syn_backlog = 262144net.ipv4.tcp_max_tw_buckets = 2097152net.ipv4.tcp_no_metrics_save = 1net.ipv4.tcp_low_latency = 1net.ipv4.tcp_rmem = 4095 65535 131071net.ipv4.tcp_sack = 1net.ipv4.tcp_syncookies = 0net.ipv4.tcp_timestamps = 0net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_window_scaling = 1net.ipv4.tcp_wmem = 4095 65535 131071net.netfilter.nf_conntrack_max = 4194304net.netfilter.nf_conntrack_tcp_timeout_established = 600net.netfilter.nf_conntrack_tcp_timeout_time_wait = 5I thought net.netfilter.nf_conntrack_tcp_timeout_time_wait should do this job.