Server Administration

Finding Server Bottlenecks: CPU, RAM, Disk and Network Tools

By NileVPS Team · Published · 4 min read

اقرأ المقال بالعربي

When a website or application gets slow, the first instinct is often to buy a bigger server. Sometimes that is the right answer, but often the slowdown comes from one specific resource that is saturated while the others sit idle. Doubling RAM will not help if the disk is the limit, and more CPU cores will not help a single-threaded process. This guide gives you a repeatable method to find the real bottleneck on a Linux server using standard tools.

The method: utilization, saturation, errors

For every resource, ask three questions:

  • Utilization: how busy is it, as a percentage of its capacity?
  • Saturation: is work queuing because it is full?
  • Errors: is it reporting failures, drops or retries?

Check CPU, memory, disk and network in that order. Saturation is usually the strongest signal: a resource at 90% utilization with no queue may be fine, while a resource with a growing queue is hurting response times right now.

Start with a quick overview:

uptime          # load trend
vmstat 1 5      # CPU, memory, swap, blocked processes in one view

In vmstat, the r column is runnable processes (CPU queue), b is blocked processes (usually I/O), si/so show swap traffic, and wa is CPU time spent waiting for I/O.

CPU

top                         # press 1 to see each core
mpstat -P ALL 1 5           # per-core usage (sysstat package)
pidstat -u 1 5              # per-process CPU over time

Signs of a CPU bottleneck:

  • r in vmstat regularly higher than the number of cores.
  • Load average above the core count for long periods (see load average explained).
  • One core at 100% while others are idle: a single-threaded process that will not benefit from more cores.
  • High st (steal) on a VPS: contention at the host, not inside your server.

Memory

free -h
vmstat 1 5                  # watch si/so
dmesg -T | grep -i -E 'oom|killed process'
ps -eo pid,rss,cmd --sort=-rss | head

Do not panic about low "free" memory. Linux uses spare RAM for the page cache; look at the available column instead. Real memory pressure looks like continuous non-zero swap in/out, the OOM killer appearing in dmesg, or available memory near zero.

Disk I/O

iostat -x 1 5               # per-device stats (sysstat package)
iotop -o                    # processes doing I/O (needs root)
df -h; df -i                # space and inodes

In iostat -x, watch %util (near 100% means the device is busy all the time), r_await/w_await (average latency in milliseconds) and aqu-sz (queue size). On NVMe drives %util can be misleading because they process many requests in parallel, so latency and queue size matter more. Also check that the disk is not simply full: a full disk or exhausted inodes causes strange failures that look like performance problems.

Network

ss -s                       # socket summary
ss -tan state established | wc -l
ip -s link                  # errors and drops per interface
sar -n DEV 1 5              # throughput per interface (sysstat)
mtr -rwc 50 example.com     # latency and loss along a path

Network bottlenecks show up as interface errors or drops, throughput close to your plan's port speed, many connections in SYN-RECV or TIME-WAIT, or packet loss on the path to your users.

Quick reference table

ResourceUtilizationSaturationErrors
CPUtop, mpstatvmstat r, load averagedmesg
Memoryfree -hswap si/so, OOM killsdmesg
Diskiostat -x %utilaqu-sz, awaitdmesg, smartctl where available
Networksar -n DEVconnection backlog, ssip -s link

Do not forget the application

Often the server is fine and the bottleneck is inside the application: a slow SQL query, a missing index, a lock, an external API call with a long timeout, or a worker pool that is too small. Check your web server and database logs, enable the slow query log in MySQL or PostgreSQL, and look at response time per endpoint. A server with low CPU, plenty of RAM and an idle disk but slow responses is almost always waiting on something like this.

After you find it

  • CPU bound: profile and optimize hot code, add caching, tune worker counts, or add vCPUs.
  • Memory bound: reduce worker memory, fix leaks, tune database buffers, or add RAM.
  • Disk bound: add caching, fix queries that scan large tables, move logs, or use faster storage.
  • Network bound: use a CDN, enable compression, or choose a location closer to your users.

Make one change at a time and measure again. When optimization is done and one resource is still the limit, resize to a plan that adds exactly that resource. You can compare options on the pricing page.

FAQ

Which tool should I install first?

Install sysstat, which provides iostat, mpstat, pidstat and sar. Together with built-in top, vmstat, free and ss, it covers most investigations. On Debian and Ubuntu run apt install sysstat; on AlmaLinux or Rocky run dnf install sysstat.

Why is my server slow when CPU and RAM look fine?

Check disk latency with iostat -x and look for blocked processes in vmstat. If those are also fine, the delay is probably in the application, the database, or an external service it calls.

Should I always upgrade when I find a bottleneck?

No. First check whether a configuration change or code fix removes it. Upgrading makes sense when the workload is already efficient and simply needs more of one resource.

Related guides