1

I have a Tomcat server that serves many webapps, each with many servlets. Sometimes, a single servlet of a single webapp runs out of memory, and then the entire Tomcat crashes with a Java "Out of Memory" error, and I have to restart it.

Is there a way to isolate the servlet, so that when it runs of of memory, it does not crash all other apps?

I currently run Tomcat 7 on Windows, but I may soon move to Linux, so answers for both platforms are welcome.

2 Answers2

5

No there isn't. You have to either:

  1. Stop it consuming so much memory
  2. Give Tomcat more memory, or
  3. Install it in its own instance of Tomcat so that when it crashes it doesn't take your other webapps with it.
user207421
  • 1,016
1

In Linux, I have seen that OOM messages 'usually', I again say 'usually' point to a more bigger memory size. That means either increase the RAM or get a bigger swap space. The first option is preferred.

Architecture of the system also matters but what I have seen it is usually a problem of sizing the work load. Which means run less applications or generate less load or get bigger memory.