V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cjyang1128
V2EX  ›  Java

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

  •  
  •   cjyang1128 · 2017-01-19 23:08:18 +08:00 · 3028 次点击
    这是一个创建于 2655 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    11 条回复    2017-01-20 12:50:35 +08:00
    kanchi240
        1
    kanchi240  
       2017-01-19 23:21:10 +08:00
    一般禁止的吧
    snnn
        2
    snnn  
       2017-01-19 23:39:11 +08:00 via Android
    对!!!
    ihuotui
        3
    ihuotui  
       2017-01-20 00:13:59 +08:00
    应该思考为什么内存溢出。
    yidinghe
        4
    yidinghe  
       2017-01-20 01:15:35 +08:00 via Android   ❤️ 1
    一个办法是部署至少两个 tomcat ,使用 session 共享,前面再加个反向代理,更新时轮流重启,保证服务不中断。
    darrenfang
        5
    darrenfang  
       2017-01-20 09:14:25 +08:00
    开发环境都经常出问题😂
    Infernalzero
        6
    Infernalzero  
       2017-01-20 09:27:08 +08:00
    除非不用 spring,否则热部署其实没有太大意义,都要等初始化的时间
    而热部署次数多了就容易 OOM ,那还不如直接重启容器了
    xiaoyangsa
        7
    xiaoyangsa  
       2017-01-20 09:37:22 +08:00
    弄两台 tomcat 分开重启就行了
    FifiLyu
        8
    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
        9
    cjyang1128  
    OP
       2017-01-20 10:00:45 +08:00
    @ihuotui 找到原因了,但是感觉与其花代价去修复还不如直接禁用这个功能
    domty
        10
    domty  
       2017-01-20 10:28:26 +08:00
    一般都是 ls 那种做法
    靠 nginx 负载均衡和部署多服务来实现线上服务的部署的。
    只要保证任何时间都起码有一个能稳定提供服务的就行。
    cjyang1128
        11
    cjyang1128  
    OP
       2017-01-20 12:50:35 +08:00
    @domty soga
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1019 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:05 · PVG 03:05 · LAX 12:05 · JFK 15:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.