We have an web application in Linux environment that the CPU sometimes goes up to 99%.

Sometimes it takes days, and other times it takes minutes. We are using Hibernate with Spring in a tomcat webapp and an Oracle Database.

Checking the logs it appears the following:

"ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!".

And then the sessioncount starts to grow until 256 sessions (the max allowed by our Apache confs). This is the line that appears when the session count gets 256:

"ContainerBackgroundProcessor[StandardEngine[Catalina]] ManagerBase - Start expire sessions StandardManager at 1259947978384 sessioncount 256"

After that the CPU gets 99%.

Any suggestions? All will be HIGHLY appreciated.

Thanks in advance.

  • Do you know which processes are eating up your cpu?
    – Roy
    Dec 5, 2009 at 18:50
  • Hi Roy. Yes, only the tomcat.
    – user28265
    Dec 5, 2009 at 19:29

2 Answers 2


There's lots of things it might be. My experience is this is often due to memory problems. When the used heap size gets large the garbage collector goes into overdrive and CPU performance really suffers. Some steps to isolate the issue:

  • monitor the system while the CPU use is spiking using top. Confirm that the CPU use is from Java. (Unfortunately, you can't be more precise than that).

  • monitor the heap size use with VisualVM or JConsole. Normal behavior is to see heap size gradually increasing, then suddenly spiking down when the GC kicks in (a sawtooth pattern). If memory use stays high, it can't be garbage collected

  • this may be obvious, but checks your logs for OutOfMemoryExceptions

  • Make sure your VM is using the max possible heap size. For a 32bit JVM, this is 1400 or 1500M. Use the JVM option -Xmx1500M.

  • Make sure the OS is not using much swap memory (check with top or free). Make sure it has adequate memory to run Linux and Tomcat (3 or 4 GB is a good start for a 32bit machine).

One more note -- review your application for memory and connection leaks. Spring will take care of much of this for you. Make sure you are not putting stuff in the HttpSession object (or a map in the Session) which doesn't need to be there. If you do any direct JDBC or file handling, make sure all streams, Connections and PreparedStatements (this is what I always forget) are closed.


Most probably a problem with your application (I had the same problem with Jboss).

Maybe this problem occurs when you are doing a specific action on your web application? I would try to find a relationship between the application and the problem. Maybe a developer can help you?

Most of time: Tomcat, oracle, frameworks are not the problem. The application IS the problem :-) (memory leak, connection to database not closed...)

Good Luck

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.