2013/09/09

Tomcat timeout config

Apache-Tomcat間コネクションのタイムアウト値が設定されておらず、
デフォルトのままだったために、コネクションを無制限に維持する
最新のは60秒、ゴロゴロ変わるね。。。

Tomcatのserver.xmlのconnectionTimeoutを明示的に設定し、
connectionTimeoutはミリ秒単位なので、以下の例だと5分
<Connector port=”8083″maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″
    enableLookups=”false” redirectPort=”443″ acceptCount=”100″
    debug=”0″ connectionTimeout=”30000″
    disableUploadTimeout=”true” />


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).



Connection timeout and session timeout are two totally different things.

Connection timeouts have to do with how long the server will leave a connection between the browser and server open after a response is complete.

Session-timeout is what controls the length of time that an idle session will last.

As to the session-timeout setting in conf/web.xml; I can't say for sure, but I'm guessing that 30 minutes is the default whether that entry is there or not and that the entry is there to make it easier for folks who want to change it to find it.
Out of curiosity, why do you care if there is a default value?