0

The real context here is elasticsearch but I'm curious what would happen more generally (minecraft / jetty / etc). When an OS process is out of system memory, you can see this behavior by checking swap. If a box isn't swapping then it doesn't need more memory (I believe this is mostly always true).

What would the OS see if the JVM is starved with too low of a -Xmx value? Would the JVM spend time managing internal pages? Would this come across as CPU wait / load? Or is the only way to be sure is by using java-aware tooling to reach into the JVM and observe more precisely?

squarism
  • 199
  • 1
  • 9

1 Answers1

4

Since Java is a JVM, it takes care of memory operations internally. The OS gives java a -Xmx block of memory and that is it. A tool like jstat can look inside the JVM and tell you how much time is being spent on GC overhead, as can java agents like NewRelic.

You can also set -verbose:gc to get the JVM to log GC behavior.

If you lack any of these tools, low memory in a java process will often appear as a process that is using lots of CPU -- the JVM is continually garbage collecting which is CPU heavy.

Jason Martin
  • 4,865
  • 15
  • 24