Redis 8 beyond caching to uniquely powerful traffic management system.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5175

    #1

    Redis 8 beyond caching to uniquely powerful traffic management system.

    This is a submission for the Redis AI Challenge: Beyond the Cache.


    What I Built

    A real-time air traffic control simulator that can track aircraft positions (latitude, longitude, altitude). Detect potential collisions using geospatial calculations, and visualize aircraft movement on a live map. It also generates alerts when aircraft violate safety thresholds.


    Demo

    Here is the GitHub repo: https://github.com/SebastianKibiriti...-with-deepseek


    How I Used Redis 8

    The features of Redis 8 that were used are: GEOADD, for storing the positions of the aircraft + GEORADIUS, for querying other aircrafts nearby.






    # Store aircraft positions
    redis.geoadd(
    "aircraftositions",
    {aircraft_id: (longitude, latitude)}
    )

    # Query nearby aircraft (1km radius)
    conflicts = redis.georadius(
    "aircraftositions",
    current_lng, current_lat, 1, "km"
    )







    Lua Scripting for collision detection.






    -- conflict_check.lua
    local nearby = redis.call('GEORADIUS', KEYS[1], ARGV[1], ARGV[2], 1, 'km')
    -- Checks altitude differences using ZSCORE







    Streams, for real-time alerts. little to no alerts will be missed with faster replication.






    # Trigger alert
    redis.xadd(
    "conflict_alerts",
    {"trigger_id": "flight123", "conflicts": "flight456"}
    )

    # Frontend consumes via WebSocket
    alerts = redis.xread({"conflict_alerts": "$"}, block=0)







    Multithreaded I/O to optimize performance. This allows for more that 1000+ concurrent aircraft updates to be handled.


    The combination of geospatial, streaming, and Lua scripting creates a unique traffic management system.


    Architecture Diagram






    More...
Working...