Is it a good practice to clear `work` and `temp` directory when deploying applications to Tomcat?
I wonder if work
and temp
should generally be left to be manged by Tomcat or should I manually clear it from time to time?
In our specific case new versions of the applications are always enumerated with ##
notation (e.g. app##123.war
, a next one is app##124.war
). So conflicts between versions should not happen. But old versions seem to be kept by Tomcat in work/Catalina/localhost
.
Also note that - in our case - most heavy applications are always updated together. There are some tools (like jolokia
) which are updated in a separate process.
So would there be any significant performance gain in manually removing old applications form Tomcat's cache dirs? Or maybe the server would start slower because of those other apps of which cache would be removed in the process?
There will be no performance gain in clearing old app versions out of work
and temp
.
It is a good idea to clear them out when you upgrade Tomcat (even point release upgrades). On rare occasions (maybe 2-3 times in 10 years), Tomcat will change the code generation for JSPs in a way that is incompatible with previous versions. If you don't clear out the work
directory, you may see strange errors.