Time taken by every single GC event is reported in the GC log. In every GC event, there are ‘user’, ‘sys’, and ‘real’ time. What does these time mean? What is the difference between them?

  • ‘real’ time is the total elapsed time of the GC event. This is basically the time that you see on the clock.
  • ‘user’ time is the CPU time spent in user-mode code (outside the kernel)
  • ‘Sys’ time is the amount of CPU time spent in the kernel. This means executing CPU time spent in system calls within the kernel, as opposed to library code, which is still running in user-space.

To learn more about these times, please refer to this article.

In normal (all most all) GC events, user time will be greater than sys time. It’s because, in a GC event, most of the time is spent within the JVM code and only very less time is spent in the kernel. But in certain circumstances, you might see sys time to be greater than user time.

Example:

[Times: user=0.04 sys=0.35, real=0.42 secs]

Here you can notice the sys time to be 0.35 seconds which is considerably higher than user time 0.04 seconds.

If you observe multiple occurrences of this scenario in your GC log then it might be indicative of one of the following problems:

  1. Operating system problem
  2.  VM related problem

1. Operating System problem

Operating System exceptions such as page faults, misaligned memory references, and floating-point exceptions consume large amount of system time. Make sure your OS is running with proper patches, upgrades, and sufficient CPU/memory/disk space.

2. VM related Problem

If your application is running in a virtualized environment, may be because of nature of the emulation sys time can be higher than user time. Make sure virtualized environment is NOT OVERLOADED with too many environments and also ensure that there are adequate resources available in the Virtual Machine for your application to run