Speed and watching
SchoolStack keeps an eye on its own speed, and a watch tells you when the site is down or slow. The targets: the slowest 5% of pages answered in under 300 ms (the time on the server, not people's internet), signing in under 1 second (checking a password is slow on purpose, to protect it), no errors, and the server using under 500 MB of memory.
The page: Users ▸ Server speed (/admin/speed, administrators only). Today and each of the last
7 days: pages served, the busiest hour, the typical page and the slowest 5% (with "on target" or
"over the target" in words), sign-ins, errors, minutes down or slow, restarts, the most memory used,
and the ten slowest kinds of page (like "A class's Classwork"; never a person or a name). It also
shows whether the watch is running, the free disk and the last backup. The server keeps 8 days of
these numbers in /var/lib/schoolstack/speed.json; /healthz adds the last minute's pages and their
slowest 5%.
The watch checks the site once a minute through its public address (so the web server in front and the certificate are checked too). It emails the owner:
- down: no good answer within 10 seconds, two minutes running;
- slow: the slowest 5% of pages over 1 second for three minutes running (with at least 20 pages a minute), or the check itself taking over 3 seconds;
- a reminder every hour while it lasts, and one email when it is back to normal;
- disk nearly full (under 10% free), once a day;
- a summary every morning at 7:00 (the school's time): yesterday's pages, the busiest hour, the slowest 5%, the ten slowest kinds of page, errors, minutes down or slow, restarts, the most memory used, the free disk and the last backup.
It stays quiet while schoolstack-update runs. Set it up once, after email is on
(Email): run sudo /opt/schoolstack/bin/schoolstack-watch-setup,
type your email address (two are allowed) and choose English or Arabic; a test email is sent at
once. Until then nobody is emailed (the page still shows the numbers).
sudo /opt/schoolstack/bin/schoolstack-watch-setup --off stops the emails.
The rush test shows how the server copes with the 8 a.m. rush. At a quiet time, run
sudo /opt/schoolstack/bin/schoolstack-load-test (about 15 minutes). It makes a practice school
(1,000 students, 60 teachers, 60 classes, each student in 6, with a term of work) in a temporary
folder, starts a second, hidden copy of SchoolStack that only the server itself can reach, and plays
a 10-minute rush: everyone signs in, opens Classes, a class, To-do, a lesson, answers practice
questions and turns work in; teachers grade and post. Then it prints the result, each target with
OK or NOT YET, and deletes the practice school. Your school's data is never opened or
changed, and it refuses to start when the server has too little free memory. The test shares the
processor with your real site, so its numbers come out a little worse than the truth (the safe
side). --students 300 --minutes 3 runs a smaller, shorter one.
What the watch can't see: when the whole server is off or has no internet, it can't send anything. An outside check covers that: DigitalOcean's own Uptime check (in the DigitalOcean control panel: Monitoring ▸ Uptime ▸ Create Uptime check, type your site's address, and add your email for alerts). DigitalOcean's pricing page says each Uptime check costs $1 a month and one check a month is free (checked on 2026-11-15).
Example: After the update, the owner runs schoolstack-watch-setup, types their address and
gets the test email. At 7:00 the next morning the summary arrives: 4,210 pages, slowest 5% 120 ms,
on target. On Sunday at a quiet time they run schoolstack-load-test and send the printed result
to the developer.
Related: Daily summary email · Where the data lives · Email (password-reset links)