Home > Enterprise >  Why Tomcat server shows such a sawtooth graph even at rest?
Why Tomcat server shows such a sawtooth graph even at rest?

Time:07-13

Even if I didn't deploy anything under the webapps directory, my tomcat (apache-tomcat-8.5.63) server shows the heap memory usage here below.

In my opinion 700 MB of memory seems to much for background tasks and at the same time using the jstat -gc <vm id> 1000 1000 command with and without visualvm attached, as suggested here (enter image description here

UPDATE

After 24h the situation is the following, I was wondering IF this memory allocation is due to monitoring tools (only) running in the background or not and why the peaks are visibly descending?

enter image description here

CodePudding user response:

700MB are allocate over time for background operation, because there is enough free memory to not trigger garbage collection. As it seems that all of the memory can be freed again, there's no need to worry or optimize anything: It's just doing its job, and the memory is freed when necessary (just not before it's either necessary, or before some time is up)

It would be worth worrying about something, if the low point of the sawtooth would steadily go up after each GC run: That could signal a memory leak (if indeed the system is idle). But that doesn't seem to be the case.

Edit after your additional diagram in the question, and the numerous comments:

Tomcat's memory consumption with nothing else running is constant, as can be observed by the bottom of the sawtooth pattern being on a horizontal line. The frequency and height of the sawtooth depend on when the JVM's GC kicks in, and also is nothing to worry about. I've given some samples of what's happening in the background in the comments - these samples are not meant to be encyclopedic. They're incomplete.

For a full list of the background activities, analyze the source code - such an analysis goes far beyond the scope of an answer on stackoverflow.

Nothing to worry here. Carry on

  • Related