GoDaddy Help

Review processes on your server

Everything running on your server (email, cron jobs, mysql, sites) will use CPU and memory. It is important to review running processes on your server when you are experiencing slowness or intermittent issues. This will help you determine the cause and direct you how to fix it so your sites will function normally.

Why should I review processes?

  • Memory or CPU usage is high on your server.
  • A backup or other scheduled task is running longer than normal.
  • One or more sites are experiencing slower than normal load times.
  • Tasks (like logging into a site) are taking a long time to complete.
  • You receive errors and/or timeouts when running a task.

How do I review processes?

You will use top and ps to investigate your server. The top command shows you a realtime display of details about your Linux server. The ps command lists running processes.

If you run top M, you will see output similar to this:


[root@server ~]$ top M
top - 12:39:25 up 300 days,  3:15,  2 users,  load average: 0.06, 0.07, 0.08
Tasks: 437 total,   1 running, 432 sleeping,   0 stopped,   4 zombie
Cpu(s):  0.6%us,  2.2%sy,  0.8%ni, 96.2%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    31.237G total,   12.921G used,   18.316G free,  361.410M buffers
Swap: 8191.996M total,   23.781M used, 8168.215M free, 5107.738M cached

    PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
   4425 root      20   0  393m  11m 4436 S  6.0  0.0   7776:50 pvaagentd
   2931 td-agent  20   0 2590m 330m 2272 S  1.0  1.0   2233:30 ruby
 108702 root      20   0 2394m  46m  10m S  0.7  0.1   0:22.20 TaniumClient
     21 root      20   0     0    0    0 S  0.3  0.0 690:42.23 events/2

There are various switches you can use with top to change the layout of the data. For a full list of shortcut keys, use man top in SSH.

If you run ps fauxx, you will see an output similar to this:


USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  10372   752 ?        Ss   Feb06   0:15 init [3]
root      1412  0.0  0.0   5924   624 ?        Ss   Feb06   0:02 syslogd -m 0
dbus      1421  0.0  0.0  21276  1064 ?        Ss   Feb06   0:00 dbus-daemon --system
root      1930  0.0  0.0  20888  1184 ?        Ss   Feb06   0:04 crond
root     22304  0.0  0.0  12800   788 ?        Ss  Feb06   0:00 /sbin/udevd -d
root     22224  0.0  0.0  10788  1344 ?        S    Feb14   0:00 /bin/sh /usr/bin/mysqld_safe
mysql    22421  0.0  3.7 522976 70492 ?        Sl   Feb14   8:42  \_ /usr/libexec/mysqld
root     23576  0.0  0.0  21668   976 ?        Ss   Feb14   0:01 xinetd -stayalive -pidfile /var/run/xinetd.pid
qmails   28232  0.0  0.0   3868   472 ?        S    Feb14   0:00 qmail-send
qmaill   28234  0.0  0.0   3820   560 ?        S    Feb14   0:00  \_ splogger qmail

There are various switches you can use with ps to change the layout of the data. For a full list of shortcut keys, use man ps in SSH.

Other helpful variations:

Top CPU users:

ps -e -o pcpu,args --sort -pcpu | head -10

Top RAM users:

ps -o pid,user,%mem,command ax | sort -b -k3 -r | head -10

Top 10 memory hogging processes:

ps auxx | sort -nk +4 -r | head

Next Steps

Once you find a problematic process (like a hung backup), you may need to kill it to free resources.

To kill a process:

kill -9 PID

To kill all processes by user (like multiple cron jobs):

pkill -u username

For a full list of shortcut keys, use man kill or man pkill in SSH.

If you find you are having frequent issues with runaway processes, you should review server logs to find and fix the issue.

Share this article