HIRO GEAR
自作開発 RaspberryPi Rust

Raspberry Pi 5 를 사용한 초경량 대시보드 제작기 ── Rust 기반의 정상 상태 부하 제로 설계

Raspberry Pi 5 를 사용한 초경량 대시보드 제작기 ── Rust 기반의 정상 상태 부하 제로 설계

At home, I’m running a Raspberry Pi 5 (Server #70) that hosts numerous containers supporting my daily life, including WordPress, Nextcloud, PhotoPrism, and AdGuard Home.

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

To solve this, I decided to build an ultra-energy-efficient, on-demand dashboard in Rust that “only moves when you open the browser and remains completely silent otherwise.”

The Core of the Design: Zero Load During Normal Operation

With this new dashboard, “Gonta Command Center,” I focused on the following three points:

  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 when displaying the screen.
  2. On-Demand Communication via Server-Sent Events (SSE)
    • Instead of running periodic background daemons, data is pulled from kernel virtual memory (/proc, /sys) at 3-second intervals only when a browser connects.
  3. Automatic Suspension When the Phone Screen Turns Off
    • By listening to the browser’s visibilitychange event, SSE connections are severed instantly when a tab is hidden or the phone goes to sleep.

[!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: Just 2.6MB Binary Size

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 plan to integrate this dashboard with Wake-on-LAN via my phone while away from home, allowing me to start and stop my main development PC with just one finger tap.