Bobcares

High swap usage in cPanel server: An easy fix

by | Oct 19, 2021

Is high swap usage in cPanel server causing trouble? Our Support Engineers are here with an easy fix for this issue.

Today, let us take a look at the procedure used by our in-house experts to resolve this problem as a part of our Server Management Services.

Is your server guilty of using too much swap space? You can run a quick check with the command:

# free -h 
total used free shared buff/cache available
Mem: 7.6G 895M 4.3G 362M 2.7G 6.2G
Swap: 2G 1.9G 0.2G

If your swap usage is high, this often indicates a problem with the server performance. According to our in-house tech experts, the extremely high swap usage often occurs during and after the server is low on memory.

In other words, the swap usage in itself is not the issue on hand, it is merely a symptom of the actual issue. In fact, swap usage helps speed up the server when it is running low on memory.

Furthermore, swap is where less frequently used data gets cached. This allows your server to place the more highly trafficked data in RAM and yet still have access to the less frequently used data in the swap space.

Why doesn’t High swap usage in cPanel server go down?

Let’s take a closer look at why the amount of swap space doesn’t actually go down. First, we have to realize that moving data to swap is actually an intensive and slow task. The kernel effectively moves data to swap only when the benefits outweigh the operation time.

Similarly, moving data out of swap space is also a slow process. Hence, the kernel tends to take its time when it comes to moving data from the swap.

Why does high swap usage occur?

According to our Support Techs, high swap usage often depends on the type of application run by your server. Other factors that may cause it includes the server configuration and usage patterns. Any time the server runs low on memory, it starts relying more on swap space.

Rather than focusing on the amount of swap usage, it is better to monitor the rate at which the server moves pages to and from the swap space.

Our Support Team recommends monitoring the swap rate regularly. This makes it easier to identify when it becomes higher than usual. In most cases, the swap rate increases rapidly when the server starts having trouble.

How resolve extremely high High swap usage in cPanel server?

The easiest way to ensure that your swap usage by your server becomes 0 is to turn swap off and then turn it back on again.

In other words, this will prompt your swap space to flush out the swap pages into RAM and thereby setting the swap space back to 0.

You can turn your swap usage off by running the following command:

swapoff

Then turn it back on with the following command:

swapon

According to our Support Engineers, as long as your server is not having a low memory condition, it is safe to run these commands.

However, if your server is currently facing low memory issues, contact our Server Management Services for further assistance.

[ Still having problems? We are just a click away.]

Conclusion

At the end of the day, we learned how high swap usage can be brought down to zero with the help of just two commands. Our skilled Support Engineers also imparted essential information about swap memory and when to be alarmed about high swap usage.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.