Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Intermittent 5xx errors under load: how to find and fix them

OPS-004High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

A 5xx status code means the server failed to answer a valid request. 500 is a generic error, 502 means a gateway or proxy got a bad reply from the app behind it, 503 means the service is unavailable or overloaded, and 504 means the proxy gave up waiting.

Intermittent means it does not happen every time. The same landing page loads fine on one visit and fails on the next. This is different from a full outage (OPS-001) or a page that always errors (OPS-003). Because it comes and goes, owners often test the page once, see it work, and assume the reports are wrong.

Common causes:

Typical causes of intermittent 5xx
  • Too few PHP or app workers, so extra requests queue and fail (often a 503 or 504)
  • Database connection limit reached or slow queries holding connections
  • No page cache, so every visitor runs the full application
  • Shared hosting limits (CPU, memory, entry processes) hit during a spike
  • One bad node behind a load balancer that fails some requests
  • A plugin, cron job or backup that runs on a schedule and starves the site
  • A rate limit or firewall rule that blocks a burst of requests

Why it costs you leads or sales

Load problems tend to arrive exactly when you can least afford them: during an ad campaign, an email send or a sale. Paid clicks land on an error page, the visitor leaves, and you still pay for the click. Checkout and form submissions that fail part-way can also lose a lead with no trace.

Where a traffic spike breaks the funnel
  1. Ad clickCampaign or email sends a burst of visitors
  2. Landing pageServer returns 503 or 504 for some requests
  3. FormNever seen by the failed visitors
  4. Lead in CRMNo lead created

A spike exhausts the server, so some visitors get a 5xx on the landing page and never reach the form.

Share of visits that fail during a spikeExample numbers
Share of visits that fail during a spike (example)Quiet hour: 0 % of visits; Normal hour: 2 % of visits; Campaign peak: 18 % of visits07140218Quiet hourNormal hourCampaign peak% of visits

Example: illustrative numbers showing how errors can rise only when traffic peaks, which is why a single manual test looks fine.

How to check if your site has it

Find intermittent 5xx errors
  1. Read the server access and error logs

    Filter for status codes 500 to 599 and note the times. Your host's control panel (cPanel, Plesk or a managed host dashboard) usually has a log viewer.

  2. Match errors to traffic peaks

    Compare the error times with campaign sends, cron jobs, backups and busy hours. A pattern points to capacity or a scheduled task.

  3. Check resource graphs

    Look at CPU, memory, PHP worker or connection usage in your host dashboard around the error times. A flat line at the limit is a strong sign.

  4. Check the error body

    A 502 or 504 often shows the proxy name (Nginx, Cloudflare, a load balancer). That tells you whether the fault is in the app or the layer in front of it.

  5. Repeat the request several times

    Load the page repeatedly, or run a few requests from the command line, and count failures.

Request a page 50 times and count status codesbash
for i in $(seq 1 50); do curl -s -o /dev/null -w "%{http_code}\n" https://example.com/landing-page/; done | sort | uniq -c

How to fix it

The fix depends on what the logs show. Start with the cheapest change: cache pages so the server does less work per visit.

Fix intermittent 5xx errors
  1. Cache your landing pages

    Serve static HTML to anonymous visitors through a page cache or a CDN. This removes most load from the application.

  2. Raise worker and connection limits

    Increase PHP workers or app processes and the database connection limit, within what your plan allows. Upgrade the plan if the limit is fixed.

  3. Fix slow queries and heavy plugins

    Use your slow query log or an application profiler to find what holds workers open, then remove or replace it.

  4. Move scheduled jobs off peak

    Run backups, imports and cron tasks away from campaign times.

  5. Check every node behind a load balancer

    If only some requests fail, one unhealthy node may be receiving traffic. Fix it or remove it from rotation, and set health checks.

  6. Review rate limits and firewall rules

    Make sure a security rule is not returning errors to normal bursts of visitors.

Platform specifics
  1. Install or enable a page cache

    Use your host's built-in cache or a caching plugin, and confirm that landing pages are served from cache to logged-out visitors.

  2. Find heavy plugins

    Deactivate plugins one at a time on a staging copy and watch error rates and response times. Check WP-Cron and backup plugins for peak-hour jobs.

  3. Check PHP workers and memory

    In your host dashboard, review PHP worker limits and the memory_limit setting. Raise them or upgrade the plan.

