Skip to content

Implementation of a Hot-Backup mechanism for decoupled AI analysis #59

@JonanOribe

Description

@JonanOribe

The idea of use a single SQLite database for both high-frequency SDR data ingestion and future heavy AI/ML analysis (like YOLO training or signal classification) will create a significant I/O bottleneck. Heavy queries for data processing can increase latency in the ingestion pipeline, potentially leading to dropped samples or "Database is locked" errors during peak SDR activity.

Implementing a Hot-Backup architecture could be useful. The idea is to maintain two separate database files:

  • Ingestion DB (Hot): Optimized strictly for high-speed writes from the SDR hardware, running in WAL mode with minimal indexing.

  • Analysis DB (Cold/Mirror): A near-real-time clone created via the SQLite Local/Online Backup API.

This would allow our future AI models to perform intensive analysis and training on the "Analysis DB" without interfering with the live signal capture. This decoupling ensures data integrity and system stability.

Using a single database with complex PRAGMA tuning, which helps but does not fully eliminate the hardware contention between the SDR bus and the GPU's data-fetching needs.

By using a decoupled approach, we can also implement different retention policies for each DB and ensure that the AI training process has a consistent "point-in-time" snapshot to work with.

Technical Justification: CPU vs. GPU for SDR Workloads

  • Parallel Throughput: CPUs process signals sequentially, leading to bottlenecks at high sample rates, whereas GPUs use thousands of cores to compute FFTs and AI inferences in parallel.

  • Real-Time Processing: GPUs handle massive bandwidth in real-time without "dropped samples," while CPUs often struggle to balance OS tasks, database management, and heavy math simultaneously.

  • AI Efficiency: Running YOLOv12 on a CPU results in low frame rates and missed signals, while a GPU analyzes the spectrogram instantly for rapid pattern recognition.

  • Latency Reduction: Offloading DSP (Digital Signal Processing) to the GPU minimizes system latency, ensuring the "Analysis DB" is processed as fast as the "Ingestion DB" fills.

Storage Justification: Reliability over Redundancy

  • I/O Isolation: Doubling the disk footprint is a minor trade-off for preventing "Database is locked" errors. By separating the databases, we ensure that the high-speed SDR write stream is never interrupted by the heavy read-intensive AI training or signal analysis.

  • Transient Analysis Workspace: The "Analysis DB" does not need to store data indefinitely. Once the GPU has processed the signals and extracted the relevant metadata/inferences, the raw data in the Analysis copy can be discarded. If we want to audit the data source in the future, we have the original database.

  • Data Integrity: The primary "Ingestion DB" remains the "Single Source of Truth." If an analysis process crashes or corrupts the temporary database, the original signal data remains untouched and safe.

  • Buffer Management: This architecture allows us to implement a "Circular Buffer" strategy: we only clone the most recent or relevant signal chunks for analysis, keeping the secondary disk usage lean while maintaining the primary reference on the main drive.

I would be happy to take on this task and submit a PR. I have already researched the implementation using sqlite3.backup() in Python and can provide a draft that includes a configurable redundancy toggle (Local vs. Cloud).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions