Cloud Linux EasyApache 4 Swap used 100% CPU Load become 300+ | Web Hosting | Domain Registration | Wordpress Hosting | SSL Certificates

Cloud Linux EasyApache 4 Swap used 100% CPU Load become 300+

Hi,

We had one of our servers with a severe issue and this was something described as:

What happens is that apache uses swap instead of using free memory with is near to 100 GB on the server. SWAP is currently near to 2% which will become 100%. After it would become 100%, server’s load begins to raise as well.

Processes get stuck in the queue and server goes to unresponsive state. 

SOLUTION:

Go to Apache Configuration and reset idle processes to be a lower value which was set to be a higher one and NO SWAP would be there now.


Following settings to improve its performance:
·         you have ServerLimit=1500 - I suggest you to reduce it, for example, to 800;
·         next parameter - KeepAlive=On - you need to analyze the following things:
- your website content: if you have a sites with lots of images and javascripts it is usually better leave KeepAlive turned On and make some additional tweaks. Please note, KeepAlive' enabling reduces CPU usage and increases memory usage on the server.
- the type of traffic you get. If your web traffic is spread out evenly throughout a day then you should turn on KeepAlive. But if you have bursty traffic where a lot of concurrent users access your sites during a short time period KeepAlive will cause your RAM usage to skyrocket so you should turn it to Off.
You can do the changes via WHM/cPanel as usually.

Also you can change interval  /proc/sys/net/ipv4/tcp_fin_timeout from the current 60 sec to 30, for example:
# cat /proc/sys/net/ipv4/tcp_fin_timeout
60
# echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
Or permanently by adding it to /etc/sysctl.conf (and then run 'sysctl -p'):
net.ipv4.tcp_fin_timeout=30

More info here: http://www.linuxbrigade.com/reduce-time_wait-socket-connections/
SHARE