Files
homarr/docs/perf
Thomas Camlong ca0bb36664 docs(perf): Cache Components tested and rejected, with the numbers
Enabled cacheComponents: true on Next 16.3.0-preview.9 and built. The flag works
and the usual migration friction is absent - zero files export dynamic,
revalidate or fetchCache.

Two blockers. The [locale] dynamic root segment needs generateStaticParams,
which is cheap: the guide is explicit that one value suffices, because
dynamicParams: true now serves the App Shell for unlisted params and upgrades in
the background. Not 53 routes x 38 locales.

Past that, 111 routes fail with the same error - SqliteError: no such table:
serverSetting. Prerendering runs at build time and the root layout
unconditionally awaits auth, two DB reads and a cookie read. For a self-hosted
app whose database is created at runtime on the user's volume there is nothing to
query during a build. Deferring those reads means moving the providers that wrap
children inside Suspense, which leaves a static shell of little more than
<html><body> - the exact failure the migration guide warns about.

And the prize is ~16-21 ms: measured TTFB is ~3 ms for a route that skips the
root layout against ~19-24 ms for one that goes through it. Meanwhile the board -
the main screen - is already dynamic(..., { ssr: false }) with a skeleton, so it
already paints an instant shell and Cache Components has no server render to
unblock there.

Recorded with both caveats: the ~20 ms is warm local SQLite and would be larger
on a network database, and the useful idea inside this - not blocking the first
byte on auth plus two DB queries - can be had by streaming those reads in the
existing layout, without the migration.

Experiment fully reverted; no code changes in this commit.
2026-08-14 11:11:50 +02:00
..

Homarr performance investigation

Measured work on Homarr's memory and rendering cost, split by subject. Every figure here comes from a run of scripts/benchmarks/stress-restore.mts against a restored real backup — 4 boards, 51 widgets, 11 integrations, driven through an actual login — not from a synthetic or empty container.

document subject
SERVER-MEMORY.md What the container's RAM is made of, and the changes that reduced it
CLIENT-PERFORMANCE.md Dashboard rendering cost in Chrome: DOM, fibers, images, paint
WIDGET-AUDIT.md All 50 widgets, one at a time, with a verdict and the evidence for each
REJECTED.md Ideas that were implemented and measured, then abandoned — with the numbers
METHODOLOGY.md The tools, and the measurement traps that produced wrong answers
NEXT-STEPS.md Handoff: what is unverified, what to do next, and the set for a clean PR

Headline result

Server RAM, merge-base 06724cfeb vs this branch, two alternated runs per side, reported as cgroup anonymous memory because that is what counts against a container limit and cannot be reclaimed:

stage before after change
peak 376.6 MiB 279.3 MiB −26%
boot idle 130.5 MiB 62.4 MiB −52%
after sign-in 247.4 MiB 142.9 MiB −42%
dashboard loaded 293.4 MiB 170.4 MiB −42%
4 tabs, 2 boards 366.5 MiB 258.2 MiB −30%
after 2 min idle soak 323.7 MiB 200.8 MiB −38%

No before/after range overlaps at any stage. The cost is +18% CPU (solid, non-overlapping).

The changes that did it, by ratio

change size effect
--max-semi-space-size=4 1 line −19% idle, −21% peak
preloadEntriesOnStart: false 1 line −52% anon at idle, 310 fewer files even at full load
Umami: stop fetching 100k raw events per refresh 1 file −26% peak, −93% transient buffers
serverExternalPackages (mysql2/pg + 8 more) 1 block −21 MiB idle
ssh2's 16 MiB WASM heap (docker-modem patch) 1 patch −15 to −18 MiB external
content-visibility on media-release cards 4 lines −59% image requests, −41% layout objects

What is left, and why it is hard

One lever has real headroom and it pays twice. Roughly 41 MiB of retained bundle source and ~38 MiB of V8 compiler zone memory both scale with how much JavaScript the server loads and compiles, and the largest single contributor is a 16.10 MiB subtree reached by every API route — the tRPC router importing every integration eagerly. Reducing that reduces both.

Everything else has been measured and closed: see REJECTED.md.