Skip to content

Improve replay throughput and asynchronous event fan-out#33

Merged
jillesvangurp merged 6 commits intomainfrom
performance-tweaks
Apr 2, 2026
Merged

Improve replay throughput and asynchronous event fan-out#33
jillesvangurp merged 6 commits intomainfrom
performance-tweaks

Conversation

@jillesvangurp
Copy link
Copy Markdown
Contributor

@jillesvangurp jillesvangurp commented Apr 2, 2026

Summary

This PR improves end-to-end replay throughput by taking more work off the synchronous ingest path and by reducing downstream event delivery overhead.

What Changed

  • Introduces an explicit two-stage async ingest pipeline in the hub:
    • a native publication stage for native location and motion fan-out
    • a decision stage for transform-dependent follow-on work such as alternate-CRS publication, geofence evaluation, and collision evaluation
  • Keeps transforms lazy so they are only computed if a later stage actually needs them.
  • Adds a stable insertion point for future filtered track processing before fence/collision decisions without implementing filtering yet.
  • Adds runtime drop counters for overloaded non-critical paths.
  • Raises and externalizes queue sizing for event-bus subscribers, native publication, derived/decision processing, and WebSocket outbound buffering.
  • Changes WebSocket fan-out to batch internal events before encoding wrapper payloads.
  • Changes WebSocket slow-consumer behavior from immediate disconnect to dropping outbound payloads on overflow.
  • Adds a cheap collision prefilter based on active motions and bounding checks before full collision evaluation.
  • Batches replay connector WebSocket publishes with configurable batch window and maximum batch size.
  • Updates docs and replay connector configuration to describe the new pipeline and batching controls.

New Or Updated Knobs

  • EVENT_BUS_SUBSCRIBER_BUFFER
  • NATIVE_LOCATION_BUFFER
  • DERIVED_LOCATION_BUFFER
  • WEBSOCKET_OUTBOUND_BUFFER
  • REPLAY_BATCH_WINDOW_MS
  • REPLAY_MAX_BATCH_SIZE

Benchmark Result

Using the same captured OpenSky trace replayed with --interpolation-rate-hz 10.0:

  • scheduled emissions: 13,192
  • previous observed replayed location items: 8,639
  • new observed replayed location items: 13,192
  • fence events remained correct at 126, matching the live capture
  • WebSocket wrapper messages dropped from 8,640 to 1,409 because of batching

Validation

  • just bootstrap
  • just generate
  • just check
  • rebuilt the local demo stack and reran the OpenSky replay benchmark against the updated hub

@jillesvangurp jillesvangurp merged commit aa5cf24 into main Apr 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant