生产环境的 tomcat 是不是不怎么用热部署的?

2017-01-19 23:08:18 +08:00
 cjyang1128

最近被 classloader 引发的内存泄漏弄得有点烦。。在想生产环境是不是直接 tomcat 重启算了。。。

3035 次点击
所在节点    Java
11 条回复
kanchi240
2017-01-19 23:21:10 +08:00
一般禁止的吧
snnn
2017-01-19 23:39:11 +08:00
对!!!
ihuotui
2017-01-20 00:13:59 +08:00
应该思考为什么内存溢出。
yidinghe
2017-01-20 01:15:35 +08:00
一个办法是部署至少两个 tomcat ,使用 session 共享,前面再加个反向代理,更新时轮流重启,保证服务不中断。
darrenfang
2017-01-20 09:14:25 +08:00
开发环境都经常出问题😂
Infernalzero
2017-01-20 09:27:08 +08:00
除非不用 spring,否则热部署其实没有太大意义,都要等初始化的时间
而热部署次数多了就容易 OOM ,那还不如直接重启容器了
xiaoyangsa
2017-01-20 09:37:22 +08:00
弄两台 tomcat 分开重启就行了
FifiLyu
2017-01-20 09:41:14 +08:00
https://tomcat.apache.org/tomcat-7.0-doc/config/context.html

reloadable

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.
cjyang1128
2017-01-20 10:00:45 +08:00
@ihuotui 找到原因了,但是感觉与其花代价去修复还不如直接禁用这个功能
domty
2017-01-20 10:28:26 +08:00
一般都是 ls 那种做法
靠 nginx 负载均衡和部署多服务来实现线上服务的部署的。
只要保证任何时间都起码有一个能稳定提供服务的就行。
cjyang1128
2017-01-20 12:50:35 +08:00
@domty soga

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/335730

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX