tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: high CPU usage on tomcat 7
Date Sat, 06 Oct 2012 19:42:53 GMT

Kirill Kireyev <> wrote:

>Thanks for all your thorough advice Shanti! (and everyone else)
>Here are my findings so far:
>0) My servlet sessions store a large number (~10s of M) or data in RAM.
>This is by design, to optimize performance. I can also have ~3K active 
>sessions at any one time. Hence a large heap size.
>1) When I (1) manually expire inactive sessions through Tomcat web 
>interface and (2) manually hit "Perform GC" through jvisualvm console 
>attached to the tomcat process, everything works great, and the memory 
>is successfully reclaimed, and the used heap  size drops back to what
>should be when the application initializes.
>2) However, this doesn't seem to work automatically. More specifically:
>     a) Sessions are not expiring without manually doing it (I can see 
>the number growing in the Tomcat web interface). Even though my 
>conf/web.xml says:
>     <session-config>
>         <session-timeout>20</session-timeout>
>     </session-config>
>    b) A full garbage collection is not being performed unless I do it 
>manually. I'm attaching the GC records from my logs/catalina.out.
>Any insights?

Session expiration is performed by the background processing thread. What is that thread doing
(a thread dump - well several over time - will tell you).

Fix the session expiration issue and the GC issue will be solved. Note the JVM may well not
perform a full GC unless it absolutely has to. In fact, the JVM may not perform any GC if
it doesn't have to.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message