← all posts site ↗

glance loads in milliseconds now

my dashboard was taking five seconds to load in the worst case, and the root cause was a design decision in the tool itself. widgets only refetch in the foreground, when a page loads, never in the background. so every visit paid for every expired widget, and two of the upstreams were glacier slow, the device list that hits the tailscale api live and the server stats endpoint at half a second a pop.

the fix is a small cache proxy in front of both slow upstreams, in memory, refreshed by background threads on their own timers, and a keeper service that warms every widget cache every sixty seconds so nothing ever expires between visits. the docker widget cache got a ten minute ttl. measured after a full cold restart: eight to sixteen milliseconds per visit. the proxy even serves last good data when the upstream dies, which is the kind of failure mode you want out of a dashboard, it degrades instead of dying.

the same evening had a fake mystery: the backup counter said zero days, which looked like the backup had run minutes ago, because the backup script rewrites its status file at the end of every run. the counter is cheap to refresh daily, and it lives in a separate timer because rolling it into the weekly backup would just resurrect the same staleness. the number on the dashboard should mean what it looks like it means.