ironrdp-async crate, with runtime-specific implementations for Tokio and Futures. This guide covers async patterns, performance optimization, and best practices.
Async vs Blocking
When to Use Async
✅ Use async I/O when:- Handling multiple concurrent connections
- Building servers that need to scale
- Integrating with existing async codebases
- Requiring non-blocking I/O for responsiveness
When to Use Blocking
✅ Use blocking I/O when:- Building simple single-connection clients
- Prototyping or testing
- Working in environments without async runtime
- Simplicity is more important than concurrency
Architecture
IronRDP’s async architecture uses these crates:ironrdp-async- Runtime-agnostic async abstractionsironrdp-tokio- Tokio-specific implementationsironrdp-futures- Futures-specific implementations
Async Client Example
Here’s a complete async client using Tokio:Async Server Example
Theironrdp-server crate is built on async/await:
Concurrency Patterns
Multiple Concurrent Connections
Async Channel Communication
Timeout Handling
Graceful Shutdown
Performance Optimization
Buffering Strategy
Batch Processing
Connection Pooling
Error Handling
Retry Logic
Async Error Propagation
Runtime Selection
Using Tokio
Using async-std (via Futures)
Testing Async Code
Best Practices
- Use
tokio::spawnfor independent tasks - Don’t block the async runtime - Avoid blocking operations - Use async alternatives or
spawn_blocking - Handle backpressure - Use bounded channels and flow control
- Set timeouts - Always timeout long-running operations
- Graceful shutdown - Clean up resources properly
- Monitor task health - Use supervision strategies for critical tasks
Next Steps
- Building a Client - Build async clients
- Building a Server - Understand the async server
- Virtual Channels - Async channel processing

