jBoss 4.0.2 多次部署相同的 WAR 会导致 jBoss 由于 PermGem/Out-of-Memory 错误而崩溃 [英] jBoss 4.0.2 deploying same WAR multiple times causes jBoss to crash because of PermGem/Out-of-Memory Errors

查看:15
本文介绍了jBoss 4.0.2 多次部署相同的 WAR 会导致 jBoss 由于 PermGem/Out-of-Memory 错误而崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发 Web 应用程序并使用 jBoss 4.0.2,当我用 Eclipse 重新部署我的 WAR 几次时,jBoss 会因为内存不足而崩溃.当我必须在生产环境中安装新版本时,它会消耗生产服务器的内存,所以这意味着我必须停止 jBoss 以防止重新部署客户服务器的内存.有没有办法解决这个问题?

I develop web applications and I use jBoss 4.0.2 and when I have redeployed my WAR several times with eclipse, jBoss will crash because it runs out of memory. And when I have to install new version to production enviroment, it will consume production servers memory, so that means I have to stop jBoss to prevent redeploying eat memory from customers server. Is there any work around for this problem?

推荐答案

基本上没有.由于 JBoss 类加载器的工作方式,每次部署都会使用一部分永久代,即使取消部署应用也不会释放.

Basically, no. Because of the way the JBoss classloaders work, each deployment will use up a chunk of PermGen that will not be released even if the application is undeployed.

您可以通过将 PermGen 内存池大小增加到几百兆(甚至是 gig)来缓解症状,这使得问题更容易解决.我还发现,减少代码中静态字段的使用(尤其是引用大对象的静态字段)可以减少对 PermGen 的影响.

You can mitigate the symptoms by ramping up the PermGen memory pool size to several hundred megs (or even gigs), which makes the problem easier to live with. I've also found that reducing the usage of static fields in your code (especially static fields that refer to large objects) reduces the impact on PermGen.

理想情况下,我不会在生产中使用热部署,而是关闭服务器,更换 WAR/EAR,然后重新启动它.

Ideally, I would not use hot deployment in production, but rather shut the server down, replace the WAR/EAR, then restart it.

这篇关于jBoss 4.0.2 多次部署相同的 WAR 会导致 jBoss 由于 PermGem/Out-of-Memory 错误而崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