Articles on: Linux server

My Linux server is slow

Problem encountered



You encounter slowness with your server under Linux

Cause



It is likely that your server is saturating one of its CPU, RAM, disk I/O or network resources. This can be inherent to a highly consuming process.

Solution



Check CPU load


Connect to your VPS server via SSH
Run the top -o %CPU command which allows you to check the CPU consumption of each process.
For example :



In our example we can see that the cat process consumes 100% of our server's CPU, so it is probably the cause of the problem.
You can kill the process in question by retrieving the PID from the first column: kill -9 39223
Check again if the CPU consumption is suitable again with the command top -o %CPU :
For example :



In our example the concern is well solved, we no longer have high CPU consumption.

While killing the process solves the concern, it is essential to find out why the process you have identified is consuming so many resources.

If you don't see a problem with the CPU load, check the rest of the points..

Check RAM load


Connect to your VPS server via SSH
Run the top -o %MEM command which allows you to check the memory consumption of each process.
For example :



In our example we can see that the memtester process consumes 35% of our server's RAM, so it is probably the cause of the problem.
You can kill the process in question by retrieving the PID from the first column: kill -9 39771
Check again if the CPU consumption is suitable again with the command top -o %MEM :



In our example the concern is well solved, we no longer have high RAM consumption.

While killing the process solves the concern, it is essential to find out why the process you have identified is consuming so many resources.

If you don't see a problem with the RAM load, check the other points.

Check the I/O load of the disks


Connect to your VPS server via SSH
Install iotop on your VPS with the command apt install iotop -y under Debian/Ubuntu or yum install iotop -y under Centos.
Launch the iotop command which allows you to check the global I/O consumption as well as for each process.
For example :



In our example we can see that the dd process consumes 64% of the I/O and writes 366M/s to the disks of our server, so it is probably the cause of the problem.

|| You can use the ← and → arrows on your keyboard to change the sort column for Disk Read, Disk Write and IO.

You can kill the process in question by retrieving the TID from the first column: kill -9 39963
Re-check if the I/O consumption is suitable again with the command iotop :



In our example the concern is well solved, we no longer have high I/O consumption on our disks.

While killing the process solves the concern, it is essential to find out why the process you have identified is consuming so many resources.

If you don't see a problem with the I/O load, check the other points.

Check the network load


Connect to your VPS server via SSH
Install nload and nethogs on your VPS with the command apt install nload nethogs -y under Debian/Ubuntu or yum install nload nethogs -y under Centos.
Run the nload command to check the overall network load of your server.
For example :



In our example we see that our server is running at 350Mb/s.
Then run the nethogs command which will allow you to check process by process the network exchanges.
For example :



In our example we can see that the ssh process consumes is the process with the most outgoing network activity. This seems to correspond well to the flow observed with nload, so it is probably the cause of the problem.

|| In our example the ssh process corresponds to an rsync transfer between two servers to simulate the traffic.

You can kill the process in question by retrieving the PID from the first column: kill -9 41051
Recheck whether the network consumption is suitable again with the nload command. :



In our example the concern is well solved, we no longer have high consumption on the network of our server.

While killing the process solves the concern, it is essential to find out why the process you have identified is consuming so many resources.

If you don't see a problem with the network load, check the other points.

These checks do not identify the problem.


We invite you to **contact the technical support** so that we can verify in an advanced way from our side the cause of the slowness that can affect your server.

Updated on: 17/10/2022

Was this article helpful?

Share your feedback

Cancel

Thank you!