Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Large Permgen size + performance impact

We are running a liferay portal on tomcat 6. Each portlet is a contained web application so it includes all libraries the portlet itself requires. We currently have 30+ portlets. The result of this is that the permgen of our tomcat increases with each portlet we deploy.

We now have two paths we can follow. Either move some of the libraries which are commenly used by each of our portlets to the tomcat shared library. This would include stuff like spring/hibernate/cxf/.... to decrease our permgen size Or easier would be to increase the permgen size.

This second option would allow us to keep every portlet as a selfcontained entity.

The question now is, is there any negative performance impact from increasing the permgen size? We are currently running at 512MB. I have found little to no information about this. But found some post were people are talking about running on 1024MB permgen size without issues.

like image 423
user1344117 Avatar asked Apr 19 '12 13:04

user1344117


1 Answers

As long as you have enough memory on your server, I can't imagine anything can go wrong. If you don't, well, the Tomcat wouldn't even start, probably, because it wouldn't be able to allocate enough memory. So, if it does start up, you're good. As far as my experience goes, 1GB PermGen is perfectly sound.

The downside of a large PermGen is that it leaves you with less system memory you can then allocate for heap (Xmx).

On the other hand, I'd advise you to reconsider the benefits of thinking of portlets as self-contained entities. For example:

  • interoperability issues: if all the portlets are allowed to potentially use different versions of same libraries, there is some risk that they won't cooperate with each other and with the portal itself as intended
  • performance: PermGen footprint is just one thing, but adding jars every here and there in portlets will require additional file descriptors; I don't know about Windows, but this will hurt linux server's performance in the long run.
  • freedom of change: if you're using maven to build your portlets, switching from lib/ext libs to portlet's lib libraries is just a matter of changing the dependencies scope (this may be more annoying with portal libs); as far as I remember, Liferay SDK also makes it easy to do a similar switch with ant to do a similar switch in a jiffy by adding additional ant task to resolve the dependencies and deleting them from portlet's lib as required
like image 157
Michal M Avatar answered Sep 24 '22 06:09

Michal M