0

I am looking for ways to identify the default timeout configured on our container application. For this I was trying the nc command

The application is running on a GCP VM host with a public IP as a docker container . The port I am trying to probe does not exists so that I can find the timeout value for the application.

Probing the IP of the container shows below results

 $ time nc -v 172.28.36.5 8546
 nc: connect to 172.28.36.5 port 8546 (tcp) failed: Connection refused

 real    0m0.005s
 user    0m0.000s
 sys     0m0.005s

$ time nc -v 34.91.145.25 8546
nc: connect to 34.91.145.25 port 8546 (tcp) failed: Connection timed out

real    2m10.123s
user    0m0.000s
sys     0m0.004s

How the timeout value is calculated as it is different for container ip and external ip of the host ?

My task is to increase the tcp timeout value of the container .

Is it determined by the following parameters ? But in that case it should have been greater than 10 minutes .

$ cat /proc/sys/net/ipv4/tcp_keepalive_time 7200

Any suggestions ?

Zama Ques
  • 1,497
  • 5
  • 26
  • 45

2 Answers2

0

It doesn't seem to be the correct way to identify the keep-alive time. You can check out how to identify timeout here.

To answer your second question, yes, TCP timeout is determined by

/proc/sys/net/ipv4/tcp_keepalive_time

The default value of keep_alive_time is 7200 seconds (2 hours), which is greater than 10 minutes as expected.

For your first question, to increase the TCP timeout time, you can refer this page.

Vatsal
  • 61
  • 1
  • 3
0

This depends on what you mean by "TCP timeout".

The page that Vatsal linked (https://serverfault.com/questions/216956/how-to-check-tcp-timeout-in-linux-macos) shows you many different flavors of these timeouts.

It seems, that you are mixing two different things and it's not about being in the container or not.

  • Your first command fails with "connection refused", that's why it's so fast. It means that the connection was immediately rejected.
  • Your second command fails with "connection timed out", that's why it takes longer. This is usually related to the net.inet.tcp.keepinit OS setting.

You can read more about their differences here:

Juraj Martinka
  • 3,991
  • 2
  • 23
  • 25