Skip to main content

ADR-002: Rust Async Runtime Selection

Status

Superseded by synchronous VR architecture (see ADR-023)

Context

The VR overlay system initially planned to use an async runtime for handling I/O operations, network requests, and coordination between components while maintaining real-time performance constraints.

Original Decision (Historical)

We selected Tokio as our async runtime with careful configuration:

  • Custom thread pools for different priority workloads
  • Pinned threads for latency-critical paths
  • Separate runtime for VR event polling
  • No async in the rendering hot path

Current Status (Updated 2025-01-19)

This decision has been superseded. The VROP architecture now uses:

  • Synchronous game loop for all VR operations (OpenVR requirement)
  • Async only for non-VR operations (IPC, network, file I/O) in separate threads
  • Single-threaded OpenVR operations to meet API constraints

See ADR-023 for the synchronous architecture decision.

Original Consequences

Positive

  • Mature ecosystem with extensive library support
  • Good performance characteristics
  • Built-in tracing and metrics
  • Well-documented and maintained

Negative

  • Additional dependency
  • Runtime overhead for simple operations
  • Complexity in mixing sync/async code
  • Potential for priority inversion if misconfigured

Lessons Learned

  • OpenVR's single-threaded requirements conflict with async patterns
  • Frame timing precision requires synchronous control flow
  • Async overhead impacts VR latency requirements (<7ms frame budget)
  • Plugin systems work better with synchronous APIs

Implementation (Historical)

The original implementation used:

  • Main runtime for general I/O and coordination
  • Dedicated single-threaded runtime for VR event polling
  • Synchronous code for all rendering and IPC hot paths

Current Implementation

  • Synchronous main thread for VR operations
  • Worker threads with Tokio for async operations
  • Channel-based communication between sync and async worlds
  • No async/await in plugin APIs or VR hot paths
  • ADR-023: Synchronous VR Architecture
  • ADR-022: VROS Architecture