Magento website health checking is quite broad. However, we still have some outlines at the following article.
1. Check number or CPUs.
2. Check server’s OS.
3. Check disk used/free space.
Low disk space also affects your server’s performance so please don’t forget this step if you’re checking your website’s status.
4. Check used/free memory.
When server runs into out-of-memory, the website usually shows “memory exhausted” error. We can do a quick check like this:
5. Check services’ CPU usage.
The Linux top command is used to show all the running processes within your linux environment. You can also find the CPU & memory usage for each process. This command is useful to find out which application is consuming system resources.
(Press Ctrl+c to quit)
6. Search for large files
If you’re cleaning up unnecessary large files to save disk space but not knowing where to start, this command might help. By default, magento website itself contains small files only.
find ./ -size +20M -ls
This command will list all files larger than 20MiB. You might change 20 to any other number.
7. Check services status
Sometimes we need to check the status of a service if it is running or not to cross verify something on server. Suppose you have edited your httpd.conf file and when restarting the service it just show start service is on. But when you try to get access to the web site the site is down.
service [services-name] status hoặc /etc/init.d/servicename status
i.e: service httpd status
To check all the services state at a time use below command
Here’s what we get:
8. Check real-time output from log file
tail -f /path/to/file.name
This command is useful for debugging or monitoring server status. A bad customized Magento website usually generates lots of error & exception log and this might cause low performace as well. Checking server’s log files in real time is actually simple. Access log for example:
tail -f /var/log/apache2/access.log
9. Find out which php script is running
If you have just typed “top” command and realized that php or apache service is consuming lots of server resources, there might be some scripts running in background. Try this command to know what’s running:
ps ax | grep *.php
10. Check slow mysql queries
We should also consider checking this step while speeding up Magento website. To determine running queries execute time, try this query from mysql command line:
show full processlist;
You can also enable mysql slow query log: set global slow_query_log = ‘ON’;
Set the path to the slow query log: set global slow_query_log_file =’/var/log/mysql/slow-query.log’;
Set the amount of time a query needs to run before being logged:
set global long_query_time = ’20’;
(default is 10 seconds)