大网数据广告活动
服务器运维问答

Is it a good practice to clear `work` and `temp` directory when deploying applications to Tomcat?

· 52CE 我爱测

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##12…

问题原文

原帖链接 · Nux · CC BY-SA 4.0

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?

已采纳解答

原帖链接 · Mark Thomas · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-10-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。