Cómo creé un dashboard ultraligero con Raspberry Pi 5: diseño con carga cero en condiciones normales mediante Rust
The 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 on a server that runs 24/7, the most concerning issue was the counterproductive situation where “the monitoring process itself constantly consumes CPU and disk I/O.”
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 the new dashboard, “Gonta Command Center”:
- 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 when displaying the screen.
- All HTML/CSS/JS are baked directly into the Rust binary using
- 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 a browser connects.
- No background daemons run periodically; data is pulled from kernel virtual memory (
- Automatic Suspension upon Mobile Screen Timeout
- The browser’s
visibilitychangeevent is captured to sever the SSE connection instantly when a tab is hidden or a mobile device enters sleep mode.
- The browser’s
[!NOTE] Metrics for LVM SSD cache hit rates (dm-cache) and disk capacity, which are monitored targets, are 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 a mobile phone from outside the home, enabling one-finger startup and shutdown of the main development PC.