Software

Slow Server? How to Diagnose CPU, RAM, Disk, Database and Bot Traffic Step by Step

Talha Aslan 21 min read

Short answer

What causes a slow server, and what should you check first?

A slow server is one where requests queue up behind an exhausted resource. That resource is usually CPU, memory, disk, database connections or application workers. Start by confirming with a TTFB measurement that the delay really happens on the server. Then check resource usage, slow queries, caching, bot traffic and scheduled jobs, in that order.

Keep reading for the full details and examples

When a site suddenly drags, most owners ask the same uneasy question: is my host bad, or did I break something? This guide is built to replace that guesswork with evidence. As Talha Aslan and team, we share the diagnosis order we use in practice. You also get the commands and how to read them.

If you want a shorter overview first, our article on server-side causes of a slow website is a good starting point. This guide goes one level deeper: how to measure each cause and how to fix it for good.

Is the problem really the server, or the network, DNS or browser?

Not every slowdown means a slow server. For example, the page may send its first byte quickly but finish late. If heavy images and third-party scripts cause that, the problem sits in the page itself. So the first step is to find the layer where the delay builds up.

Ask these four questions in order.

  • Is the site also slow from a different network, such as mobile data? If it is only slow on the office network, the issue is local.
  • Does name resolution take long? A slow DNS provider delays the page while the server sits idle.
  • Is there a CDN or security layer in front? If that layer shows its own error page, the problem may be the connection between it and your server.
  • Is every page slow, or only the admin area or the search page? A single slow page usually points to that page's query.

To check quickly whether the site responds from outside your own connection, use our website down checker. That way you separate a local problem from a real outage within seconds.

How do you use TTFB to isolate server-side delay?

TTFB, or time to first byte, is the time from sending a request until the first byte of the response arrives. According to web.dev, it covers redirects, DNS lookup, connection and TLS negotiation, and the time the server needs to prepare the response. The same article calls 0.8 seconds or less good and more than 1.8 seconds poor; see the web.dev TTFB guide for details.

On the command line, curl breaks the timing into phases.

curl -o /dev/null -s -w "dns:%{time_namelookup} connect:%{time_connect} tls:%{time_appconnect} firstbyte:%{time_starttransfer} total:%{time_total}\n" https://example.com/

If DNS and connect times are short but first byte is long, the time is spent inside the server. In addition, repeat the test for a static file such as an image. If the image is fast and the PHP page is slow, the bottleneck is the application layer. If both are slow, the server's general resources or the network are under strain.

Our article on TTFB and server response time explains the concept and its SEO impact. Here we only use it as a diagnostic tool.

Which type of server are you on, and why does the path change?

The diagnosis path depends on how much access you have. On shared hosting you usually have no shell access; instead, the control panel shows usage graphs for the resources assigned to your account. On a VPS or dedicated server you see everything, but you also own every decision.

Server typeWhat you can seeWhere to look first
Shared hostingCPU, memory, IO and entry process usage of your accountResource usage screen and limit fault records in the panel
VPS or cloud serverAll processes and resources at the operating system leveltop, vmstat, free, df and system logs
Dedicated serverEvery layer, including hardwareThe same commands, plus disk and hardware health
Managed platformMetric dashboards offered by the providerThe provider's monitoring panel and support history

Whatever the type, the goal stays the same: match the moment of slowness to an exhausted resource. You can also make that matching easier from the start. In our business website design projects, for example, we treat speed and caching as an architecture decision, not a setting added later.

On shared hosting, what should you check on the resource usage screen?

On shared hosting that runs CloudLinux, every account works within its own limits. The CloudLinux limits documentation names six of them. SPEED limits CPU, PMEM physical memory and IO disk throughput. IOPS caps disk operations per second, EP entry processes and NPROC the number of processes.

Entry processes are the number of processes that enter your account at the same time. According to the documentation, the server returns a 508 Resource Limit Reached error once this limit is hit. When the memory limit is exceeded, visitors typically see a 500 or 503 error, because the script cannot run.

On the resource usage screen, check the following points.

  1. Which graph touches its limit during the slow hours?
  2. Do the fault columns show entries at those times?
  3. Does the entry process graph spike suddenly, or stay high all day?
  4. Does the IO graph line up with backup hours?

If faults are recorded, the problem most likely sits inside your account: a heavy plugin, uncached pages or bot load. If there are no faults but the site is still slow, the cause may lie outside your account, on the server as a whole. We explain each limit in our guide to shared hosting resource limits for CPU, RAM and IO.

