You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add sophisticated rate limiting system for streaming GPS data
- Implement Rate-Limited State Manager pattern for high-frequency telemetry
- Add configurable per-aircraft, per-message-type rate limiting (position 500ms, velocity 1s, ID immediate)
- Include time-based debouncing to handle rapid update bursts
- Provide automatic cleanup and eviction of stale aircraft
- Add comprehensive statistics and monitoring via control port
- Integrate CLI arguments for rate limit configuration
- Maintain backward compatibility with existing tracker functionality
- Add 19 comprehensive unit and integration tests
- Update documentation with usage examples and architectural details
This addresses streaming data applications that need to track item state
while discarding frequent, noisy updates and ejecting inactive items.
-**Preamble Detector** (`src/preamble_detector.rs`): Detects ADS-B message preambles in the signal
30
36
-**Demodulator** (`src/demodulator.rs`): Demodulates detected frames into bit streams
31
37
-**Decoder** (`src/decoder.rs`): Decodes bit streams into ADS-B packets using the `adsb_deku` library
32
-
-**Tracker** (`src/tracker.rs`): Maintains aircraft state and position tracking with optional aircraft lifetime management
38
+
-**Tracker** (`src/tracker.rs`): Maintains aircraft state and position tracking with optional aircraft lifetime management and rate limiting
39
+
-**Rate Limiter** (`src/rate_limiter.rs`): Provides configurable rate limiting to reduce CPU usage on high-frequency updates
33
40
34
41
### Signal Processing Flow
35
42
@@ -52,9 +59,66 @@ The application uses FutureSDR's flowgraph architecture:
52
59
53
60
Edit `config.toml` to modify:
54
61
-`log_level`: Logging verbosity
55
-
-`ctrlport_bind`: Web server bind address and port
62
+
-`ctrlport_bind`: Web server bind address and port
56
63
-`frontend_path`: Path to web interface files
57
64
65
+
## Rate Limiting
66
+
67
+
AirJedi includes sophisticated rate limiting capabilities to reduce CPU usage in high-traffic scenarios where aircraft send frequent, repetitive updates. This is particularly useful for GPS data processing where updates need to be filtered to prevent resource waste.
68
+
69
+
### Features
70
+
71
+
-**Per-aircraft rate limiting**: Each aircraft is tracked independently
72
+
-**Per-message type limiting**: Different limits for positions, velocities, identification, and metadata
73
+
-**Time-based debouncing**: Rapid updates are queued and only the latest is processed
74
+
-**Automatic cleanup**: Inactive aircraft are automatically removed from tracking
75
+
-**Real-time monitoring**: Statistics and metrics available via control port
76
+
77
+
### Default Rate Limits
78
+
79
+
-**Position updates**: 500ms (maximum 2 updates per second)
80
+
-**Velocity updates**: 1000ms (maximum 1 update per second)
81
+
-**Identification updates**: 0ms (immediate, no rate limiting)
82
+
-**Metadata updates**: 5000ms (maximum 1 update per 5 seconds)
83
+
84
+
### Usage
85
+
86
+
```bash
87
+
# Enable rate limiting with default settings
88
+
cargo run -- --rate-limit
89
+
90
+
# Customize rate limiting intervals (in milliseconds)
91
+
cargo run -- --rate-limit \
92
+
--position-rate-ms 1000 \
93
+
--velocity-rate-ms 2000 \
94
+
--identification-rate-ms 0 \
95
+
--metadata-rate-ms 10000
96
+
97
+
# Rate limiting works with all output formats
98
+
cargo run -- --rate-limit --beast --raw --sbs1 --websocket
99
+
```
100
+
101
+
### Monitoring
102
+
103
+
Rate limiting statistics are logged every 30 seconds when enabled:
104
+
```
105
+
Rate Limiting Stats: 1250 total updates, 65% immediate, 35% rate-limited, 12 active aircraft, 8 pending updates
106
+
```
107
+
108
+
You can also query statistics via the control port:
109
+
- Send `"stats"` to get rate limiting statistics in JSON format
110
+
- Send `"aircraft"` to get aircraft data (same as before)
111
+
112
+
### Architecture
113
+
114
+
The rate limiting system uses a **Rate-Limited State Manager** pattern that combines:
115
+
-**State tracking** per aircraft with configurable update intervals
116
+
-**Time-based debouncing** to handle rapid update bursts
117
+
-**LRU-style cleanup** to prevent memory leaks from inactive aircraft
118
+
-**Multi-tier output pipeline** separating immediate broadcasting from state updates
119
+
120
+
This ensures external consumers (via BEAST, Raw, SBS-1, WebSocket outputs) always receive immediate updates while internal state tracking is intelligently rate-limited.
121
+
58
122
## Dependencies
59
123
60
124
-**FutureSDR**: Signal processing framework (version 0.0.38 from crates.io)
0 commit comments