Example: Nginx proxy timeouts and microcachingnginx
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=pages:10m max_size=200m inactive=10m;

server {
  location / {
    proxy_pass http://app_backend;
    proxy_read_timeout 60s;
    proxy_cache pages;
    proxy_cache_valid 200 30s;
    proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
  }
}

How to confirm it's fixed

Confirmation checks
  • Repeat the 50-request test and see only 200 responses
  • Server logs show no 5xx during the next campaign or peak hour
  • Resource graphs stay below your plan limits at peak
  • Landing page, form and thank-you page all work in several runs over a few days
  • Leads from test submissions reach your inbox and CRM every time
Before and after

Before

  • No page cache, every visit runs the full app
  • Workers exhausted at campaign peaks
  • Some visitors see 503 or 504
  • Problem passes before anyone checks

After

  • Landing pages served from cache
  • Capacity matches peak traffic
  • Errors logged and alerted
  • Repeated checks pass consistently

How to prevent it happening again

Prevention
  • Warn your hosting team or check capacity before big sends and ad launches
  • Keep landing pages cached and lightweight
  • Alert on 5xx rates in your host or log tool
  • Schedule backups and heavy jobs off peak
  • Review resource graphs after every campaign
  • Run regular checks on your key journeys, not just the homepage

How FunnelGuard handles this

FunnelGuard detects this only partly. A robot visitor runs your real journeys on a schedule. When a run fails, FunnelGuard re-checks it from a second region. It also keeps a flaky score for each journey, which shows how often it fails across runs, and applies a 2-of-3 rule so a one-off blip does not trigger an alert but repeated failures do.

What it does not do: FunnelGuard does not load test. It does not send heavy traffic to see where your server breaks, so it cannot tell you how many visitors your site can handle or reproduce the exact spike that fails during a campaign. A scheduled check can also miss errors that happen only at peak moments.

To cover the rest by hand: watch 5xx counts in your server or host logs, check resource graphs during campaigns, and run a controlled load test in a staging environment with a tool your host permits. Use the FunnelGuard flaky score as a hint that something is unstable, then look at the logs for the cause.

How a campaign spike unfolds
  1. 09:00

    Example: email goes out to a large list

  2. 09:03

    Example: PHP workers fill up and requests queue

  3. 09:05

    Example: some visitors get 503 or 504

  4. 09:30

    Example: traffic drops and the site looks normal again

  5. 10:00

    Example: logs and flaky score reveal the pattern

Try it: traffic spike without cachingInteractive
Landing page not cached

Not cached

Leads or data lost

Every visitor runs the full app. Workers run out at the peak and some visitors get a 503 or 504.

Toggle the cause to see why caching often removes intermittent 5xx errors.

Frequently asked questions

The answers below cover the questions people ask most often about random server errors.

Questions people ask

Why does my website sometimes show a 500 or 503 error and then work again?

The server is probably running out of capacity for short periods. Common causes are too few PHP workers, a database connection limit, a heavy plugin or a scheduled job. Check your logs and resource graphs at the error times to find which.

What causes a 502 Bad Gateway that comes and goes?

A 502 means a proxy or load balancer got a bad reply from the app behind it. If it only happens sometimes, the app may be crashing, restarting or overloaded, or one node behind a load balancer may be unhealthy.

How do I find intermittent 5xx errors in my logs?

Open your server access log and filter for status codes from 500 to 599. Note the times and compare them with traffic peaks, cron jobs and backups. A repeating pattern usually points to the cause.

Can a traffic spike from ads cause 503 errors?

Yes. A burst of clicks or an email send can use up all your workers or database connections. New visitors then get a 503 or 504 while you still pay for the clicks. Caching landing pages is the cheapest first fix.

Does FunnelGuard load test my website?

No. FunnelGuard runs your real customer journeys on a schedule and re-checks failures from a second region. It tracks a flaky score and uses a 2-of-3 rule, but it does not generate heavy traffic. Use a staging load test for capacity.

How can I tell if a failed check is a one-off or a real problem?

Look at how often the journey fails over time. A single failure that passes on re-check is usually a blip, while repeated failures across runs show a real instability. FunnelGuard's flaky score shows this pattern.

Will intermittent server errors affect my ad tracking?

They can. If the error page does not load your tags, the visit is not recorded, so analytics may show fewer visits instead of errors. Server logs are the reliable source.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: Flaky score and 2-of-3 rule; no load testing.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.