Which commands should you run in the first five minutes on a VPS?

If you connect while the slowdown is happening and run these commands in order, you will see most of the picture. We interpret each one in the sections below.

  1. Run uptime for the load average and nproc for the core count.
  2. Use top or htop to find the processes using the most CPU and memory.
  3. Run vmstat 1 5 to watch runnable and blocked processes and swap activity.
  4. Check available memory with free -h.
  5. Measure disk latency and queue length with iostat -x 1 5.
  6. Check disk space and inodes with df -h and df -i.
  7. Search kernel messages for memory or disk errors with dmesg -T | tail -50.

In vmstat output, the r column counts processes running or waiting for CPU, and the b column counts processes blocked on IO. The si and so columns show memory swapped in and out per second, and wa shows CPU time spent waiting for IO. On a virtual machine, st matters too; the vmstat manual page defines it as time stolen from the virtual machine. Also remember that the first line is an average since boot, so the useful data starts on the second line.

How does load average tell you whether you have a slow server?

The Linux manual defines load average as jobs in the run queue (state R) or waiting for disk IO (state D). It averages them over 1, 5 and 15 minutes. In other words, high load does not always mean the CPU is short; processes waiting on disk push the number up as well.

You read the value together with the core count, not alone. For example, a load of about four on a four-core server means the queue is approaching the core count. Still, the "normal" value depends on context; the official documentation gives no single threshold.

The relationship between the three numbers also tells a story.

  • If the 1-minute value is far above the 15-minute value, the load just started, for instance a bot wave or a cron job.
  • When all three are high and close together, the problem is persistent, often capacity or a lasting misconfiguration.
  • If load is high but top shows idle CPU, look at processes in state D, which means the disk.

For a full explanation, read our article on what Linux load average means. With a slow server and a high load, your next step is to find out where the load comes from: CPU or disk.

How do you recognize a CPU bottleneck?

During a CPU bottleneck, the r column in vmstat stays above the core count and id, the idle CPU share, drops toward zero. Press 1 inside top to see each core separately; that way you also spot a process stuck on a single core.

Next, find out what is eating the CPU. The command ps aux --sort=-%cpu | head -15 lists the top CPU consumers. Three candidates usually appear: PHP workers, the database process, or a backup or compression tool.

When PHP workers lead, the cause is often uncached pages or a heavy plugin. If the database leads, you look at slow queries. A compression tool at the top sends you to the cron jobs. We cover each of these paths separately below.

On a virtual server, also watch for low us and sy values combined with high st. In that case your own processes are not the problem; neighbors on the same physical host may be using the CPU. There is little you can do on your side, so you contact the provider with evidence.

Is RAM running out, and what do swap and the OOM killer tell you?

To check whether memory causes your slow server, look at the available column in free -h. The manual page defines it as an estimate of how much memory is available for starting new applications without swapping. Therefore a low free column alone is not a problem; Linux uses spare memory for cache.

The real alarm is when si and so in vmstat stay above zero. That means the system is writing memory to disk and reading it back. Because disk is far slower than memory, everything becomes sluggish at this point.

If memory runs out completely, the kernel's OOM killer terminates a process. Search the output of dmesg -T or journalctl -k for "Out of memory" and "Killed process". Quite often the victim is the database, and the site shows a database connection error at that moment.

Swap is a safety net, not a fix. We show how to add it in our Linux swap file setup guide. The lasting fix is to shrink the process that eats memory, for instance by sizing PHP workers to the available RAM, or to add more memory.

How do you check for disk IO bottlenecks, full disks and inode exhaustion?

A slow server with idle CPU usually points to the disk. During a disk bottleneck, wa rises in top, the b column fills in vmstat, and load average climbs while the CPU stays idle. When you see these signs, measure per device with iostat -x 1 5.

The iostat manual page defines r_await and w_await as the average time for read and write requests, queue time included. It defines aqu-sz as the average queue length. It also warns about %util. For devices that serve requests in parallel, such as RAID arrays and modern SSDs, this number does not reflect their limits. So a high %util on an SSD does not by itself mean the disk is saturated; read it together with the latency values.

A full disk is a sneakier problem. df -h shows space, while df -i shows inodes, the number of file records. If inodes run out while space remains, the system cannot create new files. Session and cache files fail, and the site throws odd errors.

Use du -sh to measure which folder keeps growing. Common candidates are logs without rotation, old backups, cache folders and thousands of small session files.

