Linux Labs

Inside the system: resources, kernel, processes / Stage 4 of 12

ulimit and sysctl: system ceilings

Not running Starting usually ~20 s
Leave the lesson

Step 8 of 10 · lab · 25 minmedium

A service fails under load

The notification service keeps one connection per subscriber. There are now three hundred subscribers, and it works one moment and fails the next, even though a colleague has already changed something. Find the cause and fix it so that the service holds a thousand subscribers, including after a restart.

Situation

The lab-notify service — the notify-hub application — sends notifications for the intranet portal. Every open portal page subscribes to /events and keeps a connection to the service. While there were a few dozen subscribers, the service worked. Today there are about three hundred, and the service works one moment and fails the next: curl http://127.0.0.1:8090/health answers Connection refused every other time. Yesterday a colleague already changed the service settings — it did not help.

On this machine the subscribers are played by the lab-subscribers service: it keeps 300 subscriptions open and reconnects the dropped ones.

Task

  1. lab-notify holds 1000 subscribers at once: it answers curl http://127.0.0.1:8090/health and does not restart. The application code stays the same.
  2. Change the service settings in a drop-in. Do not edit the packaged unit /usr/lib/systemd/system/lab-notify.service or replace it with a copy: the next package update would overwrite it.
  3. systemd-analyze verify lab-notify.service prints nothing.
  4. The service holds the same load after a restart: sudo systemctl restart lab-notify.

There is no internet on the machine; everything you need is already installed. Run administrative commands with sudo.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 4
  • lab-notify holds 1000 subscribers, answers /health and does not restart; the application code is unchanged — not done yet
  • The setting lives in a drop-in of the service, the packaged unit is unchanged, and the process runs with it — not done yet
  • systemd-analyze verify lab-notify.service prints nothing — not done yet
  • The service holds the same load after a restart — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 4
  • lab-notify holds 1000 subscribers, answers /health and does not restart; the application code is unchanged — not done yet
  • The setting lives in a drop-in of the service, the packaged unit is unchanged, and the process runs with it — not done yet
  • systemd-analyze verify lab-notify.service prints nothing — not done yet
  • The service holds the same load after a restart — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 4
  • lab-notify holds 1000 subscribers, answers /health and does not restart; the application code is unchanged — not done yet
  • The setting lives in a drop-in of the service, the packaged unit is unchanged, and the process runs with it — not done yet
  • systemd-analyze verify lab-notify.service prints nothing — not done yet
  • The service holds the same load after a restart — not done yet
Loading…