St.Antario
St.Antario

Reputation: 27425

Meaning of connectionTimeout in tomcat

What does that parameter mean for tomcat. It was declared in server.xml as follows:

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

So, I tried to change it...

<Connector connectionTimeout="2" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

...and didn't notice any effect. I expected that each page the load takes for more than 2 milliseconds would produce 504 - connection timeout error. But it didn't. I'm using eclipse and modify that file through it.

Upvotes: 20

Views: 69136

Answers (2)

Vali7394
Vali7394

Reputation: 499

This parameter is there specifically to fight one type of Denial-Of-Service attack, whereby some malicious client(s) create a TCP connection to the server (which has the effect of reserving some resources on the server for handling this connection), and then just sit there without sending any HTTP request on that connection. By making this delay shorter, you shorten the time during which the server resources are allocated, to serve a request that will never come.

Upvotes: 22

this.user3272243
this.user3272243

Reputation: 1246

Taken from here: https://tomcat.apache.org/tomcat-7.0-doc/config/http.html

connectionTimeout

The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. Use a value of -1 to indicate no (i.e. infinite) timeout. The default value is 60000 (i.e. 60 seconds) but note that the standard server.xml that ships with Tomcat sets this to 20000 (i.e. 20 seconds). Unless disableUploadTimeout is set to false, this timeout will also be used when reading the request body (if any).

Upvotes: 17

Related Questions