Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Check Load Balancer Health & Performance

· 6 min read · Smart Home

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Load balancers distribute incoming traffic across multiple servers to keep applications fast and available. Checking their health means verifying that each backend server is reachable, traffic is evenly distributed, and no single server is overloaded. This guide walks you through the essential checks—from basic status pages to deeper performance metrics—so you can catch problems before users do. You'll need access to your load balancer's management interface or command line, and ideally a monitoring tool already in place.

What You'll Need

  • Admin access to your load balancer (web UI, CLI, or API)
  • Credentials for the backend servers (or at least the ability to ping/curl them)
  • A list of your backend server IPs or hostnames
  • Optional: a monitoring tool (e.g., Prometheus, Grafana, CloudWatch) if you want historical data

Step-by-Step

  1. Log into your load balancer's management interface. This could be a web dashboard (like HAProxy's stats page), a cloud console (AWS ALB, Azure Load Balancer), or a CLI (nginx, F5). If you're using a cloud provider, navigate to the load balancer section of your console.
  2. Check the overall status. Look for a summary that shows whether the load balancer itself is healthy (e.g., 'Active', 'Up'). If it's down, skip to troubleshooting.
  3. Review backend server status. Find the list of backend servers or targets. Each should have a status like 'Healthy', 'Unhealthy', 'InService', or 'OutOfService'. Note any that are marked unhealthy—these are your first red flags.
  4. Verify health check settings. Look at the health check configuration: the protocol (HTTP, TCP), the path (e.g., /health), the interval, and the threshold for marking a server down. Ensure these match your application's actual health endpoint. If the path is wrong, servers may appear unhealthy even when they're fine.
  5. Test a backend manually. From your own machine, curl or ping each backend server directly to confirm it responds. For example, curl -I http://backend1:8080/health. If a server responds but the load balancer says it's unhealthy, the health check config is likely the issue.
  6. Check traffic distribution. Look at the request counts or bytes sent per backend over a recent time window. Ideally, they should be roughly equal. If one server is handling 90% of traffic, your load balancing algorithm (round-robin, least connections) might be misconfigured, or that server may be the only one marked healthy.
  7. Inspect performance metrics. Look at key numbers: active connections, request latency, error rates (5xx), and throughput. High latency or error rates on a specific backend indicate that server is struggling. Many load balancers expose these in a stats page or via an API.
  8. Check for connection timeouts. If clients are experiencing slow responses, look at the load balancer's timeout settings (e.g., connect timeout, read timeout). If they're too low, healthy backends that respond slowly might be marked as failed.
  9. Review logs. Examine the load balancer's access logs for recent 5xx errors, connection resets, or backend failures. Logs often reveal patterns, like a spike in errors after a deployment.
  10. Run a load test (optional but recommended). If everything looks healthy but you want to verify performance under stress, use a tool like Apache Bench or JMeter to send a burst of traffic. Watch the load balancer's metrics to see if any backend becomes unhealthy or if latency spikes.
  11. Document your findings. Record the status, any anomalies, and actions taken. This helps in future troubleshooting and trend analysis.

Common Mistakes

  • Ignoring unhealthy servers: A single unhealthy server can cause a cascade if it's not removed. Always investigate why a server is marked down.
  • Using the wrong health check path: If your app's health endpoint returns a 404 for the path you configured, the server will always be considered down.
  • Not checking both directions: Load balancers often have separate health checks for active and passive (e.g., TCP vs. HTTP). Ensure both are configured correctly.
  • Overlooking sticky sessions: If sticky sessions (session affinity) are enabled, traffic won't be evenly distributed—users stick to one server. This can look like an imbalance but is intentional.
  • Only looking at averages: Averages can hide spikes. Check percentiles (e.g., p95 latency) to see worst-case performance.

Tips

  • Set up alerts: Configure alerts for when a backend goes unhealthy or when error rates exceed a threshold. This way you don't have to manually check constantly.
  • Use a dedicated health endpoint: Create a lightweight endpoint (e.g., /healthz) that checks critical dependencies (database, cache) and returns a proper status code. This gives more accurate health signals than just checking if the server is up.
  • Monitor from outside: Use a third-party service (like UptimeRobot or Pingdom) to check your load balancer's public IP. This verifies external reachability, not just internal health.
  • Understand your algorithm: Know whether you're using round-robin, least connections, or IP hash. Each has trade-offs; least connections is better for uneven request sizes.
  • Keep health check intervals reasonable: Too frequent (every 1s) can overload your backends; too infrequent (every 60s) delays detection. A 5-10 second interval is a good starting point.

Troubleshooting

If a backend is marked unhealthy but responds to direct requests:

  • Check the health check path and port. Ensure the path returns a 2xx or 3xx status code, not a redirect.
  • Verify that the health check comes from the load balancer's IP, not your local IP. Some firewalls block the load balancer's IP.
  • Review the load balancer's logs for the exact error (e.g., 'Connection refused' or 'Timeout').

If traffic is not evenly distributed:

  • Confirm that all backends are healthy. If one is down, traffic goes to the remaining ones.
  • Check if sticky sessions are enabled. If so, new sessions are balanced, but existing ones stick to their original server.
  • Verify the load balancing algorithm. If you're using 'least connections', a server with long-lived connections may receive fewer new requests—this is normal.

If the load balancer itself is down or unresponsive:

  • Check if the load balancer instance is running (e.g., in cloud console). If it's a VM, check CPU/memory usage.
  • Look at network security groups or firewalls—ensure the load balancer's ports are open.
  • Restart the load balancer service if necessary, but be aware of downtime.

If latency is high but backends are healthy:

  • Check the load balancer's own CPU and memory. It might be the bottleneck.
  • Review network latency between the load balancer and backends—if they're in different regions, latency will be higher.
  • Look at the backend's response time directly. If it's slow, the issue is the application, not the load balancer.

Frequently Asked Questions

Q: How often should I check load balancer health?
A: For critical systems, automate checks every 5-10 seconds via health checks and set up alerts. Manually review metrics at least weekly.

Q: What is a 'healthy' backend server?
A: A server is healthy if it passes the configured health check (e.g., returns HTTP 200 on /health) and is accepting connections. It doesn't mean the app is bug-free, just that it's responding.

Q: Can I check load balancer health without admin access?
A: Yes, you can use external monitoring tools to check the public endpoint. But you won't see per-backend status without some level of access.

Q: What's the difference between active and passive health checks?
A: Active checks are initiated by the load balancer (e.g., sending a request to /health). Passive checks monitor real traffic for failures (e.g., too many 5xx responses) and mark servers down accordingly.

Q: Should I use a load balancer for a small app?
A: It depends. If you have only one server, a load balancer adds complexity without benefit. But if you plan to scale or need high availability, it's worth it.

Q: What metrics are most important to monitor?
A: Backend health status, request latency (p95), error rate (5xx), and connection counts. These give a quick overview of both availability and performance.