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.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF