VPS Troubleshooting

From DreamHost
Jump to: navigation, search


You may notice at times that your VPS is not running as well as it should. There are several things you can do to troubleshoot your VPS, and this article lists some of the most common things you should check first.

Checking resource usage

The following symptoms are often associated with high resource usage:

  • Out of memory
  • Restarts
  • Inability to log in (i.e., "ssh_exchange_identification: Connection closed by remote host")

Checking your daily and monthly resource usage

You can check the daily and monthly memory usage graph in your panel:

  1. Navigate to the (Panel > ‘VPS’ > ‘Dashboard’) page.
  2. To the right of your VPS, click the RAM bar graph under the ‘Usage’ column.
    A graph opens that shows you the RAM Usage History:
01 VPS Troubleshooting.fw.png

This graph shows you a general overview of how much memory your VPS is using. Please note however that if a spike in memory occurred, it may not show on the graph since the graph only displays average usage.

Changing your memory allocation

Dh-kb-note-icon.fw.png Note:

As of March 2016, new VPS plans are created with a specific amount of disk space and RAM. It's not possible to adjust the RAM on these new machines. However, older VPS machines still have the ability to adjust their RAM allocation.

If you find the graph is hitting your allotted memory limits, you should increase your RAM allocation.

To increase your RAM allocation:

  1. Navigate to the (Panel > ‘VPS’ > ‘Dashboard’) page.
  2. To the right of your VPS, click the Change RAM button under the ‘Actions’ column.
    A pop-up window opens where you can change the memory:
    02 VPS Troubleshooting.fw.png
  3. Once you select a desired RAM setting, click the Change RAM button to save your changes.
  • As you move the slider bar the amount of memory updates automatically, along with the rate you'll be charged for that setting.
  • Please allow a short period of time for the setting change to be reflected; typically no reboot is necessary.

Checking an overloaded VPS (old VPS plans only)

If you've confirmed that your VPS is hitting its memory limits, it's recommended that you start out by doubling your current resource allocation to see if it's enough to prevent the VPS from rebooting. Once you've verified that things are running properly you can reduce your resource allocation to the point where your peaks just barely exceed what you have allocated. Of course, you'll want to routinely monitor your usage and increase the resource allocation as your needs increase.

Dh-kb-note-icon.fw.png Note: It's best to over allocate than under allocate! You don't want to find out that you've under allocated by your visitors/customers complaining about your sites not working properly.

You're only charged for the period of time that you have the slider in a particular position, so it's safe to experiment.

You will typically see Apache processes running on your server and appearing to consume all of the memory. This is generally not the case because Apache processes share a significant amount of memory between one another. Additionally, DreamHost automatically configures Apache to work well within the memory allocation of your private server.

It is still possible for a busy website to overwhelm a VPS server, but it is not generally the fault of the Apache web server itself. The processes you should be most concerned with are the PHP processes: PHP sites that are not optimized can use an extremely large amount of memory.

Of course you may also want to try to reduce the load on the server as well, so you can reduce the resource allocation and save some money.

Rebooting your VPS

If necessary, you can restart your VPS within your panel:

  1. Go to the (Panel > ‘VPS’ > ‘Dashboard’) page.
  2. To the right of your VPS, click the Restart button under the ‘Action’ column.
    • Please allow a few moments to complete. You may notice a brief downtime on your website as a result.

Changing the web server to nginx

DreamHost’s Apache web servers are configured in process-based mode. This means that each process serves one simultaneous connection and uses a significant amount of memory for that, thus limiting concurrent user count. DreamHost offers the option to change your web server to nginx within the panel.

  1. Navigate to the (Panel > ‘VPS’ > ‘Dashboard’) page.
  2. Click the Configure button to the right of your VPS.
  3. Select a server from the ‘HTTP Server’ drop down menu:
    • Apache
    • nginx
    • No web server
  • Nginx servers use async i/o and can handle large count of concurrent connections without consuming much RAM, especially when serving static files.
  • Most of the time, Apache is more than sufficient but if your site is receiving very heavy traffic, you may wish to look into nginx.

Linux commands to troubleshoot your VPS

There are many ways to keep track of your VPS' Memory and CPU usage. If you start to notice that your VPS went from 60MB of memory usage a day to 250MB of memory usage a day, you should probably take a close look at what is going on behind the scenes.

The following describes various commands that help you pin point high memory usage and high CPU usage.

Dh-kb-note-icon.fw.png Note: The following commands must be ran within a shell terminal. View the SSH article for further details.


The ‘top’ command allows you to view system tasks running in real-time. It provides a good summary of your system to quickly check if anything stands out that may be causing issues with your server. View the following man page for further details:


Top has a few shortcut keys that are available which changes how the information is displayed:

# Shortcut Key Description
t Displays summary information on and off.
m Displays memory information on and off.
A Sorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on the system.
f Enters an interactive configuration screen for top. Helpful for setting up top for a specific task.
o Enables you to interactively select the ordering within top.
r Issues renice command.
k Issues kill command.
z Turns color/mono on and off.

Displaying the top ten processes

The following four commands display the top ten (10) processes that are using memory on your VPS:

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
ps -eo pcpu,pid,user,args | sort -r -k1 | less
ps -eo pmem,pid,user,args | sort -k 1 -r | head -10
ps -eo pmem,pid,user,args | sort -r -k1 | less

The following command shows USERNAME, CPU%, MEMORY%, and the number of processes running. Run this command on a single line:

ps aux | awk '{cpu[$1]+=$3; mem[$1]+=$4; procs[$1]+=1} END { for (user in cpu){ print user,"cpu:",cpu[user],"mem:",mem[user],"proc:",procs[user] } }'

Displaying memory usage of a specific process

top -b -n 1 | grep -i [EnterProcessName]
or by username:
top -U [EnterUsername]

Displaying memory usage with /proc/meminfo

ps aux --sort pmem

Use the following command to view memory usage over time (requires you to repeat the command or usage of a cron job):

ps ev --pid=[EnterPID]

To display all currently running processes and detailed information, use the following command:

ps -ef

and on most systems:

ps -aux

You can find a memory leak by running:

ps ev --pid=[HighestEnterPID]

iostat to view CPU usage, disk activity, and network filesystems


Log file details for troubleshooting

View the Finding causes of heavy usage article for further commands you can run to check your site logs.

See also

To learn more about how to block IP addresses and hostnames, you can visit the following pages: