HostGator monitors all CPU usage on Shared, Reseller and VPS plans. The limitations for each of our hosting options are explained in detail below. This article will assist you with being familiar with our resource limits as well as advanced methods for checking CPU usage using using SSH.
CPU Resource Restriction Tool
HostGator has implemented a CPU resource restriction tool in cPanel to inform users of our servers when they are reaching their resource limit as defined by HostGator's Terms of Service. To learn more about this restriction, please refer to the following knowledge base article:
CPU Usage Limits
Here is a list of usage limits based on your plan type:
HostGator allows a maximum of 25% CPU usage limit. You may exceed this limit for no longer than 90 seconds.
It is unlikely that you hit the 25% CPU usage. Unless your site is script intensive and requires more processing.
Here are some valuable tricks to lessen your CPU usage.
- Reduce your number of banners and ads from other sites.
- Avoid using too many scripts, and do not force html to handle server-side code (like php and shtml).
- Avoid using https protocol as much as possible; encrypting and decrypting communications is noticeably more CPU-intensive than unencrypted communications.
Flash, video, audio, and image files are downloaded to the browser. This uses bandwidth only.
Reseller servers have the same limits as Shared servers, however, the limit is per cPanel, not for the entire reseller package.
However, if you have multiple cPanel accounts contributing to a server problem, we may suspend any of them.
You are allowed to use 100% of your CPU resources. However, this is only a portion of the server's total CPU resources. If you are looking for more CPU resources than a Shared Server, you will NOT want to pick VPS; instead, you should choose a Dedicated Server.
You are allowed to use 100% of the server's CPU resources.
A good trick for VPS and Dedicated is to turn off the webstat programs (AWstat) that comes with your cPanel. Note that AWstat and other tracking tools use CPU and MySQL connections. By turning this off, you reduce your CPU usage.
Monitoring CPU Usage with SSH
It is possible to monitor the processes and CPU usage on your server with SSH. To learn how to access your server with SSH, please refer to our article on how to get and use SSH access. There are two tools which you may use to check for processes with high CPU usage on your server, the top command.
Top is a task manager program which is available on HostGator servers that produces an ordered list of running processes that users may sort by preference in order to monitor the health of their server. To run top, please follow these directions:
- Log into your server using SSH.
- From the command line, enter the command top. Example:
firstname.lastname@example.org [~]# top
Note: The top command will restrict its search based on the user you log in with. If you are logged in to your server as root and you wish to filter your results to only display processes for a specific user, you may do so using -u when running the command. Example:root@server [~]# top -u username
- To exit top, please press the q key to return to the command line.
Once top is running, you will see an output that looks similar to this:
op - 15:14:39 up 68 days, 22:57, 2 users, load average: 0.09, 0.02, 0.01
Tasks: 7 total, 1 running, 6 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.4%us, 18.0%sy, 34.0%ni, 35.9%id, 7.2%wa, 0.5%hi, 0.9%si, 0.0%st
Mem: 65835156k total, 63794700k used, 2040456k free, 2011064k buffers
Swap: 6143996k total, 1322776k used, 4821220k free, 46736152k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1646 username 39 19 13276 1088 852 R 0.0 0.0 0:00.05 top
6828 username 39 19 4312 884 556 S 0.0 0.0 0:00.00 man
6832 username 39 19 9248 1084 924 S 0.0 0.0 0:00.00 sh
6833 username 39 19 9248 664 492 S 0.0 0.0 0:00.00 sh
This command has a wide variety of uses and can be implemented with many options. For the purposes of this article, only how to read the process list and how to sort the process list by CPU or Memory usage will be covered here. Here is a list of the columns as they appear by default on HostGator servers and what they mean:
- PID: The task's unique process ID.
- USER: The username of the task's owner.
- PR: The scheduling priority of the task.
- NI: The nice value of the task, which indicates the priority the server runs the task at.
- VIRT: The total amount of virtual memory used by the task.
- RES: The physical memory a task is using.
- SHR: The amount of shared memory available to a task.
- S: The status of the task. The statuses which a task may use are as follows:
- D = uninterruptible sleep
- R = running
- S = sleeping
- T = stopped by job control signal
- t = stopped by debugger during trace
- Z = zombie
- %CPU: This column displays the CPU usage of running processes and is the most important column to pay attention to when monitoring CPU usage. To sort the list by CPU usage, please press <Shift> + p.
- %MEM: This column displays the Memory usage of running processes. To sort the list by this column, please press <Shift> + m.
- TIME+: This column provides the total CPU time used by the task since it was started. The output is formated as follows:
- Minutes : Seconds . Hundredths Of A Second
- COMMAND: This line displays either the command line used to start a task or the name of the associated program.
This will allow you to check the active processes on your server and identify users that have processes that are using a large amount of CPU resources which may allow you to identify specifically what is is causing issues. This was only a brief introduction to this very useful command, to read it's full documentation please log into SHH and enter the command "man top" like so:
This will open the full documentation for the top program which may be browsed with the up and down keys. To stop viewing the manual, please press the q key.