HIRO GEAR
自作開発 RaspberryPi Rust

Building an Ultra-Lightweight Dashboard with Raspberry Pi 5 — Zero Load Design Using Rust

Building an Ultra-Lightweight Dashboard with Raspberry Pi 5 — Zero Load Design Using Rust

My Raspberry Pi 5 (Server #70) running at home hosts numerous containers essential for daily life, including WordPress, Nextcloud, PhotoPrism, and AdGuard Home.

When setting up a system dashboard for a server that runs constantly, my biggest concern was the counterproductive situation where “the monitoring process itself consumes CPU and disk I/O continuously.”

To address this, I decided to build an ultra-energy-efficient, on-demand dashboard in Rust that “only operates when viewed in a browser and remains completely silent otherwise.”

The Core of the Design: Zero Load During Normal Operation

The following three points were rigorously implemented in my new dashboard, “Gonta Command Center”:

  1. Full Inclusion into a Single Binary
    • All HTML/CSS/JS are baked directly into the Rust binary using include_str!, eliminating even physical disk reads during screen display.
  2. On-Demand Communication via Server-Sent Events (SSE)
    • No background daemons run periodically; data is pulled from kernel virtual memory (/proc, /sys) at a 3-second interval only when the browser connects.
  3. Automatic Suspension on Mobile Screen Off
    • The visibilitychange event of the browser is captured to sever the SSE connection instantly when a tab is hidden or a mobile device enters sleep mode.

[!NOTE] Metrics for LVM SSD cache hit rates (dm-cache) and disk capacity, which are monitored targets, are also fetched on-demand only during initial load or button presses, thoroughly eliminating unnecessary command execution overhead.

Results: A Mere 2.6MB Binary

The built binary size is a mere 2.6MB. Memory footprint stays within a few MBs, achieving a CPU usage rate of 0.0% during idle states.

Next, I will proceed with integrating this dashboard to send Wake-on-LAN signals via an external smartphone, enabling me to start and stop my main development PC with a single tap.