0

I have two instances of an web application running in two different servers on tomcat. When I add session replication config by multicast, it gives me permgen error in the next five minutes (i had just two active sessions). But in that five minutes, everything looks normal: sessions in one server is replicated to another server successfully. When I don't have multicasting setup, i don't see permgen issues.

Any idea why multicast consumes all the available memory for just two sessions?

1 Answers1

0

Permgen is used to store metadata about classes. It is not impacted by the number of instances of those classes. The number of sessions (i.e. instances) likely does not matter. It is likely the simple act of using (and perhaps dynamically generating) classes to support session replication which exhausts perm gen.

Start increasing the size of perm gen by explicitly setting the MaxPermSize property.

Consider moving to jdk 8 which changes the way metadata is managed.

http://java.dzone.com/articles/java-8-permgen-metaspace

Brett Okken
  • 6,210
  • 1
  • 19
  • 25
  • Thanks Brett. Number of times a class is used to support session replication is proportional to the number of active sessions that are replicated. So it exhausts PermGen. Makes sense. And when I checked number of active sessions, there were 1500 of them when there was no user online. All the sessions are with 0 byte size. One session is getting created every minute with 2 attributes. They are '_psiprobe_la_ip' and '_lambda_probe_la_ip'. I'm not sure why. We use psi probe tool for tomcat administration. Does this tool create sessions once every minute? – Mohan Kandasamy Feb 08 '15 at 04:41
  • No - **1** java.lang.Class instance for a specific class, no matter how many instances of that class you have (ignoring for example multiple web applications with the same class in the same JVM, that is). Only the java.lang.Class is stored in PermGen, not the object instances. Feel free to check out [this blog series of mine](http://java.jiderhamn.se/2011/12/11/classloader-leaks-i-how-to-find-classloader-leaks-with-eclipse-memory-analyser-mat/) on how to find the leak, and [this library of mine](https://github.com/mjiderhamn/classloader-leak-prevention) that may help you avoid the issue. – Mattias Jiderhamn Feb 16 '15 at 13:05