Struts2 PermGen 内存不足错误
我注意到在大型应用程序中发生了这种情况,其中前端服务器非常快地吞噬了 PermGen,最糟糕的是它在每个请求上都不断增加,有时即使我们根本不向应用程序服务器发出任何请求,它也会不断增加。我在 tomcat 6.0.33、tomcat6.0.29 上都遇到过这个问题。
为了找出问题所在,我空白地选择了 struts,但令我沮丧的是,它显示出相同的趋势。这是正常的吗? 我尝试使用 maven (mvn archetype:generate) 检查几个版本的 struts2,如 2.2.1、2.2.1.1、2.2.3.1,在 jetty 中运行它们后,我注意到 PermGen 空间在每个请求中都被填满了 2 -3KB。我正在 struts Blank 和 jetty-6.1.21 上进行测试。
由于永久代随着请求数量的增加而增加,我怀疑将其投入生产有多少价值?
I noticed this occurrence in big application where the front end server was gobbling up PermGen quite fast, worst part it kept on increasing on every request, sometimes it just keeps on increasing even though we don't do any request to the application server at all. I faced this with tomcat 6.0.33, tomcat6.0.29 both.
To isolate the problem I picked up struts blank and to my dismay it was showing the same trend. Is this normal?
I tried checking out a few version of struts2 like 2.2.1, 2.2.1.1, 2.2.3.1 using maven (mvn archetype:generate) and after running them in jetty, I noticed that the PermGen space is filled up in every request by 2-3KB. I am testing on struts blank and jetty-6.1.21.
Since PermGen is increasing as a function of number of request I suspect how much worthy is it to go to production with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
唯一确定的方法是附加一个探查器并查看哪些类占用了最多的内存,并尝试查找内存泄漏。您可以将 jvm 配置为在崩溃时转储堆,并将生成的文件加载到分析器中以查看崩溃时堆的状态。
Struts 用于许多生产 Web 应用程序。我认为这更有可能是你的应用程序的问题。
The only way to know for sure is to attach a profiler and look at which classes are taking up the most memory, and try to find a memory leak. You can configure you jvm to dump the heap on crash, and load the resulting file into a profiler to look at the state of the heap when it crashed.
Struts is used in many production web apps. I think it is more likely a problem with your app.