Step 8 of 10 · lab · 25 min
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
lab-notifyholds 1000 subscribers at once: it answerscurl http://127.0.0.1:8090/healthand does not restart. The application code stays the same.- Change the service settings in a drop-in. Do not edit the packaged unit
/usr/lib/systemd/system/lab-notify.serviceor replace it with a copy: the next package update would overwrite it. systemd-analyze verify lab-notify.serviceprints nothing.- 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
The machine is starting
Hints
0 of 3Lab 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
Goals are checked on the machine after every command.