Tomcat killer demystified

This entry contains solution of the mystery mentioned in the previous one.

Big Detective: Dear Watson, do you know who is the killer?
Dr. Watson: No, I have no idea, it is so mysterious. I think, there has to be some bug in the JVM.
Big Detective: Interesting hypothesis. But not plausible.
Dr. Watson: But as you say “Eliminate all other factors, and the one which remains must be the truth.” I do not see any other solution.
Big Detective: We will see. Let’s arrange all the facts. First of all, the virtual server has only 256 megabytes of memory. What happens when it is not enough?
Dr. Watson: Well, the swap space is used.
Big Detective: Usually yes, but not in our case. Unfortunately the configuration of the virtual server does not enable swap.
Dr. Watson: I see, but what happens when the server does not have enough memory?
Big Detective: That’s a good question. Linux has something called OOM killer. As you can read in Who is Who: “It is the job of the linux ‘oom killer’ to sacrifice one or more processes in order to free up memory for the system when all else fails.”
Dr Watson: So OOM killer kills Tomcat when Linux does not have enough memory! But it means that adding more heap to the Tomcat JVM makes the trouble even worse!
Big Detective: Exactly,Watson.

3 Responses to “Tomcat killer demystified”

  1. filemon says:

    Cool story. :) So the solution is to get rid of Tomcat, right? :P

  2. Lukáš Křečan says:

    The solution is to set Tomcat heap size to 64M and to reconfigure Apache and mysql to consume less memory.

  3. Abdelrahman says:

    hey lukas, nice articles, i love the way u made the murder ;)

Leave a Reply