← ServerPilot Docs

How to Troubleshoot Performance Issues

If your server is suddenly down or having performance issues and you're not sure where to begin, this article outlines some first-aid troubleshooting steps for discovering the cause.

Check Server Disk Usage

A full disk will cause many different issues that don't appear related. Identifying a full disk is fairly straightforward, you can either:

  1. Use the ServerPilot dashboard to identify your fullest disk, or
  2. SSH to the server and run the following command:
    df -h
    This command outputs the current disk usage of the server's disks. Check the rows under the Use% column for any disks at 100%, particularly the drive with / in the Mounted on column.

If you find that the server's disk is full, you'll need to free up space by removing unnecessary files. To identify which directories are taking up the most space, follow the steps in our article: How to Determine What Is Using Disk Space.

Caution: Be careful when deleting files from your server!

Deleting the wrong files can cause your apps to stop working or break your server entirely. If you are unsure which files can safely be deleted, please don't hesitate to contact our support.

We highly recommend taking a snapshot of the server before deleting any files.

Check Server Memory Usage

Hosting large PHP apps or multiple websites on a single server can often result in high memory usage. If the server doesn't have enough memory to fulfil these needs, then many different issues can occur.

To see if a server is running out of memory, connect to the server via SSH and run the following command:

grep "Out of memory" /var/log/syslog
If you get any output from this command, then your server is running out of memory and is being forced to kill processes. The output would look similar to this:
Jan 01 01:01:01 ServerName kernel: [72874642.714811] Out of memory: Kill process 29289 (php-fpm) score 1030 or sacrifice child
High memory usage is usually caused by an increase in traffic to an app, slowness in an app's code, or a combination of both. If the cause is high traffic, then increasing the server's total memory should mitigate the issues.

If there are still issues after increasing the server's memory, then you likely need to fix slowness in an app's code. Read the section below titled "Check the PHP Slow Log" for help in identifying problem areas in the code.

Perform a Server Reboot

Once you've verified that the issues aren't being caused by disk space or memory, performing a simple reboot can often resolve unexpected server issues. One drawback of performing a reboot is that it does cause downtime, so it must be planned accordingly.

To perform a reboot, SSH to the server and run the following command:

sudo reboot

This will trigger a graceful shutdown of the server which allows processes to stop safely, then the server will turn on and boot back up.

Check the PHP Slow Log

If a site is loading very slowly or not at all, then it's possible there's a slowness issue with the app's code. This can cause memory issues at the server level and disrupt other apps. To understand how to identify and fix these kinds of issues, check out our article How to Read the PHP Slow Request Log.

Check the MySQL Slow Query Log

Sometimes performance issues on a server or website can be caused by SQL queries that take too long to execute. To identify queries that may be impacting your server's performance, check out our article How to Read the MySQL Slow Query Log.

Last updated: December 17, 2024

Launch your first site in 5 minutes