9

I would like to know what the relationship between the connectionTimeout and keepAliveTimeout properties of the tomcat connectors is. Should they be set to the same value (as it's the default)?

What is the effect of keepAliveTimeout being less than the connectionTimeout?

Thanks

Radi Radichev
  • 562
  • 6
  • 13

1 Answers1

16

connectionTimeout defines how long Tomcat will wait for a client request after client connected.

keepAliveTimeout is how long Tomcat will wait for another request before closing the connection

In other words, connectionTimeout is how long Tomcat will wait for the first HTTP request to be sent after TCP connection was established, keepAliveTimeout is how long it will wait for another request to be sent over the same connection

Evgeniy Dorofeev
  • 133,369
  • 30
  • 199
  • 275
  • Thank you, I read those definitions as well. However that doesn't really answer my questions. How do they relate to each other? – Radi Radichev May 05 '15 at 06:30
  • 1
    I think they are not related at all. E.g. keepAliveTimeout can be less or greater than the connectionTimeout. The best way to see how they work is to write a Java client which will send 2 HTTP requests with 2 timeouts – Evgeniy Dorofeev May 05 '15 at 06:40
  • Ok, but if keepAliveTimeout is set to lets say 5s and connectionTimeout to 20s, tomcat will close the connection after 5s if no request, and then the connectionTimeout is effectively also 5s, right? This seems quite weird... – Radi Radichev May 05 '15 at 09:27
  • connectionTimeout is how long Tomcat will wait for first connection to send request, keepAliveTimeout is how long it will wait for a next request – Evgeniy Dorofeev May 05 '15 at 09:33
  • Ahhh, I understand now. Could you please update your answer with this information and I'll accept it. Thanks! – Radi Radichev May 05 '15 at 09:48