0

I'm using a VPS from a hosting provider. My VPS has 6 cores. In the past few weeks, i usually used upto about 4-6 cores at any time point. My web pages used to load very fast (about 2-4 seconds). But suddenly today (for the whole day), my CPU usage is only about less than 2, and my page load time is usually about 10 seconds. So now i'm confused, not sure what is happening to my server.

My guess is that other users abuse the server, used up all cores so that my CPU usage rarely exceeded 2 (while my quota is 6).

So my question is: From my VPS, can i check the resource usage (CPU) of the machine that host my VPS ?

Thank you very much.

0

The vmstat utility can provide you a report of usage statistics about your CPU. There is a list of state that a CPU can possibly be in, this snippet is from the manpage:

   us: Time spent running non-kernel code.  (user time, including nice time)
   sy: Time spent running kernel code.  (system time)
   id: Time spent idle.  Prior to Linux 2.5.41, this includes IO-wait time.
   wa: Time spent waiting for IO.  Prior to Linux 2.5.41, included in idle.
   st: Time stolen from a virtual machine.  Prior to Linux 2.6.11, unknown.

The last one is what should be important for you, it's the amount of time that CPU has spent working for another virtual machine than yours.

The syntax to use vmstat is vmstat [options] [delay [count]]. So for example vmstat 3 10 would give you 10 lines of output, each about the previous 3 seconds of time. For more details check man 8 vmstat.

This article explains the stolen time nicely.

1
  • I try the vmstat command, but it ouputs only us, sy, id and wa. There is not any information about st. I'm using Ubuntu 12.04. When i tried the top, the output is something like Cpu(s): 51.0%us, 9.3%sy, 2.4%ni, 32.5%id, 2.0%wa, 0.0%hi, 0.0%si, 2.8%st . Do you think these numbers are abnormal? Thank you very much
    – aye
    Jan 3 '14 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.