Search code examples
javasessiontomcatjvmjmap

What is the Java class for a Tomcat session?


I made a JVM heap dump of my tomcat server with jmap, and I'd like to figure out what is the size of all the sessions in memory.

As such I would like to know what type of object I should be looking for to estimate the sessions size.

Thank you


Solution

  • It's a javax.servlet.http.HttpSession and the javadoc for it is here. Note that it's an interface, but there's a tomcat interface that extends it org.apache.catalina.Session. I would look for all the classes that implement the Catalina Session interface; org.apache.catalina.cluster.session.DeltaSession, org.apache.catalina.cluster.session.ReplicatedSession, and org.apache.catalina.session.StandardSession.

    I'm sure there are a few confounding variables which might make session tracking not 100% correlate to memory usage, but at least it's a start.