How to change Tomcat's undeployOldVersions timeout?

Viewed 100

Tomcat has a feature to deploy a new version with no downtime and gracefully undeploy an old version (when no sessions are left from an old client).

All you need to start using this feature is setting undeployOldVersions to true and have a .war file with a name of special format.

My experiments have shown that it waits at least 10 minutes (in the absence of traffic) to undeploy an old version. Is this timeout configurable in Tomcat settings?

1 Answers

The old version is undeployed when all the sessions that used it expire.

The default expiration timeout of a Tomcat session is 30 minutes, but this is configurable per application. E.g. you can add:

<session-config>
    <session-timeout>10</session-timeout>
</session-config>

to decrease the default timeout of a session to 10 minutes. This value can also be set in your application's code either globally or on a per-session level.

Related