Large portlet war takes up memory causing performance issues?

。_饼干妹妹 提交于 2019-12-06 14:27:24

The short response is: yes, deploying a war file with a lot of jars "could" cause performance issue. It does not matter if the war contains a portlet or a standard web application. But in my opinion you should not worry about this prematurely, because there are easy solutions for this problem.

When a portlet or any webApp is loaded into the server it loads the classes of the main jar into the "Permanent generation" region of the heap (memory assigned to the Java process) of the web server. This region stores the code that is executed. When these classes use code from other jars, their code is also loaded into this region. If this regions is filled up, you will get an OutOfMemoryError exception.

The solutions for your problems are easy:

  1. Dedicate more memory to your memory (parameter -Xmx of the JVM)

  2. If you have several .war files with the same jar files in them, remove those jars from the war files and put them in the directory where all the common libraries of the Web Server are located. The location of this directory depends on the Web App server that you are using.

So, you should not worry about this problem because it has a solution.

This PDF http://java.sun.com/j2se/reference/whitepapers/memorymanagement_whitepaper.pdf explains how memory management works in Java. It applies to regular Java apps and Web applications.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!