Skip to content
FunnelGuard

Fix guide by FunnelsGuard

One bad server behind a load balancer: how to find and fix it

OPS-090High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

A load balancer is a service that spreads visitors across two or more servers (called nodes or backends). If one node breaks, for example it runs out of disk, has an old code version, or loses its database connection, the load balancer may keep sending it a share of traffic.

The result is random failure. With three nodes and one bad, roughly one request in three fails. Reload the page and it works, which is why this is so hard to spot and so easy to dismiss as a glitch.

One bad node in a pool of three
  1. Visitor arrivesClicks an ad or link
  2. Load balancerPicks a node per request
  3. Node B (bad)Returns 500/502 or a stale page
  4. Form submitNever completes
  5. Lead and trackingNo lead, no conversion hit

The load balancer keeps routing some visitors to the broken node, so those visitors never reach the thank-you page.

Why it costs you leads or sales

Every visitor sent to the bad node sees an error, a blank page, a broken form or an old version of the site. You still pay for the click, but the lead or sale is lost. Because most requests succeed, dashboards look mostly fine and nobody raises an alarm.

It also skews your data. A bad node may serve a page without tracking tags, so conversions go missing from some visitors only. You see a vague drop rather than a clear outage.

Share of visitors who complete the formExample numbers
Share of visitors who complete the form (example)All nodes healthy: 100 %; 1 of 3 nodes bad: 67 %; 2 of 3 nodes bad: 33 %038771006733All nodes healthy1 of 3 nodes bad2 of 3 nodes bad%

Example: with 3 nodes and 1 broken, about one third of visitors hit the failing server. Numbers are illustrative.

How to check if your site has it

Look for failures that come and go with no change on your side. Common signs: customers say the form worked for a colleague but not for them, error rates sit at a steady few percent, or a fix you deployed seems to work only some of the time.

Signs of a bad node
  • Reloading the same page sometimes gives an error and sometimes works
  • Server logs show 500, 502 or 504 errors from only one backend
  • A recent deploy is visible on some loads but not others
  • Tracking or form problems affect only a slice of sessions
  • The load balancer dashboard shows one target as unhealthy or has no health check at all

To find the culprit, test each node directly, bypassing the load balancer. Replace the IP and hostname with your own. Run the loop below and compare status codes and response sizes.

Test every backend directlybash
for ip in 10.0.1.11 10.0.1.12 10.0.1.13; do
  echo "== $ip"
  curl -s -o /dev/null -w "%{http_code} %{size_download} bytes %{time_total}s\n" \
    --resolve www.example.com:443:$ip https://www.example.com/
done

A node that returns a different status code, a different page size or a much slower time is your suspect. Also compare the deployed version, for example a build number in a response header or a file's checksum, across nodes.

How to fix it

Remove and repair the bad node
  1. Take the node out of rotation

    In your load balancer, drain or deregister the bad target so it stops getting new traffic. This stops the losses straight away.

  2. Find the cause

    Check the node's disk space, memory, web server and app logs, database connection, and whether it runs the same code and config as the healthy nodes.

  3. Repair or replace it

    Redeploy the current build, fix the config, or rebuild the node from your standard image. Replacing is usually safer than patching by hand.

  4. Test it directly before re-adding

    Run the curl loop above and submit a test form against that node only. Add it back once it matches the healthy ones.

  5. Add a real health check

    Point the load balancer health check at a URL that exercises the app (for example a page that touches the database), not just a port check. Set a failure threshold so unhealthy nodes are removed automatically.

Where to set the health check
  1. Nginx upstream

    Use max_fails and fail_timeout on each server line in the upstream block so Nginx stops sending traffic to a failing node. Open source Nginx only reacts to real request failures; active health checks need Nginx Plus or another proxy such as HAProxy.

  2. HAProxy

    Add 'option httpchk GET /health' and 'check' on each server line so HAProxy probes the app and removes failing servers.

  3. Cloud load balancer

    In AWS, Google Cloud or Azure, open the target group or backend service and set the health check path, interval and unhealthy threshold. The menu names differ by provider.

Nginx: stop routing to a failing nodenginx
upstream app_pool {
    server 10.0.1.11 max_fails=3 fail_timeout=30s;
    server 10.0.1.12 max_fails=3 fail_timeout=30s;
    server 10.0.1.13 max_fails=3 fail_timeout=30s;
}

How to confirm it's fixed

Because the fault was intermittent, one good test proves nothing. Send many requests through the load balancer and check that every one succeeds.

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

You should see only 200 (or your normal redirect code). Then submit your form several times and confirm each lead arrives in the inbox and CRM. Watch the load balancer's unhealthy-host count for a day.

How to prevent it happening again

Keep the pool healthy
  • Use application-level health checks with a sensible failure threshold
  • Alert when any single node is marked unhealthy
  • Deploy to all nodes the same way, from one image or pipeline
  • Monitor disk, memory and error rate per node, not only for the pool
  • Share uploads, sessions and cache between nodes
  • Run repeated end-to-end form tests, not a single check
How a silent bad node unfolds
  1. Day 1

    A deploy fails on one node, which keeps the old code.

  2. Day 1

    Port check still passes, so the node stays in the pool.

  3. Day 2

    Some visitors see errors; most don't, so nobody notices.

  4. Day 5

    Lead numbers look lower than expected; staff say 'it works for me'.

  5. Day 6

    Node found, drained and rebuilt; health check added.

How FunnelGuard handles this

FunnelGuard detects this only partly. It runs your real journeys (form, checkout, booking or chat button) on a schedule and re-checks any failure from a second region. From those repeated runs it produces a flaky score, which shows when a journey passes some times and fails others. That pattern is the typical sign of one bad node.

What it does not do: FunnelGuard sees your site from the outside, through the load balancer. It does not know which node served a request, does not connect to your servers, and cannot read per-node logs or load balancer health. A scheduled run may also happen to land on healthy nodes and miss the problem, especially on the Free plan with daily checks.

To cover the rest by hand: when a flaky score rises, use the curl loop above to test each backend directly, check the load balancer's target health, and compare logs per node. Set up node-level alerts in your hosting or cloud monitoring.

Questions people ask

Why does my website work sometimes and fail other times?

If your site runs on several servers behind a load balancer, one unhealthy server can cause random failures. Visitors routed to it see errors, while others see a normal site. Test each server directly to find out which one is failing.

How do I find which server behind a load balancer is failing?

Request your site from each backend directly, for example with curl and the --resolve option, and compare status codes, response sizes and timing. The node that differs is the suspect. Then check that node's logs, disk, memory and deployed version.

Why doesn't my load balancer remove the broken server automatically?

Usually the health check is too shallow, such as a simple port or TCP check that passes even when the app returns errors. Point it at an application URL that returns 200 only when the app and database work, and set an unhealthy threshold.

Why do I get random 502 or 503 errors?

A 502 or 503 from a load balancer often means a backend failed to respond or is out of service. If only some requests fail, one node in the pool is the likely cause, though overloaded or restarting servers can do the same.

Can a bad node cause missing conversions in analytics?

Yes. A node running old code or a broken template may serve pages without your tracking tags or with a failing form. Conversions then go missing for only the share of visitors routed to that node.

Can FunnelGuard tell me which server is bad?

No. FunnelGuard tests through your public site and reports a flaky score when a journey passes and fails at different times. It cannot see individual nodes, so you need to check the backends yourself.

How many times should I test to be sure it's fixed?

Send dozens of requests through the load balancer and submit your form several times. With one bad node in three, a single test passes about two times in three, so repeated tests are the only reliable proof.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: Flaky score.

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.