Troubleshooting Performance Issues Print

  • 277

When a VPS or dedicated server experiences performance problems—such as slowdowns or application-specific bottlenecks—valuable clues can usually be found in application error logs or system-wide logs.

Application logs are typically located under:

 
/var/log/<application-name>

Knowing the approximate time the issue occurred is extremely helpful when reviewing logs, as it allows you to correlate events and identify the root cause more efficiently.

The most common cause of server slowdowns is one or more processes consuming excessive system resources. In rarer cases, the issue may be caused by runaway or unmanaged zombie processes.

Monitoring Resource Usage

The quickest way to view current system resource usage is with the top utility. It provides real-time insight into:

  • CPU utilization

  • Memory usage

  • Disk activity

  • Running tasks and processes

  • Load average

While top is useful, it can become less effective under heavy load. Because it refreshes continuously and consumes resources itself, it may contribute to performance issues rather than quickly resolving them.

In such cases, alternative tools can provide deeper insights with lower overhead.


Useful Diagnostic Tools

dmesg
dmesg (diagnostic messages) displays the kernel message buffer, including output from device drivers. These messages are generated during system boot and runtime, reporting hardware detection, driver initialization, and kernel events. Since boot messages scroll past quickly, dmesg allows them to be reviewed in a controlled manner after startup.


vmstat
vmstat (virtual memory statistics) reports on memory usage, processes, interrupts, paging activity, and block I/O. It supports configurable sampling intervals, making it useful for observing system behavior in near real time. It is available on most Unix and Unix-like systems, including Linux, FreeBSD, and Solaris.


mpstat
mpstat reports CPU-related statistics, including per-processor usage. It is commonly used to diagnose CPU bottlenecks and analyze workload distribution across cores.


pidstat
pidstat monitors individual tasks managed by the Linux kernel, providing per-process statistics such as CPU, memory, and I/O usage. This makes it especially useful for identifying misbehaving applications.


iostat
iostat collects and displays storage input/output statistics. It is often used to identify disk-related performance issues, whether on local storage or remote filesystems such as NFS. It also provides limited CPU and terminal I/O information.


iotop
iotop is a top-like utility focused on disk I/O. It displays real-time I/O usage by processes and threads, helping pinpoint applications responsible for excessive disk activity.


free
The free command displays a summary of system memory usage, including total, used, free, shared, and available memory, as well as swap usage. It is a simple and effective way to determine whether the system has sufficient memory to handle additional workloads.


slabtop
slabtop shows detailed, real-time information about kernel slab cache usage. It lists the largest consumers of slab memory and provides statistics about kernel memory allocation.


sar
sar (System Activity Report) reports historical and real-time system performance data, including CPU usage, memory and paging activity, interrupts, device I/O, network traffic, and swap usage. It gathers information from the /proc filesystem and is especially useful for trend analysis.


Tracing Application Behavior

When an application is malfunctioning but the system remains responsive, you can investigate further at the system-call level using strace.

strace
strace is a powerful diagnostic and debugging tool that monitors interactions between a process and the Linux kernel. It traces system calls, signal handling, and process state changes, making it invaluable for identifying stalled I/O, permission issues, and unexpected application behavior. It operates using the kernel’s ptrace mechanism.


Was this answer helpful?

Back