Skip to content

Server Resource Diagnostics

In this article

Analyzing General Server Load and Performance

If your server seems to be "lagging," use the built-in tools to monitor its status:

  • Windows: "Task Manager."
  • Linux: The top utility, which displays the Load Average for 1, 5, and 15 minutes. An ideal metric is a value that does not exceed the number of CPU cores. For example, an LA of 4 on a quad-core server indicates 100% core utilization, which requires urgent load reduction.

Additionally:
- atop highlights high metrics in red.
- nmon provides graphs for CPU, disk, network, and memory load. To activate the graphs, use specific keys, the list of which is displayed when the program starts.

Detailed Analysis of Server Resource Errors

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 df -h command displays used and free partitions.
  • du -hs /* allows you to identify large directories, such as old archives.
  • Cleaning up temporary files (logs, cache, PHP sessions) is an effective way to free up space.

RAM

The dynamic nature of RAM usage requires regular monitoring. The free -m command shows:
- Used and free memory.
- The amount of memory available to the user (the sum of free and cached).

To analyze 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  %s
", total_memory[proc]/1024, proc);
    }
}' | sort -nr | head -n 10

Network Bandwidth

To monitor traffic:
- iftop with the -m 100M flag displays bandwidth. If the throughput exceeds 50b (the white bar in the utility), an increase in bandwidth is required.

Note

These and other utilities may require installation from their respective websites or from your operating system's repository.

  • jnettop and iptraf are additional tools for analyzing network traffic.

Performance and Resource Monitoring via Browser

To monitor via a browser, you can manually install specialized tools on your server:

  • Munin and NetData provide graphs for CPU, memory, disk, and traffic load.

Additionally, some hosting control panels, such as ispmanager, allow you to analyze resources through the interface: tracking processes, disk space usage, etc.

Analyzing Server Load from Apache and MySQL

If the cause of high server load is Apache, it means a large number of requests are arriving on ports 80 and 443. To reduce the load, it is recommended to use Nginx on the server, enable data compression, and configure caching for static resources.

The reasons for such requests can vary: it could be legitimate website traffic, search engine bot activity, or, more seriously, a DDoS attack. If the cause is search engine bots, you can reduce the intensity of their requests by adjusting the intervals between server requests in the settings of Yandex Webmaster and Google Search Console. In the event of an attack, standard settings will not help—additional protection measures will be required, such as using specialized tools or cloud-based solutions.

High load can also be caused by MySQL. In this case, it is recommended to optimize service parameters using the Mysqltuner utility. Furthermore, you should pay attention to the SQL queries being sent to the databases and check their efficiency. To do this, you can use the show full processlist command, which will display a list of current MySQL operations.

It is also important to monitor the WA metric in the top utility. If this value exceeds 20, it may indicate that data is not being written to the disk fast enough, leading to operational failures. In such situations, it is recommended to upgrade the hardware, for example, by installing SSD or NVMe drives, which provide higher performance.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×