How does the database lock up the server, and how do you find slow queries?

On many sites, the database is the real source of a slow server. In MySQL and MariaDB, your first tool is the slow query log. According to the MySQL slow query log documentation, this log is off by default. You turn it on with slow_query_log and set the threshold with long_query_time. The documented default for long_query_time is 10 seconds, which is quite high for a website.

In addition, log_queries_not_using_indexes also records queries that use no index. However, that option can grow the log quickly, so keep it on briefly and then turn it off. To summarize the log, use mysqldumpslow, which the documentation mentions.

If the slowdown is happening right now, run SHOW FULL PROCESSLIST. Without FULL, the command shows only the first 100 characters of each statement. The Time column gives the seconds a thread has spent in its current state. Many rows stuck in the same state for a long time point to locking or a heavy query.

Then inspect the query with EXPLAIN to spot a missing index. When you hit the connection limit and see a "too many connections" error, the process list is again the first place to look.

How do PHP workers, OPcache and memory limits cause slowdowns?

On servers using PHP-FPM, pm.max_children decides how many requests run at once. The PHP-FPM configuration documentation describes it as the limit on simultaneous requests. Once it is reached, new requests wait in line; visitors experience that as long TTFB or as 502 and 504 errors.

The documentation lists three process manager modes: static, dynamic and ondemand. Whichever you choose, raising the worker count blindly is risky. After all, each worker consumes memory, so too many workers push you straight back into swap and the OOM killer. On LiteSpeed servers, LSAPI worker settings play a similar role.

Two settings help a lot with diagnosis. With pm.status_path you open the pool status page and see active and idle workers. With slowlog and request_slowlog_timeout, PHP writes a backtrace for requests that exceed a set time, so you find the exact slow code.

OPcache keeps compiled PHP code in memory. If opcache.memory_consumption or opcache.max_accelerated_files is too small, the cache fills up and code keeps recompiling. Finally, memory_limit caps the memory a single script can allocate, and max_execution_time caps its run time. Raising those limits hides the error; it does not fix the slow code.

Why does every request hit PHP when the cache lifetime is short?

A page cache stores the HTML that PHP and the database produce and serves it directly to the next visitors. With a cache in place, the server builds a page once and then sends it hundreds of times ready-made. If the cache lifetime is very short, or the cache is purged too often, that advantage disappears.

For example, with a lifetime of a few minutes, the server rebuilds almost every low-traffic page on each request. Bots tend to hit exactly those cold pages. As a result, the server runs as if there were no cache at all, even though one appears to be active.

A similar trap is heavy files that the server regenerates on every request. Sitemaps, product feeds and search results pull thousands of rows from the database. When a search engine requests such a file often, a heavy query runs each time.

  • Extend the page cache lifetime to match how often the content really changes.
  • Set up automatic purging that clears only the affected pages when content changes.
  • Cache heavy files like sitemaps, or regenerate them as static files only when they change.
  • Confirm the cache really works, using response headers or the cache plugin's log.

How does bot and crawler traffic wear down the server?

If real visitor numbers have not changed but you still have a slow server, it is time to open the access log. In the combined log format, the first field is the client IP address. The command awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -20 lists the addresses with the most requests.

At the top you will usually find three kinds of sources. They are search engine crawlers, AI bots, and fake bots or attack traffic posing as crawlers. Anyone can fake a user agent string, so you never trust it alone. Google recommends a reverse DNS lookup on an IP that claims to be Googlebot, followed by a forward lookup to confirm it. We walk through the method in our article on how to verify Googlebot.

Instead of scanning logs by hand, you can summarize top bots and status codes with our log file analyzer. For a deeper read, our guide to server log file analysis for SEO helps.

For emergencies, Google describes temporarily returning 500, 503 or 429 to reduce crawl rate. However, it advises against doing this for more than a day or two, because URLs may drop from the index. That is why the lasting fix is to block fake bots and serve pages from cache.

Why do cron jobs, backups and nightly tasks cause slowdowns at set times?

Does the slowdown arrive at the same hours every day? Then scheduled tasks are the first suspect. crontab -l lists your own jobs, and systemctl list-timers lists system timers. If you use a control panel, its cron screen shows the same information.

Typical candidates are full backups, database dumps, image optimization, product feed generation and mail queues. All of them use disk and CPU heavily. Moreover, if several start at the same minute, the load stacks up.

