Skip to content

florin414/iron-shadow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

IronShadow 🏭🌑

Rust Concurrency Scale License

IronShadow is an industrial-grade Digital Twin engine designed for the "noisy" reality of manufacturing environments.

While traditional IoT platforms struggle with the "Thundering Herd" problem (thousands of devices reconnecting simultaneously after a network drop), IronShadow leverages Rust's zero-cost abstractions and the Actor Model to maintain a synchronized state (Device Shadow) with predictable latency.

🏗️ Architectural Pattern: The Device Shadow

In unstable networks (Factory Floors), you cannot rely on a direct request/response loop to the device. IronShadow implements a 3-state synchronization machine:

  1. Reported State: What the device says it is doing (e.g., "Temp: 80°C").
  2. Desired State: What the application wants the device to do (e.g., "Set Temp: 75°C").
  3. Delta: The difference calculated by the engine, triggering commands only when necessary.

🚀 Performance & Design Decisions

1. The Actor Model (Actix/Tokio)

Each connected device is represented by a lightweight Actor (~2KB RAM). This allows IronShadow to hold the state of 1 million devices in memory on a single commodity server, processing state changes asynchronously without thread contention.

2. Backpressure Handling

Uses an internal specific MQTT broker implementation (based on rumqttd) that applies backpressure to the TCP stream. If the database (TimescaleDB) slows down, the ingestion layer slows down the network read rate, preventing Out-Of-Memory (OOM) crashes.

3. Data Storage

  • Hot State: Redis (for instant Shadow retrieval).
  • Cold History: TimescaleDB (PostgreSQL) for time-series analytics and predictive maintenance training data.

🛠️ Tech Stack

  • Language: Rust (Async)
  • Messaging: MQTT v5
  • State Management: Redis
  • Time-Series DB: TimescaleDB
  • Protocols: WebSockets (for real-time dashboarding)

📦 Benchmark

# Run the load generator (simulating 50k sensors)
cargo run --release --bin swarm -- --devices 50000 --frequency 100ms

# Output:
# Ingestion Rate: 500,000 msg/sec
# CPU Usage: 15% (16 Cores)
# Memory Usage: 1.2 GB

About

A high-throughput Digital Twin platform written in Rust. Implements the "Device Shadow" pattern to synchronize state between edge devices (MQTT) and the cloud, capable of handling 1M+ concurrent connections with minimal memory footprint.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors