Slow Response Times
Your site answers, but too slowly. DownBad doesn’t report a page as slow: once a check runs past the monitor’s time limit, it fails as a timeout. This page shows you how to find which step of loading the page is slow, speed that step up, and see the timeout incident close.
What you’re seeing
Section titled “What you’re seeing”DownBad has no incident for a slow page. A URL monitor (a monitor that asks for a web page) fails for slowness only when the page takes longer than the monitor’s Timeout setting, and then the incident shows the same reason as any other timeout, with the failure type timeout:
Request timeout: timeout of 10000ms exceededThe number is the monitor’s time limit in milliseconds (thousandths of a second): 10000 is 10 seconds. The same reason also appears when nothing answers at all, so if you haven’t yet checked that your server answers, start with Connection Timed Out, which sends you back here once it finds the page arrives, just slowly.
The monitor’s Timeout is the only threshold. It is the only setting that fails a check for being slow and opens an incident. It is in the monitor’s settings, under General Settings, in seconds. A monitor added when you signed up has no Timeout set and waits 10 seconds. In the monitor editor, a new URL monitor starts at 30. DownBad stops every check at 23 seconds, whatever the setting, so a Timeout above 23 acts as 23.
Your notification profile (the settings that decide which alerts a monitor sends, and where) may also have a Latency SLA Breach rule (an SLA, a service level agreement, is a promised level of service). It sends an alert when checks that pass keep taking longer than its Latency, in milliseconds, for at least its Window, in minutes. It never fails a check and never opens an incident, so it can warn you that a page is getting slower before it starts to time out.
The monitor’s page also charts its response time over the last 24 hours against its usual range, learned from its last 14 days, and marks it N% SLOWER once it has stayed above that range for 15 minutes. That mark never fails a check or opens an incident either, so it can show a page getting slower long before it times out. Response time on a monitor’s page explains the chart.
Where the time goes. Loading a page takes five steps, one after another:
- DNS lookup: finding your server’s address. DNS (the Domain Name
System, the internet’s address book) turns a name such as
example.cominto that address. - Connect: opening a connection to the server.
- Secure connection: for an address that starts with
https://, setting up the encryption. This is TLS (Transport Layer Security, the encryption behindhttps://). Anhttp://address skips this step. - First byte: waiting while the server builds the page, until the first part of its answer arrives. This is called time to first byte.
- Download: receiving the rest of the page.
DownBad’s check reads only the first 4 kilobytes of the page (roughly its first 4,000 characters) and then stops, so the download step of a large page slows your visitors far more than it slows DownBad’s check.
Is it you or us?
Section titled “Is it you or us?”A page that is slow for DownBad is almost always slow for everyone. DownBad didn’t open the incident on one check, either: it first checks again from up to three other places in the United States, which wait at most 8 seconds, and it opens the incident only when at least half of the places that answered failed too.
Check from other places first. This needs no commands:
-
Open KeyCDN’s Performance Test, a tool from KeyCDN, a company that runs a CDN (a network of servers around the world that sits in front of a site and keeps copies of its pages). Enter the monitor’s URL setting (the web address it checks) and press Test. It asks for the page from several places around the world and shows the time each step took there: DNS, Connect, TLS and TTFB (time to first byte).
-
Read the results:
- It is slow from everywhere: the page really is slow. Carry on below to find which step.
- It is fast from everywhere, and DownBad still times out: something may be treating DownBad differently, such as bot protection (a service that turns away visitors it takes for programs). See Troubleshooting False Positives.
- It is slow only from places far from your server: the distance is the problem. See the server is far away.
Check it yourself
Section titled “Check it yourself”This command asks for your page the way DownBad does and prints how long each
step took. Run it in a terminal (the window where you type commands:
Terminal on a Mac, PowerShell on Windows). It uses curl, a tool that
fetches a web page, which comes with macOS and Windows; on Ubuntu or Debian (two
common versions of Linux) it is in the curl package. It only reads, and changes nothing.
It sends DownBad’s user agent (the name a program gives a website when it
asks for a page), follows up to five redirects (a page sending the visitor
on to another address) as DownBad does, and gives up after 23 seconds, the
longest a DownBad check waits. Put your monitor’s URL in place of
https://example.com/.
curl -sS -L --max-redirs 5 -m 23 -A "DownBad/1.0 (Uptime Monitor; +https://downbad.app/docs/resources/checker/)" -o /dev/null -w "dns %{time_namelookup}\nconnect %{time_connect}\ntls %{time_appconnect}\nfirst byte %{time_starttransfer}\ntotal %{time_total}\nredirects %{num_redirects}\n" https://example.com/dns 0.002552connect 0.017717tls 0.041588first byte 0.060493total 0.060561redirects 0Against https://httpbin.org/delay/3, a test page that waits 3 seconds
before it answers:
dns 0.021479connect 0.048458tls 0.094121first byte 3.126242total 3.126311redirects 0Against a test page that waits 30 seconds before it answers, on an
http:// address, so tls is 0:
curl: (28) Operation timed out after 23010 milliseconds with 0 bytes receiveddns 0.000012connect 0.000352tls 0.000000first byte 0.000000total 23.010372redirects 0curl -sS -L --max-redirs 5 -m 23 -A "DownBad/1.0 (Uptime Monitor; +https://downbad.app/docs/resources/checker/)" -o /dev/null -w "dns %{time_namelookup}\nconnect %{time_connect}\ntls %{time_appconnect}\nfirst byte %{time_starttransfer}\ntotal %{time_total}\nredirects %{num_redirects}\n" https://example.com/dns 0.015409connect 0.036648tls 0.121803first byte 0.153493total 0.155547redirects 0Against https://httpbin.org/delay/3, a test page that waits 3 seconds
before it answers:
dns 0.036091connect 0.063717tls 0.148676first byte 3.245941total 3.248090redirects 0Against a test page that waits 30 seconds before it answers, on an
http:// address, so tls is 0:
curl: (28) Operation timed out after 23000 milliseconds with 0 bytes receiveddns 0.015167connect 0.017995tls 0.000000first byte 0.000000total 23.001077redirects 0curl.exe -sS -L --max-redirs 5 -m 23 -A "DownBad/1.0 (Uptime Monitor; +https://downbad.app/docs/resources/checker/)" -o NUL -w "dns %{time_namelookup}\nconnect %{time_connect}\ntls %{time_appconnect}\nfirst byte %{time_starttransfer}\ntotal %{time_total}\nredirects %{num_redirects}\n" https://example.com/Write curl.exe, not curl, which PowerShell maps to a different command.
Neither Microsoft nor curl publishes what this prints on Windows, so there
is no example here. It is the same curl as on the other systems, so it
prints the same six lines. When it works, every line has a time and
total is well under 23. When it times out, it first prints an error
starting curl: (28) Operation timed out, and first byte reads 0.
PowerShell’s own
Measure-Command
times only a whole command, not each step, so it can’t show which step is
slow. Use curl.exe instead.
How to read it. Each number is in seconds, counted from the start, so each
one includes the steps before it. Subtract the one before to get the time each
step took. In the If one step is slow example:
| Step | Work it out | Time it took |
|---|---|---|
| DNS lookup | dns | 0.02 seconds |
| Connect | connect − dns | 0.03 seconds |
| Secure connection | tls − connect | 0.05 seconds |
| First byte | first byte − tls | 3.03 seconds |
| Download | total − first byte | 0.00 seconds |
So nearly all of the 3 seconds was spent waiting for the server to build the
page. For an http:// address, tls reads 0: take first byte − connect
for the first byte step instead.
curl: (28) Operation timed outmeans the page took longer than 23 seconds, so no Timeout setting can let it pass. The step that reads 0 is the one that never finished, along with every step after it. In the example,first bytereads 0: the server took the connection but never started answering.redirectsisn’t 0: the page sent curl on to another address, and the times include every address it visited, so the steps can’t be read apart. Run the command again with the address the page ends up at.- Run it twice in a row. If the first run is much slower than the second, look at which step got faster. If it was the DNS lookup step, the second run used the DNS answer saved from the first, so the first run shows how long your DNS host took: see your DNS host answers slowly. If it was the first byte step, the site’s program was probably asleep before the first run: see the app was asleep.
Then go to the cause for the step that took longest:
- First byte: the page takes a long time to build, the server is short of memory or processor time, or the app was asleep
- Connect and secure connection, both: the server is far away
- Secure connection alone: the server is short of memory or processor time
- DNS lookup: your DNS host answers slowly
- Download: the page is very large
- No step is slow, but the total is close to the monitor’s Timeout: the monitor’s timeout is too short
Without a terminal: KeyCDN’s Performance Test shows the DNS, Connect, TLS and TTFB steps from several places. In Google Chrome, its DevTools (the browser’s built-in tools for web developers) show the same steps from your own computer. Open your page and press F12, or Cmd+Option+I on a Mac, as Chrome’s guide to opening DevTools shows. Open the Network tab and reload the page. Select the first request under Name, then open the Timing tab. As Chrome’s guide to the Timing tab explains, DNS Lookup is the DNS step, Initial connection covers connecting and setting up the secure connection, Waiting (TTFB) is the first byte step, and Content Download is the download step.
Fix it
Section titled “Fix it”The causes below run from most to least likely, so start with the first.
Some steps happen in your hosting provider’s dashboard, and some on the server itself, so you need to log in to it: with SSH (a way to open a terminal on another computer), or through the console in your hosting provider’s dashboard.
If someone else runs the site for you, such as a managed hosting company or a web agency, send them the output of the command in Check it yourself and a link to this page. The fix is theirs to make.
The page takes a long time to build
Section titled “The page takes a long time to build”This is the likely cause when the first byte step takes most of the time, on every run, even when the site is quiet. The server takes the connection quickly, but the program behind the site, such as WordPress (a popular program for building websites), takes a long time to build the page. Usually it is waiting on its database (the program that stores the site’s content), or on another service it asks while it builds the page.
-
Find what is slow. A database can list every query (a request for data) that took longer than a time you set: MySQL’s slow query log and PostgreSQL’s
log_min_duration_statementsetting show how to turn this on, for two common databases. Your hosting provider’s dashboard may also show the slowest pages or queries. -
Keep a ready-made copy of the page, so the server doesn’t build it for every visitor. This is called a cache. Your software’s own guide shows how:
- WordPress: WordPress’s caching guide recommends a plugin (an add-on you install from the WordPress dashboard) such as WP Super Cache, W3 Total Cache or Cache Enabler.
- nginx (a common web server program): nginx’s content caching guide.
- Apache (another common web server program): Apache’s caching guide.
- Cloudflare (a CDN): it doesn’t keep copies of pages by default, only of files such as images, as its guide to getting started with caching says. A Cache Rule changes what it keeps.
-
Run the command in Check it yourself again. The first byte step should now take well under the monitor’s Timeout. Then follow Confirm DownBad sees the fix.
The server is short of memory or processor time
Section titled “The server is short of memory or processor time”This is the likely cause when the first byte step, or the secure connection step, is slow on every page and gets worse when the site is busy. It is common on cheap hosting plans, where the server is small or shares its computer with other sites. A busy server can be slow at every step that needs it to work, setting up the secure connection included.
-
Look at how busy the server has been. Your hosting provider’s dashboard usually shows graphs of its CPU (the processor) and memory. Graphs that sit at their top while the page is slow point to this cause.
-
Restart the web server or app, which often clears a program stuck on requests. This changes the server: a program run as a system service (a program the server starts by itself and keeps running) needs
sudoon Linux, which runs a command as the server’s administrator and asks for your password. The program’s own guide shows how to restart it: systemctl, the command that starts and stops system services on most Linux servers, nginx and Apache. -
If the server is busy every day, give it more capacity. Your provider’s guide shows how to move it to a larger size. For example, DigitalOcean (a hosting company) has guides for a server, which it calls a Droplet, and for an app on its App Platform (its service that runs your app without you managing a server), and AWS (Amazon Web Services, Amazon’s cloud hosting) has one for a server. On a shared hosting plan, ask your host about a larger plan.
-
Run the command in Check it yourself again. Then follow Confirm DownBad sees the fix.
The app was asleep
Section titled “The app was asleep”This is the likely cause when the first byte step is slow on the first run, and fast when you run the command again straight away. Some hosting stops a site’s program while nobody is using it, and starts it again on the next visit. That restart is called a cold start. It is common on serverless platforms (hosting that runs your code only when a request arrives, such as AWS Lambda or Google Cloud Run). Between DownBad’s checks, the site can fall asleep again, so DownBad may meet a cold start on every check.
-
Run the command in Check it yourself twice in a row and compare the first byte steps. A first run much slower than the second points to this cause.
-
Keep at least one copy of the program running. On both of these platforms it costs extra, as their guides say. Your platform’s guide shows how: AWS Lambda’s provisioned concurrency and Google Cloud Run’s minimum instances. On other hosting, look in its guide for a setting that keeps the app running, or for a plan that doesn’t put it to sleep.
-
Wait a few minutes, so a sleeping app would have stopped, then run the command again. The first run should now be about as fast as the second. Then follow Confirm DownBad sees the fix.
The server is far away
Section titled “The server is far away”This is the likely cause when the connect and secure connection steps are both
slow, but the first byte step isn’t. Each of those steps waits for a message to
reach the server and come back, so they grow with distance. DownBad’s checks
come from the United States, so a server on another continent is slow for them
on every check. To compare, run the command against https://example.com/,
which a CDN serves from near you: if its connect step is much shorter than
yours, distance is the likely cause.
-
Put a CDN in front of the site, so visitors connect to a server near them instead of to yours. Cloudflare’s guide shows how to add a site. A CDN keeps the connect and secure connection steps short, but it doesn’t keep copies of pages by default, so the first byte step still waits on your server. To shorten that too, see step 2 of the page takes a long time to build.
-
If most of your visitors are in one region, the next time you move the server, choose a data center (the building where a hosting company’s servers run) in that region.
-
Run the command in Check it yourself again. Then follow Confirm DownBad sees the fix.
Your DNS host answers slowly
Section titled “Your DNS host answers slowly”This is the likely cause when the DNS lookup step is slow on the first run and
fast on a second run straight after it. Your domain is the name you
registered, such as example.com, and your DNS host is the company where
you manage its DNS records (the entries that tell the internet which server
answers for your domain), which is often your registrar (the company you
registered the domain with).
The second run is fast because the DNS server your computer asks (usually run by your internet provider) saved the answer from the first run and gives it back without asking your DNS host again. So a first run can show how long your DNS host takes, and a second run can’t. A first run can be fast too, if someone on the same network looked up your domain a short while before.
-
Run the command in Check it yourself twice in a row, and compare the DNS lookup steps:
- Slow the first time, fast the second: your DNS host is slow to answer. Carry on with the next step.
- Slow every time: either your DNS host or the DNS server your own computer asks is slow, and this test can’t tell which. Your DNS host is the slow one if it tells DNS servers to keep its answer only for a few seconds, so every lookup goes back to it. That time is the record’s TTL (time to live), shown beside the record in your DNS host’s settings. If it is under 60 seconds, set it to 300 (five minutes), wait for the old TTL to pass, and run the command twice again. If the TTL is already 60 seconds or more and the lookup is still slow every time, the slow part is the DNS server your computer asks. DownBad’s checks don’t use that server, so it doesn’t explain a DownBad timeout. Go back to Check it yourself and look at the other steps.
- Fast both times: DNS isn’t the slow step.
-
Move your domain’s DNS to a large DNS host. This doesn’t move your website, only who answers DNS lookups for it. Their guides show how: Cloudflare and Amazon Route 53 (Amazon’s DNS host).
-
When the move is finished, run the command again, and follow Confirm DownBad sees the fix.
The page is very large
Section titled “The page is very large”This is the likely cause when the download step takes most of the time. A large page slows your visitors, but DownBad’s check reads only the first 4 kilobytes of a page, so it rarely makes a DownBad check time out. If this is the only slow step and DownBad still times out, look at the first byte step again: it may be slow only some of the time.
-
Turn on compression (shrinking the page before it is sent). Your software’s guide shows how: nginx’s gzip module, Apache’s mod_deflate (the Apache add-on that compresses pages) and Cloudflare’s compression.
-
Run the command in Check it yourself again. The download step should be shorter. Then follow Confirm DownBad sees the fix.
The monitor’s timeout is too short
Section titled “The monitor’s timeout is too short”This is the likely cause when no step stands out, but the total is close to or above the monitor’s Timeout, and under 23 seconds.
-
Open the monitor’s settings and find Timeout, under General Settings, in seconds. A monitor added when you signed up has no Timeout set and waits 10 seconds. In the monitor editor, a new URL monitor starts at 30.
-
Run the command in Check it yourself a few times, at busy and quiet times of day, and note the slowest total.
-
Set Timeout to about twice that slowest total, so a busier moment doesn’t time out, and save the monitor. DownBad stops every check at 23 seconds, whatever the setting, so a Timeout above 23 acts as 23. The re-checks from other places wait at most 8 seconds.
-
If the page needs more than 23 seconds, no setting fixes it: make the page faster with the causes above instead.
-
Then follow Confirm DownBad sees the fix.
Confirm DownBad sees the fix
Section titled “Confirm DownBad sees the fix”-
Fix the cause first. A check that still fails while you work only adds to the time the incident takes to close.
-
Open the incident and press Test Now. DownBad checks again within a few seconds instead of waiting for the next scheduled check.
-
Wait a minute, then reload the incident page, which doesn’t update by itself. The incident closes by itself once enough checks in a row pass. You can’t close an incident by hand.
How many passing checks it takes. While an incident is open, DownBad checks less often after repeated failures. This is called back-off. Each failed check adds one step of back-off, up to 14. Each passing check takes one step away and asks for the next check straight away. When no steps are left, one more passing check closes the incident. So after a steady outage it takes one more passing check than there were failed checks while the incident was open, counting the one that opened it, and never more than 15.
These are the defaults. The monitor’s notification profile can change them for each monitor type under Backoff Config, and its settings are the ones that count: Recovery is how many passing checks in a row, with no back-off left, close the incident (2 by default, counting the check that takes the last step away), and Start after, Rate and Max interval decide when back-off starts and how far it goes. If the profile changes them, the step counts above and the waits below change with them.
How long that takes. After you press Test Now, those passing checks run back to back, a few seconds apart, so the incident usually closes within a minute. It takes longer when checks are slow to finish, such as a page that takes several seconds to load.
If you don’t press Test Now, the first passing check waits for the next scheduled one. With the default settings, from the third failed check on, DownBad waits 5 more minutes for each failure, up to an hour more than the monitor’s usual interval:
| Monitor checks every | After 1 or 2 failed checks | After 3 | After 6 | After 14 or more |
|---|---|---|---|---|
| 1 minute | 1 minute | 6 minutes | 21 minutes | 61 minutes |
| 5 minutes | 5 minutes | 10 minutes | 25 minutes | 65 minutes |
| 1 hour | 1 hour | 1 hour 5 minutes | 1 hour 20 minutes | 2 hours |
| 1 day | 1 day | 1 day 5 minutes | 1 day 20 minutes | 1 day 1 hour |
Still stuck
Section titled “Still stuck”Before you ask for help, collect:
- the link to the incident, and the reason it shows, word for word
- the output of the command in Check it yourself, run twice in a row, with the time you ran it and your time zone
- a screenshot of your KeyCDN Performance Test results
- anything the steps on this page turned up, such as a slow query from the database’s log
Then send all of it to us through Contact Us.