Server Resource Diagnostics¶
In this article
Analysis of Overall Server Load¶
To monitor the state of the server, built-in tools are used:
- Windows: "Task Manager".
- Linux: The
top
utility displays the average load (Load Average) over 1, 5, and 15 minutes. An ideal indicator is a value that does not exceed the number of processor cores. For example, LA 4 on a four-core server indicates 100% core utilization, requiring immediate reduction in load.
Additionally:
atop
highlights high indicators with red color.nmon
provides graphs of processor, disk, network, and memory load. To activate the graphs, use specific keys, a list of which is displayed upon launching the program.
Detailed Resource Analysis¶
Disk Space¶
Insufficient disk space can cause errors such as "Unable to connect to the database: Could not connect to MySQL", even if the server is accessible. To check:
- The command
df -h
shows occupied and free partitions. du -hs /*
helps identify large directories, for example, old archives.- Cleaning temporary files (logs, cache, PHP sessions) — an effective way to free up space.
RAM¶
The dynamic nature of RAM usage requires regular monitoring. The command free -m
shows:
- Used and free memory.
- The amount of user-accessible memory (sum of
free
andcached
).
For analyzing processes consuming memory, use:
ps axo rss,comm,pid | awk '
{
# Group by process name (comm)
proc_list[$2]++;
# Sum RSS for each process
total_memory[$2] += $1;
}
END {
# Output results
for (proc in total_memory) {
printf("%.0fMB\t%s\n", total_memory[proc]/1024, proc);
}
}' | sort -nr | head -n 10
Network Channel¶
For traffic monitoring:
iftop
with the flag-m 100M
displays channel width. If throughput exceeds 50b (white stripe in the utility), it's necessary to increase bandwidth.
Note
You might need to install these and other utilities from their website or an operating system repository.
Monitoring through a Browser¶
For monitoring through a browser, you can install specialized tools on the server:
Some hosting control panels, such as ispmanager, allow resource analysis through the interface: tracking processes, disk space usage, etc.
Load Analysis from Apache and MySQL¶
If high server load is caused by Apache, it receives a large number of requests on ports 80 and 443. To reduce load, it's recommended to use Nginx on the server, enable data compression, and configure caching for static resources.
Possible causes of such requests can vary: legitimate website traffic, activity from search engine bots, or more seriously, a DDOS attack. If caused by search engine bots, you can reduce the intensity of their requests by adjusting the intervals between visits to the server in Yandex.Webmaster and Google Webmasters Tool settings. In case of an attack, regular settings won't help — additional protection measures will need to be implemented, such as specialized tools or cloud solutions.
High load may also be caused by MySQL work. In this case, it's recommended to optimize service parameters using the Mysqltuner utility. Also, pay attention to SQL queries sent to databases and check their efficiency. For this, you can use the command show full processlist
, which displays a list of current MySQL operations.
It is also important to monitor the WA indicator in the top
utility. If this parameter's value exceeds 20, it may indicate that data cannot be written to disk quickly enough, leading to failures. In such situations, it's recommended to upgrade hardware, for example, installing SSD or NVMe disks, which provide higher performance.
Some of the content on this page was created or translated using AI.