CPU Resource Usage
HostGator monitors all CPU usage on Shared and VPS hosting plans. The limitations of each of our hosting options are explained in detail below. This article will assist you in becoming familiar with our resource limits as well as advanced methods for checking CPU usage using SSH.
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.
Shared Servers
Shared servers have the same limit as Optimized WordPress sites; however, this limit is for the entire account and is shared by all sites installed on the same cPanel.
It is unlikely that you will hit the 25% CPU usage for 90 seconds at a time 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.
VPS Servers
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.
Please note that if the container uses resources (e.g., CPU) excessively, this can cause performance issues for other customers on the node and may result in your container being "cooled down" for at least 10 minutes. This means that the server is shut down and only restarted several minutes later. This cycle will continue until the resource issue on your container has been addressed.
Dedicated Servers
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 come 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 that you may use to check for processes with high CPU usage on your server, the top command.
Top is a task manager program that 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 in to your server using SSH.
- From the command line, enter the command top. Example:
[email protected] [~]# 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 the top, please press the q key to return to the command line.
Once the 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.01Tasks: 7 total, 1 running, 6 sleeping, 0 stopped, 0 zombieCpu(s): 3.4%us, 18.0%sy, 34.0%ni, 35.9%id, 7.2%wa, 0.5%hi, 0.9%si, 0.0%stMem: 65835156k total, 63794700k used, 2040456k free, 2011064k buffersSwap: 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 USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
- 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 that a task may use are as follows:
- D = uninterruptible sleep
- R = running
- S = sleeping
- T = stopped by a 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 causing issues. This was only a brief introduction to this very useful command. To read its full documentation, please log into SHH and enter the command "man top" like so:
root@server [~]#man top
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.