To investigate CPU consumption of the system as a whole, use the vmstat command with a time interval in seconds. For example:

vmstat 5

The specific output of this command varies between different operating systems, but it includes the percentage of the time the CPU was spent executing user-space code (user time), the percentage of time spent executing kernel-space code (system time), and the percentage of time not executing any code (idle time).

  • If the CPUs are spending most of their time executing user-space code, the available processors are being well-utilized.
  • If performance is poor or the server is unresponsive, it can indicate that the server is not optimally tuned. If there is a high system time, it can indicate that the system is performing excessive disk and/or network I/O, or in some cases, there can be some other system-wide problem, like an interrupt storm.
  • If the system is mostly idle, but the server is performing poorly or is unresponsive, there can be a resource constraint elsewhere (for example, waiting on disk or memory access, or excessive lock contention), or the JVM can be performing other tasks, like stop-the-world garbage collection, that cannot be run heavily in parallel.