[Linux/WHM] How to disable Swap Used? My server sometime get high load when Swap Used

My server load normally only about 1 or below, the server running normally for days, not get high load

when i check in whm >> Service Status, the Swap Used report always zero (0), not used at all :

Swap Used 0.00% (0 of 10169104)

but when Swap Used sometime, even the swap used very very small size, only 4k, or 88k like below, the server start sometime get high load, can be few times a day. And to make the Swap Used zero (0) again, i need to Gracefull Reboot

in whm - Service Status :

Swap Used 0.00% (4 of 10169104)
or
Swap Used 0.00% (88 of 10169104)

the Memory Used when Swap Used is only about 25-50%, i believe the memory 8Gb is still big, the problem maybe because the harddrive/harddisk rpm are too slow

please help guys How to disable the Swap Used? so the server only using the memory, not swapped using harddrive/harddisk too

Nb. Here are the server specs :
Core i7 860 Quad Core - SINGLE CPU QUAD CORE 2.8GHZ FSB 2.5 GT/s (8MB CACHE) w/HT
Control Panel: CPanel/WHM - Centos 5 64 Bit
RAM/Memory: 8GB DDR3
Primary Hard Drive: 1TB SATA

Unless you’re sure you have plenty free memory under load, turning off swap is dangerous as you may get oom killer chopping out important processes, but if you must you can turn it off using the swapoff command. You should check what process is causing the high load, because the tiny amount of swap being used in itself shouldn’t degrade performance even with slow drives.

the high load since few days ago come when off peak time, not peak time, usually at 7-8am (very little people at that time, almost no traffic), you can see here, this is when high load at 8.23am, and the task are very low, only 198, get high load, the Swap used are 8k :

its not make sense get high load with the task only 198 (very little people at that time, almost no traffic), its very low number, its should be no high load, the server usually running the task at 250 averages and not get high load, if swap used are 0 (zero)

This is current top result, now are peak time, the task are higher : 257, but the load only 0.61, the Swap used are 0 (zero)

i am not sure if upgrading the memory from 8Gb right now, to 16Gb will solved the problem

if you have suggestion again for now i really appreciated, maybe like how to set only use swap if memory used 90% or more?, or how to found out which one the script that causing high load?

Not a *nix guy by any stretch of the measure, but I’d figure that swap being used was a secondary effect of the load, not the culprit here . .

I agree with wwb_99. Looks like it may be the webalizer cron job doing this. If you don’t use it, try disabling this service and see if that solves it.

Your problem isn’t swap usage, as you’ve got 4.5GB of RAM used as disk cache in that first image - so it won’t genuinely be using swap for processes. As already mentioned disabling it is a bad idea in 98% of situations.

Your problem I would say is Disk I/O - look at the IO Wait State numbers, there’s really high. Use iostat and vmstat to take a look at the disk usage. I’m guessing you’re just running on a single SATA Drive? Mysql features in both those screen shots - have you tweaked your Mysql config at all so it’s less reliant on disk? i.e. allocated more buffers etc?

Or get some decent disk i/o. Drives and RAID are cheap these days, you can spread things across spindles real easy.

webalizer is the cause of the IOWait (Load) NOT the swap in that case.

webalizer will be processing your web (and other) logs, causing the IO.

Do NOT turn off Swap, even if you aren’t using it, it is worth having ‘just incase’.

Much better in the long term to actually look at the causes and treat them than to treat the symptoms alone :slight_smile:

Whilst webalizer won’t be helping, MySQL features in both and the I/O Wait State is high on the 2nd as well (anything over a few percent starts to cause issues if it’s like that most of the time) and is going to be the easiest one to potentially fix, as log processing is either going to need to be nice’d down to a lower priority or is going to need a new system.

:slight_smile:

I’m guessing mysql backs up BECAUSE of the log processing (it is heavily IO bound). I know I’ve seen the same on some of our servers before I moved log processing to a dedicated machine elsewhere.

No sign of webalizer on the 2nd shot though and the wait is over 16% :slight_smile:

I’m looking at the number of PHP processes and assuming that the server is busy processing something more in the background - 16% io isn’t too much, granted, could be improved. I’d focus on doing something about the logs to start with.