github scottlamb/moonfire-nvr v0.7.26

5 hours ago
  • Major changes to sample file directory IO.

    • All directory I/O happens on each directory's two-thread pool with threads
      named dir-<PATH>. Formerly, I/O could happen on the per-stream writer
      threads, per-directory reader threads, and occasionally on even the
      tokio worker threads.

    • Stream shutdowns are more responsive now. Before they could wait up to
      30 seconds for a connect/frame timeout; now the shutdown request aborts
      these operations.

    • Multiple sample file directories are scanned in parallel, speeding
      program startup.

    • Streamers write only into a recent frames buffer in RAM, which the directory
      pool workers asynchronously write to disk approximately once per GOP, where
      formerly there was a write call per frame.

      In the new model, streamers never fall behind due to HDD I/O. Instead, frames
      are buffered up to a limit. Recordings are aborted if the pool falls too
      far behind.

      This roughly halves CPU usage as thread hand-offs and syscalls are less common.
      It also enables several desirable future changes:

      • audio recording (which radically increases the number of frames and thus
        would otherwise significantly increase CPU usage).
      • "monitor mode" (allowing live view without recording to disk).
      • further CPU reductions for live view (by skipping all SQLite ops and disk I/O).
    • Streamers never acquire the full SQLite database lock, only a per-stream lock.
      They thus never wait on SQLite operations, except indirectly if the tokio thread
      is performing SQLite work on another task. A future change will move all
      SQLite operations to a dedicated thread to avoid such stalls. This was previously
      not viable because it would cause too many thread hand-offs.

  • bump minimum Rust version to 1.91.

Don't miss a new moonfire-nvr release

NewReleases is sending notifications on new releases.