3

I'm playing around with tuning various tcp settings for high number of outgoing client connections. I've put following in my /etc/sysctl.conf on Ubuntu 16.04.

net.ipv4.ip_local_port_range = 18000 65535 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_fin_timeout = 3

I've applied them using sysctl -p then i made a new connection to one of my servers using netcat then terminated it:

nc 35.158.221.XXX 22

Then i checked netstat using following command :

netstat -on | grep TIME_WAIT | less

In every situation, the connection was removed correctly within 3 seconds period.

Now the problem:

Shortly after above, i've started a python script with a lot of threads spawning outgoing http connections. In this script however, the connections' TIME_WAIT state is expiring STILL after default number of 60 seconds.

1

Any reason why is this happening and python's connections are ignoring the kernel setting? How is that even possible? Why the setting is not being applied to this process? Did i forget about flushing some cache or anything?

0

You must log in to answer this question.