Magento health check is quite broad. However, we still have some outlines in the following article.
1. Check number or CPUs.
2. Check server’s OS.
3. Magento Health 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. Magento Health Check services status
Sometimes we need to check the status of a service if it is running or not to cross-verify something on the 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. Magento health 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)
We have done with the tutorial on the Magento health check. We hope it is helpful.
CONTACT NOW to get pro Magento health check with >>> Magento 2 Code Audit Package.
About BSS Commerce:
We are one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bring high-quality products and services to optimize our business effectively. Let us know about your problems. We are willing to support you every time.