On shared hosting there are also jobs you cannot see. The provider's nightly backup or malware scan can strain the disk of the whole server. In that case your own resource graph shows no faults, yet the site still slows down.

The fix is usually simple. Spread jobs across different times, move heavy work to low-traffic hours, and stop the same job from running twice in parallel. If cron syntax is new to you, read the official crontab manual. For the provider's own jobs, open a support ticket with evidence of the slow hours.

How do external services and slow APIs keep pages waiting?

A slow server diagnosis sometimes ends with idle resources. In that case PHP may be waiting on an external service. Shipping tracking, currency rates, payment gateways, social media feeds or license checks tie the page's first byte to someone else's response time.

You will not see this wait in the CPU graph, because a waiting process uses no CPU. Instead, the PHP-FPM slow log gives you the clue. If the backtrace shows a function making a network call, the external service is the culprit. In addition, if the server's own DNS resolution is slow, every outbound call adds extra delay.

  • Set a short timeout on outbound calls, so your site does not fall over when the service does.
  • Cache responses that rarely change instead of asking again for each visitor.
  • Where possible, move the call out of the page load and into a background job.
  • Check the server's resolver settings and confirm that DNS queries return quickly.

Diagnosis checklist: command, what it shows, how to read it

The table below collects the commands above in one place. The last column only states what the official documentation says. Where it gives no threshold, we say "depends on context".

CommandWhat it showsHow to read it
uptime1, 5 and 15-minute load averageRead it with the core count; the threshold depends on context
top / htopCPU and memory per processThe top process is where the problem lives
vmstat 1 5r, b, si, so, wa, stConstant si and so above zero means memory is short
free -hAvailable memoryLook at available, not free
iostat -x 1 5r_await, w_await, aqu-sz, %utilOn SSD and RAID, %util alone misleads
df -h / df -iDisk space and inodesIf either fills up, writes fail
dmesg -TKernel messagesAn Out of memory line means the OOM killer ran
SHOW FULL PROCESSLISTRunning queries and their timeMany long rows in one state signal locks or heavy queries
Slow query logQueries above the thresholdDefault threshold is 10 seconds; consider lowering it
PHP-FPM status pageActive and idle workersNo idle workers means requests are queuing

Symptom, likely cause, check and fix: the decision table

Knowing the commands is not enough; you need to connect the symptom to the right cause. Read this table starting from the symptom.

SymptomLikely causeCheckFix
Long TTFB on every pageNo cache, or cache not workingResponse headers, cache logEnable page cache and extend its lifetime
Slow at certain hoursCron, backups, provider jobscrontab, timers, resource graphSpread jobs, send evidence to the provider
508 errorEntry process limitResource usage screenCache, bot blocking, upgrade if needed
Intermittent 502 or 504PHP workers fullFPM status page and error logFind slow code, size workers to memory
Sudden database connection errorOOM killer stopped the databasedmesg, journalctlCut memory use or add memory
High load, idle CPUDisk IO bottleneckiostat, vmstat b columnFind heavy IO jobs, upgrade storage
Steady visitors, request spikeBots or an attackAccess log, reverse DNSBlock fake bots, add rate limits
Idle server, slow pageSlow external serviceFPM slow logAdd timeouts and caching

From our experience: how did we separate intermittent 502 and 503 errors on shared hosting?

As Talha Aslan and team, we want to share an example scenario we see often in the field, without names or numbers. A site on shared hosting showed visitors 502 and 503 errors from time to time. The first reaction was natural: "our site has become too heavy."

First, we grouped the 5xx responses in the access log by hour. The errors did not spread across the day; they clustered in specific time windows. Next, we compared those hours with the account's resource usage log. There were no limit faults on the account at those times. So the server failed before the account had used up its own resources, which showed the problem came from the server, not the account.

Even so, we fixed what we could on our side.

  1. We extended the page cache lifetime, so very few requests reached PHP.
  2. Next, automatic purging cleared only the affected pages when content changed.
  3. We cached heavy files such as the sitemap that the server had been rebuilding on every request.
  4. Finally, we opened a support ticket with the hourly 5xx table and the log showing no faults.

The value of this approach is simple. You no longer tell the provider "the site is slow." Instead, you say "these errors happen at these hours, below the account limits." An evidence-based ticket gets a faster answer and shortens the debate. For other causes of this error, see our article on the 503 Service Unavailable error.

How do you build a lasting fix, step by step?

