SERVER LOAD IS HIGH
HOW TO FIND OUT THE SERVER LOAD IS HIGH IN YOUR VPS SERVER OR DEDICATED SERVER?
Website is loading slow
login to SSH of your linux server, press ‘w’ to know the current average load and top -cd2 to know which process is taking the load.
WHAT IS SERVER LOAD?
Load that expresses how many number of jobs or active processes are waiting in the queue to access the computer processor. This is calculated for a certain period of time over the last 1, 5, and 15 minutes.
This server load is indication on how much work has been done on your serve.
We consider a load value under 5 to be acceptable.However if the server average load reach 5.00 or greater for a consistent period of time, then it's worth finding out the exact cause of the higher server load to resolve the issue or prevent from server down.
HOW SERVER LOAD IS LINKED TO THE PERFORMANCE OF YOUR VPS
Not reducing large image file sizes
Not using Gzip compression
Not using Browser Caching
Using larger numbers of plugins.
Users/spammers sending spam email.
Users sending large mailing lists.
Server backup file are consuming server space.
Running out of memory and swapping to the swap file.
Error take place due to software misconfiguration.
To many high resource website running in single server - This cumulative resources resulting in high server load.
HOW TO SOLVE THE PROBLEM
Enable Gzip compression
Minimize the number of plugins
Enable browser caching
Choose a reliable web hosting plan
Remove the unwanted files and plugins.
Download the backup files to local system
Provide highly secure passwords for mail account to avoid the spammers attack.
Use the load balance server for high resource website..
Check the database tables are closed properly or not.
SYMPTOMS FOR THE LOAD RELATED ISSUE
Files, databases will not be able to upload or download from the server .
Site will not load or very slow website loading.
Continuously server down will take place due to out of memory .When you restart the server it will work temporary after sometime again server will go down.
STEPS TO CHECK THE SERVER LOAD ISSUE IN SSH:
STEP 1: To check the server load.
Average load for the server is : 5
If Average load is with in 6 check with mentioned below gtmetrix site speed checking tool.
KEEP-ALIVE should be enable for apache server.
To enable KEEP-ALIVE => login to WHM => Search Apache Setting module => Enable KEEP-ALIVE After 5 minute check with gtmetrix KEEP-ALIVE is enabled or not.
But this is very basic case you should check the mentioned below cases also.
OUT OF MEMORY:
STEP 2: To check the disk space
Command :free -h
This is command to check what space is allocated and how much client have used, and free space.
STEP 3: Refer the message log file.
Command: vim /var/log/messages
Search ? Out of memory
Check the date and time , if issue is related to out of memory inform the client to upgrade the plan.(If client is maintaining any backup files in server inform the client to download the backup to local system and delete from server)
MYSQL QUERY :
STEP 2: Check which process taking high load.
Command : top -cd2
Analyse for few minutes which process is taking high load, Most of the time mysql will take high load.
STEP 3: To check which mysql database taking more load.
Command : mysqladmin proc
Case 1: If sentora_postfix database taking high , Check the mailq in SHH
Command : mailq
If continuously mails sending in mailq it may be due to client sending lot of emails or spam mails or someone might have hacked the client mails.
Case 2: If client database is taking high load.
It will happen due improper table close in client database(Inform the client to check table connection is closed or not) or due to lot hits in databases.
Example: e commerce site will take lot of mysql lot , Because it will have lot of plugins and products. (Inform the client to move load balance server.
Check 3306 port enable in csf or not , If client not using external database connection remove this port from csf
Command: lsof -i:3306 => to check port is enabled in server or not.
SERVER SLOW DUE TO HITS:
STEP 2: Use the mentioned below command to know server hits.
Command: tail -f /etc/httpd/logs/access_log
Command: tail -f /etc/httpd/logs/ssl_access_log
STEP 3: To check the mentioned below file to know Which countries are trying to access the server.
STEP 4: If you found a lot of hits from other countries apart from his own country, Inform about the hits to clients and ask him what are the countries he has given the access for his website.
Example: If client doesn't wants to access his site from China and United States , just give the country code in CC_DENY in csf.
Refer this link to Deny counrty code in CSF: https://www.liquidweb.com/kb/how-to-block-traffic-by-country-in-the-csf-firewall/
To know the country code : https://serverhealers.com/blog/csf-country-code-full-list/
BEFORE EDITING ANYTHING YOU SHOULD INFORM THE SENIOR