Question about top output

Discussion in 'Linux VPS/Dedicated - cPanel' started by Yogesh Sarkar, Sep 26, 2008.

  1. Yogesh Sarkar

    Yogesh Sarkar New Member

    I have question regarding the output of top command when it is run inside a VPS.

    Does the CPU load (under lined in red) only belongs to my VPS or the whole server?

    If it belongs to the whole server, then is the load underlined in green, the load my VPS currently has?

    [Broken External Image]:
  2. mylinear

    mylinear Member

    The load average is for your VPS. I think the CPU is also the percentage your VPS is using, but not very sure about this. I think the top output is all about your own VPS. Maybe someone else can confirm.
  3. Dan

    Dan Moderator

    I believe that load average is for your own VPS but that CPU load is for the whole system.

    The CPU cannot be divided like ram and hard drive and that is why they say you get an "equal share".
  4. Yogesh Sarkar

    Yogesh Sarkar New Member

    Dan you mean the green underlined thing is showing the CPU load of the server?
  5. mylinear

    mylinear Member

    Its not the load of the server. The CPU line is showing the percentages of the node's CPUs (processor power) being used for different purposes.
  6. Dan

    Dan Moderator


    If that were true then why is the process list only showing 2 processes using 1% of CPU? Where is the other 47% at?
  7. mylinear

    mylinear Member

    The 2% you mention is from the top process list. But what is the 47% you refer to?
  8. mylinear

    mylinear Member

    Dan, just to clarify...

    You said:
    I said:
    I mean the same thing as you said. When I said "node", I mean the underlying physical server (whole system), not the individual VPS.
  9. Dan

    Dan Moderator

    OOOOhhh :D I thought you meant node as in this VPS node! :D

  10. Yogesh Sarkar

    Yogesh Sarkar New Member

    Guys by looking at this, does it give any indication why the server load was so high at that time?

    The reply I got for my ticket was that it seemed like a DDOS attack as two ip address had huge number of apache connections. But wouldn't that also lead to large amount of memory being used and also a large number of processes being present in the top output?

    Add to that, the CPU load which has been under lined in green color, shows that maximum CPU time has been assigned to WA, which I guess is waiting, which would point to either a process not allowing any other process to use the CPU or disk IO issue.

    What you guys think?
  11. KH-Paul

    KH-Paul CTO Staff Member

    Everything that "top" shows inside the VPS is related to the VPS itself, "top" doesn't show any processes or utilization figures for the physical server.

    The top output shows significant amount of CPU time being spend on disk operations, also according to the output provided process # 23270 was doing something disk intensive. This could be anything from writing large chunks of data (i.e. spitting out php errors into the log), opening huge directories with a lot of files in them, writing any regular data to the filesystem (i.e. saving uploaded file, etc). There could be other processes that were trying to do something related to disk activity but were not included in top. The full list of processes including their operational status can be obtained with the help of "ps auwwwfx" command. If process is spending a lot of time during that operation and one got lucky enough to be able to catch and trace it while it is still running there is a good chance that it will be possible to find out what it is doing exactly using the "lsof -np PID" and "strace -s4096 -Ff -p PID" (warning - may generate huge output) commands.
  12. Dan

    Dan Moderator


    So first off what's listed in top everywhere pertains only to our VPS. This is a bit surprising to know as there have been times when I have seen higher numbers there and nothing happening on my VPS at the time to account for it.

    In Yogesh's case if he were to run "ps auwwwfx" it would list the process/es that were consuming so much CPU? Because from what top is showing there isn't anything.
  13. KH-Paul

    KH-Paul CTO Staff Member

    Correct and something suppose to be happening - if system is completely idle (no cpu / disk i/o activity) it will show LA at 0.00 and CPU usage at 0% regardless of what is happening on the physical server.

    "top" sorts processes by CPU consumption by default and shows only most CPU active ones, "ps" will show a list of all processes running on the system including their execution status (i.e. "S", "R", "D", etc - more information about process states can be found in the "man ps" man page. S* would show up for processes in the "sleep" state - processes that don't do anything at this specific moment but wait for, say, incoming connections, signal from other process, etc. Anything other than S* shows processes that aren't sleeping. Most common states would be R (running) and D (in most cases waiting for disk i/o).
    LA counters depend on average number of processes in any state but S* state.
  14. Yogesh Sarkar

    Yogesh Sarkar New Member

    Thanks Paul for the explanation, I think the issue might have been caused by a MYSQL cron job that was supposed to take backup of the forum database at 1pm IST and might have been some delayed due to high forum activity hence started causing trouble around 1:30pm - 2:30pm.

    Have gone ahead and disabled it and hopefully that would solve the issue (was originally setup to take backups at night but that changed when my account was migrated to vps and switched the server time to IST).

    Apart from that we didn't have any thing else running that was supposed to write to the file system, apart from the forum database, which was at peak discussion time.

Share This Page