Applying reactive programming approach in IoT based reliable crossroad traffic monitoring

Pavel Lavreshin

Problem statement

Is Reactive programming applicable in IoT traffic monitoring system?

Whether Reactive programming can make traffic monitoring system reliable and fault-tolerant?

IoT crossroad traffic monitoring - birds'-eye view

1.

2.

3.

Challenges in IoT crossroad traffic monitoring

  • Streamed data processing efficiency - bounded system resources

  • System responsiveness - usability, consistency

  • Platform resilience - fault-tolerance, self-healing, recovery

  • Services scalability - horizontal scaling potential

Reactive programming paradigms in this work

  • Actor model

  • Reactive streams

  • Event Sourcing, CQRS

Reactive solution success criteria

  • Use message-driven communication or streams

  • Persist events in Event Store

  • Remain responsive under load

  • Stay resilient in case of failures and errors

  • Be elastic and utilise system resources efficiently

Methods used in the work

  • Proof of concept software development
  • Simulation scenario setup
  • Actors based implementation
  • Reactive streams based implementation
  • Performance evaluation and metrics
  • Outcomes and analysis

PoC simulation setup

Video recognition events: 

 

Sensor events: 

 

  • Traffic incidents
  • Road lane queues
  • Vehicles passing  / vehicle type detection 
  • Weather conditions updated (temperature, humidity)
  • Road surface conditions changed (ice / wet / dry)  

I Actor model

1.

2.

3.

Actors implementation outcome

Pros:

Cons:

  • Low-level machinery required
  • No back-pressure support
  • System resources unsafe
  • Encapsulated state
  • Lightweight and cheap to spawn in the system
  • Messages delivery guarantees

II Reactive streams

1.

2.

3.

4.

Reactive streams implementation outcome

Cons:

  • Parallelism and concurrency with high-level DSL 
  • Back-pressure out of the box
  • Less CPU context switches and reduced memory usage 

Pros:

  • Steep learning curve
  • Few runtime issues encountered due to lack of docs

Summary

Reactive programming in IoT brings:

  • Concurrency
  • Durability
  • Fault-tolerance
  • Efficient resource utilisation

Is Reactive programming applicable in IoT crossroad traffic monitoring ?

Thanks for attention! 

Questions?

Made with Slides.com