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. As a guideline, the value should not exceed the number of CPU cores (threads). For example, a sustained LA of 4 on a quad-core server means that the cores are fully loaded and new tasks are waiting in the queue. Note that in Linux, Load Average also counts processes waiting for I/O, so a high LA with low CPU usage more often points to disk problems.

Additionally:

  • htop is a more visual version of top with color bars for core and memory usage.
  • 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 -xhs /* 2>/dev/null | sort -h allows you to identify large directories, such as old archives.
  • df -i shows whether inodes have run out (with a large number of small files, space may "run out" even though gigabytes are free).
  • 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 for starting new programs without using swap — the available column (it accounts for the cache that the system can free). Rely on this value rather than on free.
  • Swap usage. For details on configuring it, see Managing swap: creation and resizing.

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 shows current traffic by connection. The -m flag sets the upper limit of the scale, for example iftop -m 100M for a 100 Mbit/s link. If traffic constantly hits the speed of your plan (the bars on the scale reach the right edge), consider increasing the bandwidth.

Note

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

  • nethogs shows which processes consume network traffic.
  • bmon displays network interface load as graphs.
  • iptraf-ng is an interactive traffic analyzer by interface, protocol, and port.

How to check packet loss and the route to the server, and what data to send to support in case of network problems, is described in the article Network diagnostics.

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 webmaster tools such as Yandex Webmaster. Google Search Console does not allow you to set the crawl rate manually — Googlebot reduces it automatically if the server responds slowly or returns 429/5xx errors. 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 (iowait) metric in the %Cpu(s) line of the top utility. If this value constantly exceeds 20, it may indicate that the disk subsystem cannot keep up with requests, which slows down operation. How to find the process that loads the disk and check the state of the disks is described in the article Disk performance diagnostics. 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 ×