Once you know why you have a slow server, fix it with a plan that runs in order, not with patches. We suggest the sequence below, because each step makes it easier to measure the effect of the next one.

  1. Set a baseline: record TTFB, load average and 5xx counts at the same hours for one week.
  2. Fix caching: enable the page cache, extend its lifetime and set up automatic purging.
  3. Remove slow queries: turn on the slow query log and add indexes for the most frequent offenders.
  4. Tune the PHP layer: check the OPcache size and size workers to memory.
  5. Reduce bot load: block fake bots and limit paths that invite needless crawling.
  6. Spread scheduled jobs: move heavy work to low-traffic hours.
  7. Review capacity: if you are still at the limit after all this, consider a larger plan.

For first aid by error type, our guides to the 502 Bad Gateway error and the 500 Internal Server Error help. We cover capacity math in our article on how many visitors your hosting can handle.

Slow server: when can you fix it yourself, and when does support make sense?

To be honest, a site owner with some technical background can apply most steps in this guide alone. You do not need to be an expert to extend the cache lifetime, spread cron times or find the IPs making the most requests.

On the other hand, support saves time in some situations.

  • You have no shell access and the panel graphs show nothing clear.
  • You found the slow query but cannot change the plugin or code that creates it.
  • The problem comes from the server, and you need an evidence-based ticket for the provider.
  • The same problem returns after every fix, which signals an architecture issue.

If the provider offers no solution despite clear evidence, it may be time to move. Before you decide, read our article on warning signs that it is time to switch hosting. Upgrading the plan right away because of a slow server often just postpones the problem.

How do we handle this problem in our web design work?

A slow site often starts not on the server but in how the site was built. That is why our web design services treat speed as an architecture decision from day one. That means lean custom code instead of bloated themes and plugin piles, optimized images, correct caching and a clean server setup.

For older sites that break on mobile, load slowly or cannot be updated, we also rebuild the structure without losing content or rankings. We deliver documented code, so another developer can take it over later if needed.

If your site still struggles after the checks in this guide, or you want the structure built right from the start, tell us about your situation. We first look at the evidence together, then decide which step is truly necessary.

Frequently Asked Questions

Why is my server slow when visitor numbers have not increased?
The most common causes are bot traffic, a short cache lifetime or scheduled jobs. If real visitors stay flat while requests rise, check the IP addresses with the most hits in the access log. If the slowdown arrives at the same hour every day, review cron jobs and backup times. A slow external service can also stall pages on an idle server.
What load average makes a server slow?
There is no universal threshold; the value depends on context. You read load average together with the core count, because it averages processes waiting for CPU and processes waiting for disk. If load stays above the core count, a queue is forming. However, if load is high while the CPU sits idle, the problem is most likely on the disk side.
How can I diagnose a slow server on shared hosting without shell access?
The resource usage screen in your control panel is your main tool. During slow hours, check the CPU, memory, IO and entry process graphs and the limit fault records. If you see faults, the problem is inside your account. If you get errors without faults, open a ticket with hourly evidence; the cause may affect the whole server.
Does adding swap fix a slow server?
Swap is a safety margin that delays processes being killed when memory runs out, not a lasting fix. If the system swaps constantly, the site still slows down because disk is far slower than memory. The real fix is to shrink the process that consumes memory, for example by sizing PHP workers to available RAM, or to add memory.
Will upgrading my hosting plan fix the slowdown?
Sometimes it does, but often it only postpones the problem. If caching is broken, a slow query exists or fake bots keep the server busy, a bigger plan reaches the same point after a while. Apply the cache, query, bot and cron steps first. If the resource graphs still sit at the limit afterward, an upgrade starts to make sense.
How do I prove to my host that the problem is on their side?
Group the 5xx responses in your access log by hour and compare those hours with your resource usage log. If your account shows no limit faults while the errors occur, state that clearly. Attach the time windows, sample request lines and TTFB measurements to the ticket. Such a ticket gets results far faster than a general complaint.
  • slow server
  • server performance
  • load average
  • TTFB
  • slow query log
  • PHP-FPM
  • bot traffic
  • hosting resource limits
Share:
Talha Aslan

Google Partner digital marketing expert. Hands-on with SEO, Google Ads, web design and e-commerce projects since 2012; every post here comes from that experience.

Next project

Get a quote for your project.

Your brief goes straight to Talha Aslan and team: strategy led by Talha, delivery by an experienced team. We reply the same day and send the scope, timeline and price as a written quote within 1 business day.