perf(statuspages): paging, search and gzip for large status pages #165

Merged
Sebi merged 2 commits from perf/statuspage-editor-large-orgs into main 2026-11-26 23:12:44 +00:00
Owner

Summary

Status pages were slow for organizations with thousands of monitors: the editor, the group import, and the public page itself. uptimesebi-status.net/hetzner was 30 MB of uncompressed HTML.

Public status page

  • gzip: the status page server compresses text responses (HTML, CSS, JS, JSON, XML/RSS). New platform.Compress() middleware; it skips HEAD, 204, 304 and responses that are already encoded.
  • Paging: 50 components per page via ?page=N, with first/previous/next links and "Page x of y". Group headings keep the status and count of the whole group. Out-of-range pages show the last page. Single-file exports still list everything.
  • Search: pages with more than one page of components get a search box (?q=). It matches component and group names, and paging keeps the query.
  • Slim bars: rows that link a detail page draw their 90 bars as one <path> per status, without per-bar <title>. The detail page keeps the tooltips.
  • With 3128 components locally: 30 MB → 110 KB, 3.3 KB gzipped.

Editor and import

  • Paging: "Monitors on this page" shows 50 monitors at a time, with previous/next and an "x–y of n" status. All rows stay in the form, as saving replaces the page's monitors. "Add all" / "Remove all" still apply to every monitor the filter matches, across pages.
  • Smaller page: every row carried the options of all groups. Rows now carry only their own group and get the full option list from the row template when shown or focused. With 3500 monitors and 120 groups the editor went from 35 MB to 4.7 MB, and from 490 ms to 170 ms locally.
  • Filter fix: the filter searched the whole row, including the group names in the select, so a group name matched every ticked row. It now matches the monitor name and group path only.
  • Import: POST /org/statuspages/:id/groups/import updated each monitor in its own statement, 3500 round trips. It now creates the groups one nesting level at a time and files all monitors in one UPDATE … FROM unnest(…). Locally it went from 2.3–2.8 s to 0.3–0.7 s; in prod the gain is larger, because each round trip goes through HAProxy.

Test plan

  • New TestComponentPagingAndSearch covers pages, clamping, search by component and group name, no-match text, path bars, and the detail page keeping its tooltips.
  • New TestCompress covers gzip and q=0, *, small or binary bodies, and 304.
  • Full go test ./... passes. TestDispatchSpreadsRandomly failed once in the parallel run and passes three times on its own; it is unrelated.
  • New JS test internal/web/testdata/rowpager.html covers paging, the filter, check-all across pages, the rows of all pages being sent, and the lazy options.
  • TestStatusPages, TestStatusPageGroupsAndDetails and the other status page API tests pass.
  • Local perf run with 3500 monitors and 120 nested groups.

🤖 Generated with Claude Code

https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3

## Summary Status pages were slow for organizations with thousands of monitors: the editor, the group import, and the public page itself. `uptimesebi-status.net/hetzner` was 30 MB of uncompressed HTML. ### Public status page - **gzip:** the status page server compresses text responses (HTML, CSS, JS, JSON, XML/RSS). New `platform.Compress()` middleware; it skips HEAD, 204, 304 and responses that are already encoded. - **Paging:** 50 components per page via `?page=N`, with first/previous/next links and "Page x of y". Group headings keep the status and count of the whole group. Out-of-range pages show the last page. Single-file exports still list everything. - **Search:** pages with more than one page of components get a search box (`?q=`). It matches component and group names, and paging keeps the query. - **Slim bars:** rows that link a detail page draw their 90 bars as one `<path>` per status, without per-bar `<title>`. The detail page keeps the tooltips. - With 3128 components locally: **30 MB → 110 KB**, 3.3 KB gzipped. ### Editor and import - **Paging:** "Monitors on this page" shows 50 monitors at a time, with previous/next and an "x–y of n" status. All rows stay in the form, as saving replaces the page's monitors. "Add all" / "Remove all" still apply to every monitor the filter matches, across pages. - **Smaller page:** every row carried the options of all groups. Rows now carry only their own group and get the full option list from the row template when shown or focused. With 3500 monitors and 120 groups the editor went from 35 MB to 4.7 MB, and from 490 ms to 170 ms locally. - **Filter fix:** the filter searched the whole row, including the group names in the select, so a group name matched every ticked row. It now matches the monitor name and group path only. - **Import:** `POST /org/statuspages/:id/groups/import` updated each monitor in its own statement, 3500 round trips. It now creates the groups one nesting level at a time and files all monitors in one `UPDATE … FROM unnest(…)`. Locally it went from 2.3–2.8 s to 0.3–0.7 s; in prod the gain is larger, because each round trip goes through HAProxy. ## Test plan - [x] New `TestComponentPagingAndSearch` covers pages, clamping, search by component and group name, no-match text, path bars, and the detail page keeping its tooltips. - [x] New `TestCompress` covers gzip and q=0, `*`, small or binary bodies, and 304. - [x] Full `go test ./...` passes. `TestDispatchSpreadsRandomly` failed once in the parallel run and passes three times on its own; it is unrelated. - [x] New JS test `internal/web/testdata/rowpager.html` covers paging, the filter, check-all across pages, the rows of all pages being sent, and the lazy options. - [x] `TestStatusPages`, `TestStatusPageGroupsAndDetails` and the other status page API tests pass. - [x] Local perf run with 3500 monitors and 120 nested groups. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi added 1 commit 2026-11-26 22:38:34 +00:00
perf(statuspages): page the monitor list and batch the group import
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 10m59s
ci / test (pull_request) Successful in 12m44s
ci / build (pull_request) Successful in 18m14s
ci / image (pull_request) Canceled after 1m1s
52d2ce25c9
With thousands of monitors on a status page the editor was tens of
megabytes, as every row carried the options of all groups, and
importing the monitor groups updated each monitor in its own statement.

- The monitors of the editor are shown 50 at a time. All rows stay in
  the form, as saving replaces the page's monitors.
- Rows carry their own group only and get the other options from the
  row template once shown or focused.
- The filter matches a monitor's name and group path only, no longer
  the names of the groups in its select.
- The import creates the groups one nesting level at a time and files
  all monitors in one statement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi added 1 commit 2026-11-26 23:10:43 +00:00
perf(statuspages): page, search and compress public status pages
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Failing after 13m31s
ci / test (pull_request) Successful in 13m30s
ci / build (pull_request) Skipped
ci / image (pull_request) Skipped
b051f6c430
A status page with 3128 components was 30 MB of uncompressed HTML: all
components at once, each with 90 bars carrying a tooltip.

- The status page server gzips text responses.
- Status pages list 50 components at a time (?page=N) and offer a search
  (?q=) over component and group names once they have more than one
  page. Group headings keep the status and count of the whole group.
  Single-file exports still list every component.
- Rows linking a detail page draw their bars as one path per status,
  without tooltips; the detail page keeps them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi changed title from perf(statuspages): page the monitor list and batch the group import to perf(statuspages): paging, search and gzip for large status pages 2026-11-26 23:10:52 +00:00
Sebi merged commit 965848017d into main 2026-11-26 23:12:44 +00:00
Sebi deleted branch perf/statuspage-editor-large-orgs 2026-11-26 23:12:49 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZB-Server/uptimesebi#165