1

I'm trying to understand the difference between connection-timeout and idle-timeout for server.netty application configuration in spring-boot.

I was under the impression that

  • connection-timeout: refers to the maximum time that application server will wait for a client to send a request after a TCP connection has been established.
  • idle-timeout: amount of time an established connection remains open.

However, when I ran the following command setting connection-timeout to 10s and leaving idle-timeout to infinite.

$ time nc -vv localhost 8080
localhost [127.0.0.1] 8080 (http-alt) open
...

The connection did not timeout after 10s. However, setting the idle-connection to 10s does timeout the connection.

Question:

What is the difference between the two timeouts? I've read the spring boot doc but I did not get a functional understanding of the config.

CaptainDaVinci
  • 975
  • 7
  • 23
  • Keep the idle time out as 1 second and perform an operation for more than 1 second. You established the connection but the connection stayed alive for idle timeout still there was no response dumped to this session. – silentsudo Jul 19 '22 at 11:42
  • Does this answer your question? [What is the difference between idle-timeout and request timeout in akka http configuration?](https://stackoverflow.com/questions/44692435/what-is-the-difference-between-idle-timeout-and-request-timeout-in-akka-http-con) – silentsudo Jul 19 '22 at 11:43
  • @silentsudo No, the answer that you linked is for Akka HTTP config, and as I understand these connection timeouts can vary in meaning between servers. I'm specifically looking for the configuration meaning in netty server that comes with spring-boot. – CaptainDaVinci Jul 19 '22 at 17:31

1 Answers1

0

server.netty.idle-timeout sets the maximum time for an active and inactive connection can remain idle before it is closed. If not specified, it will use the default value of 0, meaning idle connections will not be closed automatically.

server.netty.connection-timeout sets the maximum idle time for inactive connections only.

magiccrafter
  • 5,175
  • 1
  • 56
  • 50