Linux Labs

SRE practices: SLOs, incidents, redundancy / Stage 7 of 8

A load balancer and health checks

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 10 · on a machine · 4 min

Every other answer is a 500

What you will learn

  • Find the application copy that answers with errors from the load balancer's log.
  • Set up passive health checks, retries on another copy and timeouts in an nginx upstream.
  • Explain how keepalived moves the site's floating address to a standby machine.

An online shop runs on two copies of the same application — the lab-backend@8081 and lab-backend@8082 services. nginx sits in front of them and splits the requests between them. At night the on-call engineer gets complaints: the page sometimes opens and sometimes shows an error.

Check the copies and request the site a few times. “Start” will prepare the server.

Exercise · look

Request the site six times

Check whether both copies of the application — the lab-backend@8081 and lab-backend@8082 services — are running, then request the site six times in a row.

Sign in and start The machine is available after signing in
Check yourself 1 question

How were the errors spread over the site's six answers?

  • The order is even: 500 is the second, fourth and sixth answer. Run the loop again and the order is the same.

  • The output has three 200 answers: the first, third and fifth.

  • The codes alternate from the first request: 200, 500, 200, 500… No copy broke in the middle of the loop.

The answers alternate: 200, 500, 200, 500, 200, 500.

Ubuntu 24.04
Loading…